diff --git a/backend/app/models/__pycache__/focus_group.cpython-313.pyc b/backend/app/models/__pycache__/focus_group.cpython-313.pyc index 662ab209..6100fdbd 100644 Binary files a/backend/app/models/__pycache__/focus_group.cpython-313.pyc and b/backend/app/models/__pycache__/focus_group.cpython-313.pyc differ diff --git a/backend/app/models/focus_group.py b/backend/app/models/focus_group.py index 8665edb3..5a5bd319 100644 --- a/backend/app/models/focus_group.py +++ b/backend/app/models/focus_group.py @@ -414,7 +414,8 @@ class FocusGroup: "created_at": datetime.utcnow(), "highlighted": message_data.get("highlighted", False), "attached_assets": message_data.get("attached_assets", []), # List of asset filenames - "activates_visual_context": message_data.get("activates_visual_context", False) # Visual context activation flag + "activates_visual_context": message_data.get("activates_visual_context", False), # Visual context activation flag + "visual_asset": message_data.get("visual_asset") # Visual asset metadata {filename, displayReference} } # Insert the message @@ -437,7 +438,8 @@ class FocusGroup: 'type': message["type"], 'highlighted': message["highlighted"], 'attached_assets': message.get("attached_assets", []), - 'activates_visual_context': message.get("activates_visual_context", False) + 'activates_visual_context': message.get("activates_visual_context", False), + 'visualAsset': message.get("visual_asset") # Include visual asset metadata } print(f"šŸ”” EMITTING WEBSOCKET EVENT: message_update for focus group {focus_group_id}") print(f"šŸ”” Message data: sender={message_for_websocket['senderId']}, type={message_for_websocket['type']}") @@ -838,6 +840,7 @@ class FocusGroup: cleaned_asset = { "filename": asset["filename"], "original_name": asset["original_name"], + "user_assigned_name": asset.get("user_assigned_name"), # New field for custom naming "size": asset["size"], "mime_type": asset["mime_type"], "upload_date": asset["upload_date"] @@ -893,6 +896,27 @@ class FocusGroup: print(traceback.format_exc()) return [] + @staticmethod + def update_asset_name(focus_group_id, filename, user_assigned_name): + """Update the user assigned name for an uploaded asset.""" + db = get_db() + try: + result = db.focus_groups.update_one( + {"_id": ObjectId(focus_group_id), "uploaded_assets.filename": filename}, + { + "$set": { + "uploaded_assets.$.user_assigned_name": user_assigned_name, + "updated_at": datetime.utcnow() + } + } + ) + + return result.modified_count > 0 + except Exception as e: + print(f"Error updating asset name for focus group {focus_group_id}: {e}") + print(traceback.format_exc()) + return False + @staticmethod def clear_uploaded_assets(focus_group_id): """Clear all uploaded assets for a focus group from database.""" @@ -928,23 +952,41 @@ class FocusGroup: new_records = [] updated_filenames = [] + # Get uploaded assets to fetch display references + uploaded_assets = focus_group.get('uploaded_assets', []) + for filename in asset_filenames: + # Find the asset metadata to get display reference + asset_metadata = next((asset for asset in uploaded_assets if asset.get('filename') == filename), None) + + # Generate display reference + if asset_metadata: + if asset_metadata.get('user_assigned_name'): + display_reference = asset_metadata['user_assigned_name'] + else: + # Find the index of this asset in the uploaded assets to generate "Asset N" + asset_index = next((i for i, asset in enumerate(uploaded_assets) if asset.get('filename') == filename), 0) + display_reference = f"Asset {asset_index + 1}" + else: + display_reference = f"Unknown Asset" + # Check if this asset is already in the active context existing_asset = next((asset for asset in existing_context if asset["filename"] == filename), None) if existing_asset: # Asset already exists - we'll update its sequence to current position updated_filenames.append(filename) - print(f"šŸ”„ Re-activating existing visual asset: {filename} (moving to sequence {message_count})") + print(f"šŸ”„ Re-activating existing visual asset: {filename} ({display_reference}) (moving to sequence {message_count})") else: # New asset - add to records new_records.append({ "filename": filename, + "display_reference": display_reference, "activated_at_message_id": message_id, "activated_at_sequence": message_count, "activation_timestamp": datetime.utcnow() }) - print(f"šŸ†• Activating new visual asset: {filename} at sequence {message_count}") + print(f"šŸ†• Activating new visual asset: {filename} ({display_reference}) at sequence {message_count}") # First, update existing assets to current sequence for filename in updated_filenames: diff --git a/backend/app/routes/__pycache__/focus_group_ai.cpython-313.pyc b/backend/app/routes/__pycache__/focus_group_ai.cpython-313.pyc index 24e47cd9..b9bb1456 100644 Binary files a/backend/app/routes/__pycache__/focus_group_ai.cpython-313.pyc and b/backend/app/routes/__pycache__/focus_group_ai.cpython-313.pyc differ diff --git a/backend/app/routes/__pycache__/focus_groups.cpython-313.pyc b/backend/app/routes/__pycache__/focus_groups.cpython-313.pyc index 41d7bab3..26afc8db 100644 Binary files a/backend/app/routes/__pycache__/focus_groups.cpython-313.pyc and b/backend/app/routes/__pycache__/focus_groups.cpython-313.pyc differ diff --git a/backend/app/routes/__pycache__/personas.cpython-313.pyc b/backend/app/routes/__pycache__/personas.cpython-313.pyc index 13c7130e..2b55f2cd 100644 Binary files a/backend/app/routes/__pycache__/personas.cpython-313.pyc and b/backend/app/routes/__pycache__/personas.cpython-313.pyc differ diff --git a/backend/app/routes/focus_group_ai.py b/backend/app/routes/focus_group_ai.py index 352f9c2f..e1c1b30d 100644 --- a/backend/app/routes/focus_group_ai.py +++ b/backend/app/routes/focus_group_ai.py @@ -203,9 +203,14 @@ Be genuine and specific in your feedback, drawing on your personal experiences a verbosity=verbosity ) - # Log success + # Log success with response details response_type = "contextual with visual context" if has_visual_context else "standard" print(f"āœ… Generated {response_type} response for persona {persona_id}") + print(f"šŸ” RESPONSE DEBUG:") + print(f" - Response length: {len(response_text) if response_text else 0} characters") + print(f" - Response type: {type(response_text)}") + print(f" - Response preview: '{response_text[:200] if response_text else 'EMPTY'}...'") + print(f" - Response repr: {repr(response_text[:50]) if response_text else 'NONE'}") current_app.logger.info(f"Generated {response_type} response for persona {persona_id} in focus group {focus_group_id}") except Exception as e: print(f"āŒ Error in response generation: {str(e)}") @@ -221,7 +226,10 @@ Be genuine and specific in your feedback, drawing on your personal experiences a "type": "response", "senderId": persona_id } - print(f"šŸ’¾ Message data: {message_data}") + print(f"šŸ’¾ Message data keys: {list(message_data.keys())}") + print(f"šŸ’¾ Message text length: {len(message_data['text']) if message_data['text'] else 0}") + print(f"šŸ’¾ Message text preview: '{message_data['text'][:100] if message_data['text'] else 'EMPTY'}...'") + print(f"šŸ’¾ Message text repr: {repr(message_data['text'][:20]) if message_data['text'] else 'NONE'}") print(f"šŸ’¾ Calling FocusGroup.add_message...") message_id = FocusGroup.add_message(focus_group_id, message_data) @@ -498,14 +506,27 @@ def advance_moderator_discussion(focus_group_id): current_item = result.get("current_item") if current_item: - # Extract asset filename from the activity content (works for any item type) - activity_content = current_item.get("content", "") - asset_filename = extract_asset_filename_from_content(activity_content) + # Try to get asset info from metadata (new metadata-driven approach) + asset_filename = None + display_reference = None + + metadata = current_item.get('metadata', {}) + visual_asset = metadata.get('visual_asset') + + if visual_asset: + # Use metadata (preferred method) + asset_filename = visual_asset.get('filename') + display_reference = visual_asset.get('display_reference') + print(f"šŸŽØ Found asset metadata: {display_reference} -> {asset_filename}") + else: + # Fallback to content parsing (legacy support) + activity_content = current_item.get("content", "") + asset_filename = extract_asset_filename_from_content(activity_content) + print(f"šŸŽØ Legacy asset filename extraction: {asset_filename}") if asset_filename: print(f"šŸŽØ ADVANCE DISCUSSION: Item with image detected (type: {current_item.get('type')})") - print(f"šŸŽØ Activity content: {activity_content}") - print(f"šŸŽØ Extracted asset filename: {asset_filename}") + print(f"šŸŽØ Asset: {display_reference or 'legacy'} -> {asset_filename}") if asset_filename: attached_assets = [asset_filename] @@ -515,10 +536,16 @@ def advance_moderator_discussion(focus_group_id): print(f"šŸŽØ AI MODE: Generating description for {asset_filename}") description = ImageDescriptionService.generate_description(focus_group_id, asset_filename) - # Enhance the moderator response with the description - enhanced_response = ImageDescriptionService.enhance_creative_review_question( - result["moderator_response"], asset_filename, description - ) + # Enhance the moderator response with the description using display reference if available + if display_reference: + enhanced_response = ImageDescriptionService.enhance_creative_review_question_with_display_reference( + result["moderator_response"], display_reference, description + ) + else: + # Fallback to old method for legacy content + enhanced_response = ImageDescriptionService.enhance_creative_review_question( + result["moderator_response"], asset_filename, description + ) # Update the result with enhanced response result["moderator_response"] = enhanced_response diff --git a/backend/app/routes/focus_groups.py b/backend/app/routes/focus_groups.py index 8abbed80..42b48560 100644 --- a/backend/app/routes/focus_groups.py +++ b/backend/app/routes/focus_groups.py @@ -523,8 +523,15 @@ def get_focus_group_messages(focus_group_id): messages = FocusGroup.get_messages(focus_group_id) mode_events = FocusGroup.get_mode_events(focus_group_id) - # Make messages and events serializable + # Make messages and events serializable and convert field names for frontend compatibility serializable_messages = make_serializable(messages) + + # Convert visual_asset field to visualAsset for frontend compatibility + for message in serializable_messages: + if 'visual_asset' in message and message['visual_asset']: + message['visualAsset'] = message['visual_asset'] + del message['visual_asset'] + serializable_mode_events = make_serializable(mode_events) return jsonify({ @@ -551,8 +558,35 @@ def add_focus_group_message(focus_group_id): if not focus_group: return jsonify({"message": "Focus group not found"}), 404 - # Check if this is a facilitator message with a creative asset - if data.get('senderId') == 'facilitator': + # Handle visual asset metadata for messages with visual context + if data.get('visualAsset') and data.get('visualAsset', {}).get('filename'): + visual_asset = data.get('visualAsset') + filename = visual_asset.get('filename') + + # Add asset information for legacy compatibility + data['attached_assets'] = [filename] + data['activates_visual_context'] = True + + # Store visual asset metadata in proper format for database + data['visual_asset'] = { + 'filename': visual_asset.get('filename'), + 'displayReference': visual_asset.get('displayReference') + } + + print(f"šŸŽØ MESSAGE WITH VISUAL ASSET: {visual_asset.get('displayReference')} -> {filename}") + + # Activate visual assets in the focus group for LLM context + try: + success = FocusGroup._activate_visual_assets(focus_group_id, [filename], None) + if success: + print(f"āœ… VISUAL CONTEXT ACTIVATED: {filename} ({visual_asset.get('displayReference')})") + else: + print(f"āš ļø Failed to activate visual context for: {filename}") + except Exception as activation_error: + print(f"āš ļø Error activating visual context: {activation_error}") + + # Legacy fallback: Check if this is a facilitator message with a creative asset (for backward compatibility) + elif data.get('senderId') == 'facilitator': try: from app.services.focus_group_response_service import extract_asset_filename_from_content @@ -565,7 +599,7 @@ def add_focus_group_message(focus_group_id): data['attached_assets'] = [asset_filename] data['activates_visual_context'] = True - print(f"šŸŽØ FACILITATOR MESSAGE: Detected creative asset: {asset_filename}") + print(f"šŸŽØ LEGACY FACILITATOR MESSAGE: Detected creative asset: {asset_filename}") print(f"šŸŽØ Message text: {message_text}") # Activate visual assets in the focus group for LLM context @@ -1416,6 +1450,7 @@ def get_assets(focus_group_id): asset_info = { "filename": asset.get("filename"), "original_name": asset.get("original_name"), + "user_assigned_name": asset.get("user_assigned_name"), "size": asset.get("size"), "mime_type": asset.get("mime_type"), "upload_date": asset.get("upload_date") @@ -1520,6 +1555,44 @@ def delete_asset(focus_group_id, filename): print(f"Error in delete_asset: {e}") return jsonify({"error": str(e)}), 500 +@focus_groups_bp.route('//assets/', methods=['PATCH']) +@jwt_required(optional=True) # Make JWT optional for development +def update_asset_name(focus_group_id, filename): + """Update the user assigned name for an uploaded asset.""" + try: + # Verify focus group exists + focus_group = FocusGroup.find_by_id(focus_group_id) + if not focus_group: + return jsonify({"error": "Focus group not found"}), 404 + + # Get request data + data = request.get_json() + if not data or 'user_assigned_name' not in data: + return jsonify({"error": "Missing user_assigned_name field"}), 400 + + user_assigned_name = data['user_assigned_name'] + + # Validate that the asset exists + assets = focus_group.get('uploaded_assets', []) + asset = next((a for a in assets if a.get('filename') == filename), None) + if not asset: + return jsonify({"error": "Asset not found"}), 404 + + # Update the asset name + success = FocusGroup.update_asset_name(focus_group_id, filename, user_assigned_name) + if not success: + return jsonify({"error": "Failed to update asset name"}), 500 + + return jsonify({ + "message": "Asset name updated successfully", + "filename": filename, + "user_assigned_name": user_assigned_name + }), 200 + + except Exception as e: + print(f"Error in update_asset_name: {e}") + return jsonify({"error": str(e)}), 500 + @focus_groups_bp.route('//test-endpoint', methods=['POST']) @jwt_required(optional=True) # Make JWT optional for development def test_endpoint(focus_group_id): diff --git a/backend/app/routes/personas.py b/backend/app/routes/personas.py index 3360b5d6..6f4868c7 100644 --- a/backend/app/routes/personas.py +++ b/backend/app/routes/personas.py @@ -1,6 +1,7 @@ from flask import Blueprint, request, jsonify from flask_jwt_extended import jwt_required, get_jwt_identity from app.models.persona import Persona +from app.services.persona_export_service import PersonaExportService from bson import ObjectId import datetime @@ -150,4 +151,65 @@ def create_multiple_personas(): return jsonify({ "message": f"Successfully created {len(persona_ids)} personas", "persona_ids": persona_ids - }), 201 \ No newline at end of file + }), 201 + +@personas_bp.route('//export-profile', methods=['POST']) +@jwt_required(optional=True) # Make JWT optional for development +def export_persona_profile(persona_id): + """ + Export a persona profile as beautifully formatted markdown. + + Request body can optionally include: + - llm_model: Model to use (defaults to 'gpt-4.1') + - temperature: Temperature for generation (defaults to 0.3) + """ + try: + # Get the persona data + persona = Persona.find_by_id(persona_id) + if not persona: + return jsonify({"error": "Persona not found"}), 404 + + # Get optional parameters from request + request_data = request.get_json() or {} + llm_model = request_data.get('llm_model', 'gpt-4.1') + temperature = request_data.get('temperature', 0.3) + + # Initialize export service + export_service = PersonaExportService() + + # Make persona data serializable for JSON processing + persona_data = make_serializable(persona) + + print(f"šŸ¤– Backend: Exporting profile for persona {persona_data.get('name', persona_id)} using {llm_model}") + + # Generate the markdown profile + result = export_service.generate_profile_markdown( + persona_data=persona_data, + llm_model=llm_model, + temperature=temperature + ) + + if result.get('success'): + return jsonify({ + "success": True, + "markdown_content": result['markdown_content'], + "persona_name": result['persona_name'], + "model_used": result.get('model_used'), + "content_length": result.get('content_length') + }), 200 + else: + # If LLM generation failed, try fallback + print(f"āš ļø LLM generation failed, using fallback for {persona_data.get('name', persona_id)}") + fallback_markdown = export_service.generate_fallback_markdown(persona_data) + + return jsonify({ + "success": True, + "markdown_content": fallback_markdown, + "persona_name": persona_data.get('name', 'Unknown Persona'), + "model_used": "fallback", + "warning": "Used fallback formatting due to LLM error" + }), 200 + + except Exception as e: + print(f"Error in export_persona_profile: {e}") + return jsonify({"error": f"Failed to export persona profile: {str(e)}"}), 500 \ No newline at end of file diff --git a/backend/app/services/__pycache__/autonomous_conversation_controller.cpython-313.pyc b/backend/app/services/__pycache__/autonomous_conversation_controller.cpython-313.pyc index 6ce52848..cfac7b31 100644 Binary files a/backend/app/services/__pycache__/autonomous_conversation_controller.cpython-313.pyc and b/backend/app/services/__pycache__/autonomous_conversation_controller.cpython-313.pyc differ diff --git a/backend/app/services/__pycache__/conversation_context_service.cpython-313.pyc b/backend/app/services/__pycache__/conversation_context_service.cpython-313.pyc index 7990ed40..108daf1d 100644 Binary files a/backend/app/services/__pycache__/conversation_context_service.cpython-313.pyc and b/backend/app/services/__pycache__/conversation_context_service.cpython-313.pyc differ diff --git a/backend/app/services/__pycache__/focus_group_service.cpython-313.pyc b/backend/app/services/__pycache__/focus_group_service.cpython-313.pyc index 40fd6198..14fdf0f4 100644 Binary files a/backend/app/services/__pycache__/focus_group_service.cpython-313.pyc and b/backend/app/services/__pycache__/focus_group_service.cpython-313.pyc differ diff --git a/backend/app/services/__pycache__/image_description_service.cpython-313.pyc b/backend/app/services/__pycache__/image_description_service.cpython-313.pyc index b8e13a7f..3f0a3cd7 100644 Binary files a/backend/app/services/__pycache__/image_description_service.cpython-313.pyc and b/backend/app/services/__pycache__/image_description_service.cpython-313.pyc differ diff --git a/backend/app/services/__pycache__/llm_service.cpython-313.pyc b/backend/app/services/__pycache__/llm_service.cpython-313.pyc index c4bda187..0f20f405 100644 Binary files a/backend/app/services/__pycache__/llm_service.cpython-313.pyc and b/backend/app/services/__pycache__/llm_service.cpython-313.pyc differ diff --git a/backend/app/services/__pycache__/persona_export_service.cpython-313.pyc b/backend/app/services/__pycache__/persona_export_service.cpython-313.pyc new file mode 100644 index 00000000..69f7d0d8 Binary files /dev/null and b/backend/app/services/__pycache__/persona_export_service.cpython-313.pyc differ diff --git a/backend/app/services/autonomous_conversation_controller.py b/backend/app/services/autonomous_conversation_controller.py index bb414c4b..f1efe634 100644 --- a/backend/app/services/autonomous_conversation_controller.py +++ b/backend/app/services/autonomous_conversation_controller.py @@ -157,7 +157,6 @@ class AutonomousConversationController: # The FocusGroup.update() will trigger the websocket event automatically # Log the mode change event for automatic completion - from app.models.focus_group import FocusGroup completion_events = ['completed', 'discussion_guide_completed', 'natural_completion'] if reason in completion_events: mode_event_id = FocusGroup.add_mode_event(self.focus_group_id, 'ai_session_concluded', None) @@ -836,14 +835,28 @@ class AutonomousConversationController: print(f"šŸ” Item to check: {current_item}") if current_item: print(f"šŸ” Item type: {current_item.get('type')}") - # Extract asset filename from the content (works for any item type) - activity_content = current_item.get('content', '') - asset_filename = extract_asset_filename_from_content(activity_content) - print(f"šŸ” Asset filename extraction: {asset_filename}") + + # Try to get asset info from metadata (new metadata-driven approach) + asset_filename = None + display_reference = None + + metadata = current_item.get('metadata', {}) + visual_asset = metadata.get('visual_asset') + + if visual_asset: + # Use metadata (preferred method) + asset_filename = visual_asset.get('filename') + display_reference = visual_asset.get('display_reference') + print(f"šŸ” Found asset metadata: {display_reference} -> {asset_filename}") + else: + # Fallback to content parsing (legacy support) + activity_content = current_item.get('content', '') + asset_filename = extract_asset_filename_from_content(activity_content) + print(f"šŸ” Legacy asset filename extraction: {asset_filename}") if asset_filename: - print(f"šŸ” Item with image found! Type: {current_item.get('type')}, Content: {activity_content}") - print(f"šŸ” Extracted asset filename: {asset_filename}") + print(f"šŸ” Item with image found! Type: {current_item.get('type')}") + print(f"šŸ” Asset: {display_reference or 'legacy'} -> {asset_filename}") attached_assets = [asset_filename] activates_visual_context = True @@ -859,10 +872,16 @@ class AutonomousConversationController: print(f"šŸŽØ AI MODE: Generating description for {asset_filename}") description = ImageDescriptionService.generate_description(self.focus_group_id, asset_filename) - # Enhance the content with the description - enhanced_content = ImageDescriptionService.enhance_creative_review_question( - content, asset_filename, description - ) + # Enhance the content with the description using display reference if available + if display_reference: + enhanced_content = ImageDescriptionService.enhance_creative_review_question_with_display_reference( + content, display_reference, description + ) + else: + # Fallback to old method for legacy content + enhanced_content = ImageDescriptionService.enhance_creative_review_question( + content, asset_filename, description + ) # Update the content to use enhanced version content = enhanced_content diff --git a/backend/app/services/conversation_context_service.py b/backend/app/services/conversation_context_service.py index 616c9fa2..c8fe4a89 100644 --- a/backend/app/services/conversation_context_service.py +++ b/backend/app/services/conversation_context_service.py @@ -621,16 +621,19 @@ class ConversationContextService: focus_group_id, asset["filename"] ) + display_reference = asset.get("display_reference", asset["filename"]) + conversation_context.append({ "type": "image", "path": asset_path, "filename": asset["filename"], + "display_reference": display_reference, "sequence": sequence, "activated_at_message_id": asset.get("activated_at_message_id"), "activation_timestamp": asset.get("activation_timestamp") }) - print(f"šŸ–¼ļø Added image to context: {asset['filename']} at sequence {sequence}") + print(f"šŸ–¼ļø Added image to context: {asset['filename']} ({display_reference}) at sequence {sequence}") return conversation_context diff --git a/backend/app/services/focus_group_service.py b/backend/app/services/focus_group_service.py index ae4dc74f..e631fd08 100644 --- a/backend/app/services/focus_group_service.py +++ b/backend/app/services/focus_group_service.py @@ -122,8 +122,8 @@ class FocusGroupService: 'has_assets': len(uploaded_assets) > 0, 'asset_count': len(uploaded_assets), 'asset_requirement_note': ' (will require creative review activities)' if len(uploaded_assets) > 0 else '', - # Create a formatted list of asset filenames for the LLM - 'uploaded_asset_list': '\n'.join([f"- {asset.get('filename', 'unknown')} ({asset.get('original_name', asset.get('original_filename', 'unknown'))})" for asset in uploaded_assets]) if uploaded_assets else 'No assets uploaded', + # Create a formatted list of asset display references for the LLM + 'uploaded_asset_list': '\n'.join([f"- {DiscussionGuideValidator.generate_display_reference(uploaded_assets, i)} ({asset.get('original_name', asset.get('original_filename', 'unknown'))})" for i, asset in enumerate(uploaded_assets)]) if uploaded_assets else 'No assets uploaded', # Conditional content for asset sections 'assets_section': FocusGroupService._generate_assets_section(uploaded_assets) if uploaded_assets else 'No creative assets have been uploaded for this focus group.' } @@ -146,10 +146,11 @@ class FocusGroupService: if uploaded_assets and len(uploaded_assets) > 0: asset_emphasis = f"\n\n🚨🚨🚨 CRITICAL FOR GPT MODELS - READ THIS FIRST 🚨🚨🚨\n" asset_emphasis += f"YOU ABSOLUTELY MUST INCLUDE EXACTLY {len(uploaded_assets)} ACTIVITIES WITH type='creative_review'\n" - asset_emphasis += f"EACH activity must reference ONE of these exact filenames:\n" - for asset in uploaded_assets: - asset_emphasis += f"- {asset.get('filename', 'unknown')}\n" - asset_emphasis += f"FAILURE TO INCLUDE ALL {len(uploaded_assets)} CREATIVE_REVIEW ACTIVITIES WILL RESULT IN INVALID OUTPUT\n" + asset_emphasis += f"EACH activity must reference ONE of these display references in content AND include metadata:\n" + for i, asset in enumerate(uploaded_assets): + display_ref = DiscussionGuideValidator.generate_display_reference(uploaded_assets, i) + asset_emphasis += f"- Display Reference: '{display_ref}' -> Filename: {asset.get('filename', 'unknown')}\n" + asset_emphasis += f"FAILURE TO INCLUDE ALL {len(uploaded_assets)} CREATIVE_REVIEW ACTIVITIES WITH PROPER METADATA WILL RESULT IN INVALID OUTPUT\n" asset_emphasis += f"🚨🚨🚨 END CRITICAL INSTRUCTIONS 🚨🚨🚨\n\n" enhanced_prompt = asset_emphasis + prompt @@ -256,6 +257,12 @@ class FocusGroupService: logger.info(f"Discussion guide generation successful on attempt {attempt}/{max_retries}") logger.info(f"Generated guide has {len(guide_json.get('sections', []))} sections") + + # Post-process the discussion guide to add visual asset metadata to creative_review activities + if uploaded_assets and len(uploaded_assets) > 0: + logger.info(f"Post-processing discussion guide to add visual asset metadata") + guide_json = FocusGroupService._add_visual_asset_metadata_to_guide(guide_json, uploaded_assets) + return guide_json else: error_msg = f"Generated JSON failed validation: {validation_errors}" @@ -290,29 +297,167 @@ class FocusGroupService: return 'No creative assets have been uploaded for this focus group.' asset_count = len(uploaded_assets) - uploaded_asset_list = '\n'.join([f"- {asset.get('filename', 'unknown')} ({asset.get('original_name', asset.get('original_filename', 'unknown'))})" for asset in uploaded_assets]) + # Create list of display references and asset metadata for the LLM + asset_entries = [] + for i, asset in enumerate(uploaded_assets): + display_ref = DiscussionGuideValidator.generate_display_reference(uploaded_assets, i) + asset_entries.append({ + 'display_reference': display_ref, + 'filename': asset.get('filename', 'unknown'), + 'original_name': asset.get('original_name', asset.get('original_filename', 'unknown')) + }) + uploaded_asset_list = '\n'.join([f"- {entry['display_reference']} (original: {entry['original_name']})" for entry in asset_entries]) + asset_metadata_list = '\n'.join([f"- Display Reference: '{entry['display_reference']}' -> System Filename: {entry['filename']}" for entry in asset_entries]) + + @staticmethod + def _add_visual_asset_metadata_to_guide(guide_json: Dict[str, Any], uploaded_assets: List[Dict[str, Any]]) -> Dict[str, Any]: + """ + Post-process the discussion guide to add visual asset metadata to creative_review activities. + This ensures that moderator systems can identify which asset each activity references. + """ + from app.utils.discussion_guide_schema import DiscussionGuideValidator + + # Create a mapping of display references to asset data + asset_mapping = {} + for i, asset in enumerate(uploaded_assets): + display_ref = DiscussionGuideValidator.generate_display_reference(uploaded_assets, i) + asset_mapping[display_ref.lower()] = { + 'filename': asset.get('filename'), + 'display_reference': display_ref + } + + processed_count = 0 + + # Process all sections + sections = guide_json.get('sections', []) + for section in sections: + # Process activities in section + activities = section.get('activities', []) + for activity in activities: + if activity.get('type') == 'creative_review': + if FocusGroupService._add_metadata_to_activity(activity, asset_mapping): + processed_count += 1 + + # Process questions in section (some may be creative_review type) + questions = section.get('questions', []) + for question in questions: + if question.get('type') == 'creative_review': + if FocusGroupService._add_metadata_to_activity(question, asset_mapping): + processed_count += 1 + + # Process subsections + subsections = section.get('subsections', []) + for subsection in subsections: + # Process activities in subsection + activities = subsection.get('activities', []) + for activity in activities: + if activity.get('type') == 'creative_review': + if FocusGroupService._add_metadata_to_activity(activity, asset_mapping): + processed_count += 1 + + # Process questions in subsection + questions = subsection.get('questions', []) + for question in questions: + if question.get('type') == 'creative_review': + if FocusGroupService._add_metadata_to_activity(question, asset_mapping): + processed_count += 1 + + print(f"āœ… POST-PROCESS: Added metadata to {processed_count} creative_review activities") + return guide_json + + @staticmethod + def _add_metadata_to_activity(activity: Dict[str, Any], asset_mapping: Dict[str, Dict[str, str]]) -> bool: + """ + Add visual asset metadata to a single activity based on its content. + Returns True if metadata was added, False otherwise. + """ + content = activity.get('content', '').lower() + + # Find which asset this activity references by checking content for display references + matched_asset = None + for display_ref, asset_data in asset_mapping.items(): + if display_ref in content: + matched_asset = asset_data + break + + if matched_asset: + # Add metadata to the activity + if 'metadata' not in activity: + activity['metadata'] = {} + + activity['metadata']['visual_asset'] = { + 'filename': matched_asset['filename'], + 'display_reference': matched_asset['display_reference'] + } + + print(f"šŸ“Ž Added metadata to activity: {matched_asset['display_reference']} -> {matched_asset['filename']}") + return True + else: + print(f"āš ļø Could not match creative_review activity to asset: {activity.get('content', '')[:50]}...") + return False + + @staticmethod + def _generate_assets_section(uploaded_assets: List[Dict[str, Any]]) -> str: + """Generate the assets section content for the discussion guide prompt.""" + if not uploaded_assets: + return 'No creative assets have been uploaded for this focus group.' + + asset_count = len(uploaded_assets) + # Create list of display references and asset metadata for the LLM + asset_entries = [] + for i, asset in enumerate(uploaded_assets): + display_ref = DiscussionGuideValidator.generate_display_reference(uploaded_assets, i) + asset_entries.append({ + 'display_reference': display_ref, + 'filename': asset.get('filename', 'unknown'), + 'original_name': asset.get('original_name', asset.get('original_filename', 'unknown')) + }) + + uploaded_asset_list = '\n'.join([f"- {entry['display_reference']} (original: {entry['original_name']})" for entry in asset_entries]) + asset_metadata_list = '\n'.join([f"- Display Reference: '{entry['display_reference']}' -> System Filename: {entry['filename']}" for entry in asset_entries]) + return f"""🚨 CRITICAL REQUIREMENT: This focus group has {asset_count} uploaded creative asset(s) that MUST be included in the discussion guide. **MANDATORY CREATIVE REVIEW ACTIVITIES:** YOU MUST CREATE EXACTLY {asset_count} "creative_review" ACTIVITIES - ONE FOR EACH ASSET BELOW: -**UPLOADED ASSET FILENAMES:** +**UPLOADED ASSETS:** {uploaded_asset_list} **CREATIVE REVIEW ACTIVITY REQUIREMENTS:** -- CREATE one "creative_review" activity for EACH asset filename listed above +- CREATE one "creative_review" activity for EACH asset listed above - Each activity type MUST be "creative_review" (not "open_question" or any other type) -- MANDATORY: Include the exact asset filename in the activity content -- Example format: "Please take a look at the creative asset on your screen, titled 'EXACT_FILENAME_HERE'. What is your immediate gut reaction? What words come to mind?" +- MANDATORY: Reference the display name (e.g., "Asset 1", "My Campaign Ad") in the activity content - DO NOT use system filenames +- Example format: "Please review [DISPLAY_REFERENCE] on your screen. What is your immediate gut reaction? What words come to mind?" - Distribute these activities throughout different sections (not all in one place) - Allow 3-5 minutes per creative review activity - Add 1-2 probe questions after each creative review +**IMPORTANT METADATA REQUIREMENTS:** +For each creative_review activity, you MUST also include metadata that maps the display reference to the system filename: +```json +{{ + "id": "creative_review_1", + "type": "creative_review", + "content": "Please review Asset 1 on your screen. What is your immediate gut reaction?", + "metadata": {{ + "visual_asset": {{ + "filename": "fg-123-abc.jpg", + "display_reference": "Asset 1" + }} + }} +}} +``` + +**ASSET METADATA MAPPING:** +{asset_metadata_list} + **VALIDATION CHECKLIST:** Before finalizing your JSON, verify: ā–” You have created exactly {asset_count} activities with type "creative_review" -ā–” Each creative_review activity includes an exact filename from the asset list above +ā–” Each creative_review activity references a display name (not system filename) in the content +ā–” Each creative_review activity has proper metadata with visual_asset field ā–” Creative review activities are spread across different sections of the guide ā–” Each creative review activity has adequate time allocation diff --git a/backend/app/services/image_description_service.py b/backend/app/services/image_description_service.py index 23cab046..d5ae058a 100644 --- a/backend/app/services/image_description_service.py +++ b/backend/app/services/image_description_service.py @@ -183,4 +183,75 @@ class ImageDescriptionService: error_msg = f"Failed to enhance question for {asset_filename}: {str(e)}" print(f"āŒ ENHANCEMENT: {error_msg}") # Return original question if enhancement fails + return original_question + + @staticmethod + def enhance_creative_review_question_with_display_reference(original_question: str, display_reference: str, description: str) -> str: + """ + Enhance a creative review question by incorporating AI-generated image description using display reference. + This is the new metadata-driven approach that doesn't rely on filename parsing. + + Args: + original_question: The original question text + display_reference: The display reference (e.g., "Asset 1", "My Campaign Ad") + description: The AI-generated description of the image + + Returns: + Enhanced question text with detailed visual description + """ + try: + import re + + print(f"šŸ”§ ENHANCEMENT: Enhancing question for display reference: {display_reference}") + print(f"šŸ”§ Original: {original_question[:100]}...") + print(f"šŸ”§ Description: {description[:100]}...") + + # Use regex patterns to handle punctuation and variations + # Escape the display reference for regex use + escaped_reference = re.escape(display_reference) + + # Define patterns that match display references in various contexts + regex_patterns = [ + # Quoted display references with optional punctuation + (rf"('{escaped_reference}')([.,;!?]*)", rf"\1 - {description}\2"), + (rf'("{escaped_reference}")([.,;!?]*)', rf'\1 - {description}\2'), + + # Common phrases with display references + (rf"(review\s+{escaped_reference})([.,;!?]*)", rf"\1 - {description}\2"), + (rf"(look at\s+{escaped_reference})([.,;!?]*)", rf"\1 - {description}\2"), + (rf"(consider\s+{escaped_reference})([.,;!?]*)", rf"\1 - {description}\2"), + (rf"(examine\s+{escaped_reference})([.,;!?]*)", rf"\1 - {description}\2"), + + # Direct display reference with word boundaries + (rf"\b({escaped_reference})\b([.,;!?]*)", rf"\1 - {description}\2") + ] + + enhanced_question = original_question + enhancement_applied = False + + # Try each regex pattern + for pattern, replacement in regex_patterns: + if re.search(pattern, enhanced_question, re.IGNORECASE): + enhanced_question = re.sub(pattern, replacement, enhanced_question, flags=re.IGNORECASE) + print(f"āœ… ENHANCEMENT: Enhanced with regex pattern: {enhanced_question[:150]}...") + enhancement_applied = True + break + + # If no regex patterns worked, try simple string replacement as fallback + if not enhancement_applied and display_reference in original_question: + enhanced_question = enhanced_question.replace(display_reference, f"{display_reference} - {description}") + print(f"āœ… ENHANCEMENT: Enhanced with simple replacement: {enhanced_question[:150]}...") + enhancement_applied = True + + # Final fallback: append description if no enhancements worked + if not enhancement_applied: + enhanced_question = f"{original_question} The {display_reference.lower()} shows {description}." + print(f"āš ļø ENHANCEMENT: Appended description to end: {enhanced_question[:150]}...") + + return enhanced_question + + except Exception as e: + error_msg = f"Failed to enhance question for {display_reference}: {str(e)}" + print(f"āŒ ENHANCEMENT: {error_msg}") + # Return original question if enhancement fails return original_question \ No newline at end of file diff --git a/backend/app/services/llm_service.py b/backend/app/services/llm_service.py index c1774b85..f825c9e8 100644 --- a/backend/app/services/llm_service.py +++ b/backend/app/services/llm_service.py @@ -761,7 +761,7 @@ class LLMService: kwargs["max_tokens"] = max_tokens response = openai_client.chat.completions.create(**kwargs) - result = LLMService._extract_responses_api_content(response) + result = response.choices[0].message.content.strip() else: # Gemini contextual multimodal API call (existing logic) @@ -789,6 +789,11 @@ class LLMService: logger.info(f"Contextual multimodal generation succeeded on attempt {attempt_num}/{max_retries}") print(f"āœ… Generated contextual response with visual context using {provider}") + print(f"šŸ” LLM RESULT DEBUG:") + print(f" - Result type: {type(result)}") + print(f" - Result length: {len(result) if result else 0} characters") + print(f" - Result preview: '{result[:200] if result else 'EMPTY'}...'") + print(f" - Result repr: {repr(result[:50]) if result else 'NONE'}") return result except Exception as e: diff --git a/backend/app/services/persona_export_service.py b/backend/app/services/persona_export_service.py new file mode 100644 index 00000000..df258c16 --- /dev/null +++ b/backend/app/services/persona_export_service.py @@ -0,0 +1,171 @@ +""" +Persona Profile Export Service + +Generates beautifully formatted markdown profiles for individual personas using LLM processing. +""" + +import os +import json +import logging +from typing import Dict, Any, Optional +from app.services.llm_service import LLMService + +# Configure logging +logging.basicConfig(level=logging.INFO) +logger = logging.getLogger(__name__) + +class PersonaExportService: + """Service for exporting individual persona profiles as formatted markdown.""" + + def __init__(self): + """Initialize the persona export service.""" + self.llm_service = LLMService() + self.prompt_template = self._load_prompt_template() + + def _load_prompt_template(self) -> str: + """Load the persona profile export prompt template.""" + try: + prompt_path = os.path.join( + os.path.dirname(__file__), + "..", + "..", + "prompts", + "persona-profile-export.md" + ) + with open(prompt_path, 'r', encoding='utf-8') as f: + return f.read() + except Exception as e: + logger.error(f"Failed to load persona export prompt template: {e}") + # Fallback prompt if file loading fails + return """ + You are a professional documentation specialist. Transform the provided persona JSON data + into a well-structured, professional markdown document with proper headers, tables, lists, + and formatting. Include all available information organized logically with sections for + demographics, goals, personality traits, scenarios, and additional data. + """ + + def generate_profile_markdown( + self, + persona_data: Dict[str, Any], + llm_model: str = "gpt-4.1", + temperature: float = 0.3 + ) -> Dict[str, Any]: + """ + Generate a formatted markdown profile for a persona using LLM processing. + + Args: + persona_data: Complete persona data as dictionary + llm_model: LLM model to use (default: gpt-4.1 for speed) + temperature: Temperature for LLM generation (lower for consistency) + + Returns: + Dictionary containing: + - success: Boolean indicating success + - markdown_content: Generated markdown string + - error: Error message if failed + - persona_name: Name of the persona + """ + try: + # Validate input data + if not persona_data: + return { + "success": False, + "error": "No persona data provided", + "markdown_content": None, + "persona_name": None + } + + persona_name = persona_data.get('name', 'Unknown Persona') + logger.info(f"šŸ¤– Backend: Generating profile markdown for persona: {persona_name} using {llm_model}") + + # Prepare the full prompt + persona_json = json.dumps(persona_data, indent=2, ensure_ascii=False) + full_prompt = f"{self.prompt_template}\n\n## Persona Data\n```json\n{persona_json}\n```" + + # Generate markdown using LLM + markdown_content = self.llm_service.generate_content( + prompt=full_prompt, + model_name=llm_model, + temperature=temperature, + max_tokens=4000 # Allow for comprehensive profiles + ) + + if not markdown_content: + return { + "success": False, + "error": "LLM failed to generate markdown content", + "markdown_content": None, + "persona_name": persona_name + } + + markdown_content = markdown_content.strip() + + # Basic validation of generated content + if len(markdown_content) < 100: # Too short, likely an error + logger.warning(f"Generated markdown seems too short for {persona_name}") + return { + "success": False, + "error": "Generated markdown content appears incomplete", + "markdown_content": None, + "persona_name": persona_name + } + + logger.info(f"āœ… Successfully generated profile markdown for {persona_name} ({len(markdown_content)} characters)") + + return { + "success": True, + "markdown_content": markdown_content, + "persona_name": persona_name, + "model_used": llm_model, + "content_length": len(markdown_content) + } + + except Exception as e: + logger.error(f"Error generating persona profile markdown: {str(e)}") + return { + "success": False, + "error": f"Failed to generate markdown profile: {str(e)}", + "markdown_content": None, + "persona_name": persona_data.get('name', 'Unknown') if persona_data else None + } + + def generate_fallback_markdown(self, persona_data: Dict[str, Any]) -> str: + """ + Generate a basic fallback markdown if LLM processing fails. + + Args: + persona_data: Complete persona data as dictionary + + Returns: + Basic markdown string + """ + try: + name = persona_data.get('name', 'Unknown Persona') + occupation = persona_data.get('occupation', 'Unknown') + age = persona_data.get('age', 'Unknown') + location = persona_data.get('location', 'Unknown') + + # Create basic markdown structure + markdown = f"""# {name} - Complete Profile + +## Overview +{name} is a {age} year old {occupation} based in {location}. + +## Basic Information +- **Name:** {name} +- **Age:** {age} +- **Occupation:** {occupation} +- **Location:** {location} + +## Raw Data +```json +{json.dumps(persona_data, indent=2, ensure_ascii=False)} +``` + +*This is a basic export. For enhanced formatting, please try again later.* +""" + return markdown + + except Exception as e: + logger.error(f"Failed to generate fallback markdown: {e}") + return f"# Persona Profile Export\n\nError generating profile. Raw data:\n\n```json\n{json.dumps(persona_data, indent=2)}\n```" \ No newline at end of file diff --git a/backend/app/utils/__pycache__/discussion_guide_schema.cpython-313.pyc b/backend/app/utils/__pycache__/discussion_guide_schema.cpython-313.pyc index 53cf6720..83aae041 100644 Binary files a/backend/app/utils/__pycache__/discussion_guide_schema.cpython-313.pyc and b/backend/app/utils/__pycache__/discussion_guide_schema.cpython-313.pyc differ diff --git a/backend/app/utils/discussion_guide_schema.py b/backend/app/utils/discussion_guide_schema.py index cf8aec82..b8ba05ad 100644 --- a/backend/app/utils/discussion_guide_schema.py +++ b/backend/app/utils/discussion_guide_schema.py @@ -66,6 +66,45 @@ class StructuredDiscussionGuide: class DiscussionGuideValidator: """Validates and processes discussion guide JSON structures.""" + @staticmethod + def create_visual_asset_metadata(filename: str, display_reference: str) -> Dict[str, Any]: + """ + Create visual asset metadata for questions/activities. + + Args: + filename: The system filename (e.g., 'fg-123-abc.jpg') + display_reference: User-friendly reference (e.g., 'Asset 1' or custom name) + + Returns: + Visual asset metadata dictionary + """ + return { + "visual_asset": { + "filename": filename, + "display_reference": display_reference + } + } + + @staticmethod + def generate_display_reference(assets: List[Dict[str, Any]], asset_index: int) -> str: + """ + Generate a display reference for an asset based on user assignment or default numbering. + + Args: + assets: List of asset metadata objects + asset_index: Index of the current asset + + Returns: + Display reference string + """ + asset = assets[asset_index] + + # Use user-assigned name if available, otherwise use numbered reference + if asset.get("user_assigned_name"): + return asset["user_assigned_name"] + else: + return f"Asset {asset_index + 1}" + @staticmethod def validate_json_structure(guide_json: Dict[str, Any]) -> tuple[bool, List[str]]: """ diff --git a/backend/prompts/persona-profile-export.md b/backend/prompts/persona-profile-export.md new file mode 100644 index 00000000..d161958d --- /dev/null +++ b/backend/prompts/persona-profile-export.md @@ -0,0 +1,84 @@ +# Persona Profile Export + +You are a professional documentation specialist tasked with creating a comprehensive, beautifully formatted markdown profile for a synthetic persona used in market research and user experience design. + +## Task +Transform the provided persona JSON data into a well-structured, professional markdown document that presents all available information in a logical, hierarchical manner. + +## Formatting Guidelines + +### Structure +Use the following hierarchical structure: +1. **Profile Header** - Name and key identifier +2. **Overview** - Brief summary of who they are +3. **Demographics & Background** - Core demographic information in table format +4. **Digital Behavior & Preferences** - Technology usage and digital patterns +5. **Goals & Motivations** - What drives them +6. **Personality Analysis** - OCEAN traits and behavioral insights +7. **Behavioral Patterns** - Think/Feel/Do framework +8. **Life Scenarios** - Real-world usage scenarios +9. **Additional Information** - Any remaining relevant data + +### Formatting Rules +- Use proper markdown headers (`#`, `##`, `###`) +- Create tables for structured data (demographics, traits, metrics) +- Use bullet points for lists (goals, frustrations, scenarios) +- Use numbered lists for sequential items when appropriate +- Include horizontal rules (`---`) between major sections +- Format percentages and metrics clearly +- Use **bold** for important terms and values +- Use *italics* for emphasis when needed +- Ensure proper spacing between sections + +### Content Guidelines +- Present information in a professional, research-oriented tone +- Group related information logically +- Include all available data fields, but organize them sensibly +- For OCEAN personality traits, include both numeric values and descriptive interpretations +- For metrics like tech savviness, brand loyalty, etc., present as percentages with context +- Format scenarios as numbered, descriptive use cases +- Handle missing or null fields gracefully (omit rather than show "null") + +## Example Structure +```markdown +# [Persona Name] - Complete Profile + +## Overview +Brief 2-3 sentence summary of the persona's key characteristics and role. + +## Demographics & Background + +| Attribute | Value | +|-----------|-------| +| Age | [age] | +| Gender | [gender] | +| Occupation | [occupation] | +| Education | [education] | +| Location | [location] | + +## Digital Behavior & Preferences + +- **Tech Savviness:** [X]% - [interpretation] +- **Brand Loyalty:** [X]% - [interpretation] +- **Price Consciousness:** [X]% - [interpretation] + +## Goals & Motivations + +### Primary Goals +1. [goal 1] +2. [goal 2] + +### Key Frustrations +- [frustration 1] +- [frustration 2] + +--- + +[Continue with remaining sections...] +``` + +## Input +You will receive a JSON object containing all persona data. Transform this into the beautifully formatted markdown structure described above. + +## Output +Return only the formatted markdown content, ready for saving as a .md file. Do not include any explanatory text or comments outside the markdown content itself. \ No newline at end of file diff --git a/dist/assets/index-BLNu9bos.css b/dist/assets/index-BLNu9bos.css new file mode 100644 index 00000000..c1f3a48d --- /dev/null +++ b/dist/assets/index-BLNu9bos.css @@ -0,0 +1 @@ +@import"https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap";.back-button{position:absolute;top:1.25rem;left:1.25rem;z-index:10;display:flex;align-items:center;justify-content:center;width:2.5rem;height:2.5rem;border-radius:9999px;background-color:#fffc;border:1px solid rgba(0,0,0,.1);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);transition:all .15s ease}.back-button:hover{background-color:#ffffffe6;transform:translateY(-1px);box-shadow:0 2px 4px #0000000d}.back-button:active{transform:translateY(0)}.back-button-content{display:flex;align-items:center;gap:.25rem}.page-header-with-back{display:flex;align-items:center;gap:.75rem;padding-left:2.5rem;position:relative}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 350 30% 98%;--foreground: 345 30% 15%;--card: 0 0% 100%;--card-foreground: 345 30% 15%;--popover: 0 0% 100%;--popover-foreground: 345 30% 15%;--primary: 350 85% 80%;--primary-foreground: 350 30% 20%;--secondary: 350 30% 96.1%;--secondary-foreground: 345 30% 15%;--muted: 350 30% 96.1%;--muted-foreground: 350 10% 50%;--accent: 350 30% 96.1%;--accent-foreground: 345 30% 15%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 350 30% 98%;--border: 350 30% 91.4%;--input: 350 30% 91.4%;--ring: 350 85% 80%;--radius: .5rem;--sidebar-background: 0 0% 100%;--sidebar-foreground: 345 30% 15%;--sidebar-primary: 350 85% 80%;--sidebar-primary-foreground: 350 30% 20%;--sidebar-accent: 350 30% 96.1%;--sidebar-accent-foreground: 345 30% 15%;--sidebar-border: 350 30% 91.4%;--sidebar-ring: 350 85% 80%}.dark{--background: 345 30% 10%;--foreground: 350 30% 98%;--card: 345 30% 10%;--card-foreground: 350 30% 98%;--popover: 345 30% 10%;--popover-foreground: 350 30% 98%;--primary: 350 85% 80%;--primary-foreground: 345 30% 15%;--secondary: 342 20% 17.5%;--secondary-foreground: 350 30% 98%;--muted: 342 20% 17.5%;--muted-foreground: 350 10% 70%;--accent: 342 20% 17.5%;--accent-foreground: 350 30% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 350 30% 98%;--border: 342 20% 17.5%;--input: 342 20% 17.5%;--ring: 350 70% 85%;--sidebar-background: 345 30% 10%;--sidebar-foreground: 350 30% 98%;--sidebar-primary: 350 85% 80%;--sidebar-primary-foreground: 350 30% 98%;--sidebar-accent: 342 20% 17.5%;--sidebar-accent-foreground: 350 30% 98%;--sidebar-border: 342 20% 17.5%;--sidebar-ring: 350 70% 85%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));font-family:Inter,system-ui,sans-serif;color:hsl(var(--foreground));font-feature-settings:"rlig" 1,"calt" 1}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background-color:transparent}::-webkit-scrollbar-thumb{border-radius:9999px;background-color:hsl(var(--muted-foreground) / .4)}::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--muted-foreground) / .6)}@font-face{font-family:SF Pro Display;src:local("SF Pro Display"),local("SFProDisplay"),url(https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-regular-webfont.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:SF Pro Display;src:local("SF Pro Display Medium"),local("SFProDisplay-Medium"),url(https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-medium-webfont.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:SF Pro Display;src:local("SF Pro Display Semibold"),local("SFProDisplay-Semibold"),url(https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-semibold-webfont.woff) format("woff");font-weight:600;font-style:normal}@font-face{font-family:SF Pro Display;src:local("SF Pro Display Bold"),local("SFProDisplay-Bold"),url(https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-bold-webfont.woff) format("woff");font-weight:700;font-style:normal}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}.glass-card{border-width:1px;border-color:#fff3;background-color:#fffc;--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.glass-panel{border-width:1px;border-color:#fff6;background-color:#ffffffe6;--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.text-gradient{background-image:linear-gradient(to right,var(--tw-gradient-stops));--tw-gradient-from: hsl(var(--primary)) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);--tw-gradient-to: #f9a8d4 var(--tw-gradient-to-position);-webkit-background-clip:text;background-clip:text;color:transparent}.hover-transition{transition-property:all;transition-duration:.3s;transition-timing-function:cubic-bezier(.4,0,.2,1);animation-duration:.3s;animation-timing-function:cubic-bezier(.4,0,.2,1)}.button-transition{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;transition-timing-function:cubic-bezier(0,0,.2,1);animation-duration:.2s;animation-timing-function:cubic-bezier(0,0,.2,1)}.sidebar-icon{margin-right:.75rem;margin-top:.125rem;height:1rem;width:1rem;flex-shrink:0;--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.sidebar-section{display:flex;align-items:flex-start}.sidebar-sub-item{font-size:.875rem;line-height:1.25rem;color:hsl(var(--muted-foreground))}.persona-card{position:relative;overflow:hidden;min-height:360px}.persona-card-overlay{pointer-events:none;position:absolute;top:0;right:0;bottom:0;left:0;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;transition-timing-function:cubic-bezier(0,0,.2,1);animation-duration:.2s;animation-timing-function:cubic-bezier(0,0,.2,1)}.persona-card:hover .persona-card-overlay,.persona-card.selected .persona-card-overlay{background-color:#ecd1de4d}.persona-card-checkmark{position:absolute;top:.75rem;left:.75rem;z-index:20;opacity:0;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;transition-timing-function:cubic-bezier(0,0,.2,1);animation-duration:.2s;animation-timing-function:cubic-bezier(0,0,.2,1);border-radius:9999px;border-width:1px;border-color:#fff6;background-color:#ffffffe6;padding:.25rem;--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.persona-card.selected .persona-card-checkmark{opacity:1}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-bottom-12{bottom:-3rem}.-left-12{left:-3rem}.-right-12{right:-3rem}.-top-12{top:-3rem}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.bottom-5{bottom:1.25rem}.bottom-6{bottom:1.5rem}.bottom-\[-10rem\]{bottom:-10rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-3{left:.75rem}.left-4{left:1rem}.left-\[50\%\]{left:50%}.left-\[calc\(50\%\+11rem\)\]{left:calc(50% + 11rem)}.left-\[calc\(50\%-11rem\)\]{left:calc(50% - 11rem)}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.top-0{top:0}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-16{top:4rem}.top-2{top:.5rem}.top-20{top:5rem}.top-3\.5{top:.875rem}.top-4{top:1rem}.top-\[-10rem\]{top:-10rem}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.isolate{isolation:isolate}.-z-10{z-index:-10}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[1\]{z-index:1}.col-span-full{grid-column:1 / -1}.m-0{margin:0}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3\.5{margin-left:.875rem;margin-right:.875rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.-ml-4{margin-left:-1rem}.-mt-4{margin-top:-1rem}.mb-1{margin-bottom:.25rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-5{margin-right:1.25rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-10{margin-top:2.5rem}.mt-12{margin-top:3rem}.mt-16{margin-top:4rem}.mt-2{margin-top:.5rem}.mt-24{margin-top:6rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-\[1155\/678\]{aspect-ratio:1155/678}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.h-0{height:0px}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-36{height:9rem}.h-4{height:1rem}.h-40{height:10rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-80{height:20rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1px\]{height:1px}.h-\[25vh\]{height:25vh}.h-\[450px\]{height:450px}.h-\[70vh\]{height:70vh}.h-\[calc\(100vh-12rem\)\]{height:calc(100vh - 12rem)}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-48{max-height:12rem}.max-h-60{max-height:15rem}.max-h-96{max-height:24rem}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-\[70vh\]{max-height:70vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-full{max-height:100%}.min-h-0{min-height:0px}.min-h-\[100px\]{min-height:100px}.min-h-\[40px\]{min-height:40px}.min-h-\[60px\]{min-height:60px}.min-h-\[80px\]{min-height:80px}.min-h-screen{min-height:100vh}.min-h-svh{min-height:100svh}.w-0{width:0px}.w-1{width:.25rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-5\/6{width:83.333333%}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[--sidebar-width\]{width:var(--sidebar-width)}.w-\[100px\]{width:100px}.w-\[1px\]{width:1px}.w-\[350px\]{width:350px}.w-\[36\.125rem\]{width:36.125rem}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-32{min-width:8rem}.min-w-36{min-width:9rem}.min-w-5{min-width:1.25rem}.min-w-\[12rem\]{min-width:12rem}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-7xl{max-width:80rem}.max-w-\[--skeleton-width\]{max-width:var(--skeleton-width)}.max-w-\[400px\]{max-width:400px}.max-w-\[70\%\]{max-width:70%}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.grow-0{flex-grow:0}.basis-full{flex-basis:100%}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-px{--tw-translate-x: -1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-px{--tw-translate-x: 1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-\[30deg\]{--tw-rotate: 30deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform-gpu{transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.animate-fade-in{animation:fade-in .5s ease-out}@keyframes float{0%,to{transform:translateY(0)}50%{transform:translateY(-5px)}}.animate-float{animation:float 3s ease-in-out infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.resize-y{resize:vertical}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-6{-moz-column-gap:1.5rem;column-gap:1.5rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-8>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(2rem * var(--tw-space-x-reverse));margin-left:calc(2rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-t-\[10px\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-\[1\.5px\]{border-width:1.5px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-t-2{border-top-width:2px}.border-dashed{border-style:dashed}.border-\[\#0078d4\]{--tw-border-opacity: 1;border-color:rgb(0 120 212 / var(--tw-border-opacity, 1))}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-200{--tw-border-opacity: 1;border-color:rgb(233 213 255 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-sidebar-border{border-color:hsl(var(--sidebar-border))}.border-slate-100{--tw-border-opacity: 1;border-color:rgb(241 245 249 / var(--tw-border-opacity, 1))}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity, 1))}.border-slate-200\/80{border-color:#e2e8f0cc}.border-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-l-green-500{--tw-border-opacity: 1;border-left-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-l-primary{border-left-color:hsl(var(--primary))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[\#0078d4\]{--tw-bg-opacity: 1;background-color:rgb(0 120 212 / var(--tw-bg-opacity, 1))}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-100{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-50\/50{background-color:#eff6ff80}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-foreground{background-color:hsl(var(--foreground))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-500{--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity, 1))}.bg-gray-900\/10{background-color:#1118271a}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-pink-200{--tw-bg-opacity: 1;background-color:rgb(251 207 232 / var(--tw-bg-opacity, 1))}.bg-pink-300{--tw-bg-opacity: 1;background-color:rgb(249 168 212 / var(--tw-bg-opacity, 1))}.bg-pink-400{--tw-bg-opacity: 1;background-color:rgb(244 114 182 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-50{--tw-bg-opacity: 1;background-color:rgb(250 245 255 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-sidebar{background-color:hsl(var(--sidebar-background))}.bg-sidebar-border{background-color:hsl(var(--sidebar-border))}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-50{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/70{background-color:#ffffffb3}.bg-white\/80{background-color:#fffc}.bg-yellow-400{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-tr{background-image:linear-gradient(to top right,var(--tw-gradient-stops))}.from-blue-400{--tw-gradient-from: #60a5fa var(--tw-gradient-from-position);--tw-gradient-to: rgb(96 165 250 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-100{--tw-gradient-from: #f3f4f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(243 244 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary{--tw-gradient-from: hsl(var(--primary)) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-blue-400{--tw-gradient-to: #60a5fa var(--tw-gradient-to-position)}.to-blue-400\/5{--tw-gradient-to: rgb(96 165 250 / .05) var(--tw-gradient-to-position)}.to-gray-200{--tw-gradient-to: #e5e7eb var(--tw-gradient-to-position)}.to-primary{--tw-gradient-to: hsl(var(--primary)) var(--tw-gradient-to-position)}.to-slate-50{--tw-gradient-to: #f8fafc var(--tw-gradient-to-position)}.fill-amber-400{fill:#fbbf24}.fill-current{fill:currentColor}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-10{padding-left:2.5rem}.pl-2\.5{padding-left:.625rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-4{padding-right:1rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-16{padding-top:4rem}.pt-2{padding-top:.5rem}.pt-20{padding-top:5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:Inter,system-ui,sans-serif}.font-sf{font-family:SF Pro Display,system-ui,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.8rem\]{font-size:.8rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-6{line-height:1.5rem}.leading-8{line-height:2rem}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}.text-purple-800{--tw-text-opacity: 1;color:rgb(107 33 168 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sidebar-foreground{color:hsl(var(--sidebar-foreground))}.text-sidebar-foreground\/70{color:hsl(var(--sidebar-foreground) / .7)}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity, 1))}.text-slate-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.shadow-\[0_-2px_4px_rgba\(0\,0\,0\,0\.05\)\]{--tw-shadow: 0 -2px 4px rgba(0,0,0,.05);--tw-shadow-colored: 0 -2px 4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_0_1px_hsl\(var\(--sidebar-border\)\)\]{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-border));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-blue-200{--tw-ring-opacity: 1;--tw-ring-color: rgb(191 219 254 / var(--tw-ring-opacity, 1))}.ring-gray-900\/10{--tw-ring-color: rgb(17 24 39 / .1)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-ring{--tw-ring-color: hsl(var(--ring))}.ring-sidebar-ring{--tw-ring-color: hsl(var(--sidebar-ring))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.ring-offset-white{--tw-ring-offset-color: #fff}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[left\,right\,width\]{transition-property:left,right,width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\,opa\]{transition-property:margin,opa;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\,height\,padding\]{transition-property:width,height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.fade-in-80{--tw-enter-opacity: .8}.zoom-in-95{--tw-enter-scale: .95}.duration-1000{animation-duration:1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{animation-timing-function:linear}.running{animation-play-state:running}.paused{animation-play-state:paused}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-slate-500::-moz-placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-500::placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:-inset-2:after{content:var(--tw-content);top:-.5rem;right:-.5rem;bottom:-.5rem;left:-.5rem}.after\:inset-y-0:after{content:var(--tw-content);top:0;bottom:0}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-1:after{content:var(--tw-content);width:.25rem}.after\:w-\[2px\]:after{content:var(--tw-content);width:2px}.after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.first\:rounded-l-md:first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.first\:border-l:first-child{border-left-width:1px}.last\:rounded-r-md:last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.last\:border-b-0:last-child{border-bottom-width:0px}.last\:pb-0:last-child{padding-bottom:0}.focus-within\:relative:focus-within{position:relative}.focus-within\:z-20:focus-within{z-index:20}.hover\:translate-y-\[-2px\]:hover{--tw-translate-y: -2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:translate-y-\[-4px\]:hover{--tw-translate-y: -4px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[\#106ebe\]:hover{--tw-border-opacity: 1;border-color:rgb(16 110 190 / var(--tw-border-opacity, 1))}.hover\:border-slate-300:hover{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#106ebe\]:hover{--tw-bg-opacity: 1;background-color:rgb(16 110 190 / var(--tw-bg-opacity, 1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50\/50:hover{background-color:#f9fafb80}.hover\:bg-green-600:hover{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary:hover{background-color:hsl(var(--primary))}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-sidebar-accent:hover{background-color:hsl(var(--sidebar-accent))}.hover\:bg-slate-100:hover{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-200:hover{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-300:hover{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-50:hover{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity, 1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.hover\:text-blue-800:hover{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-gray-200:hover{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.hover\:text-muted-foreground:hover{color:hsl(var(--muted-foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary-foreground:hover{color:hsl(var(--primary-foreground))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-sidebar-accent-foreground:hover{color:hsl(var(--sidebar-accent-foreground))}.hover\:text-slate-900:hover{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-\[0_0_0_1px_hsl\(var\(--sidebar-accent\)\)\]:hover{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-accent));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-xl:hover{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-gray-900\/20:hover{--tw-ring-color: rgb(17 24 39 / .2)}.hover\:after\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:hsl(var(--sidebar-border))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-primary:focus{background-color:hsl(var(--primary))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-primary-foreground:focus{color:hsl(var(--primary-foreground))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-primary:focus{--tw-ring-color: hsl(var(--primary))}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-sidebar-ring:focus-visible{--tw-ring-color: hsl(var(--sidebar-ring))}.focus-visible\:ring-slate-950:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(2 6 23 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width: 1px}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:bg-sidebar-accent:active{background-color:hsl(var(--sidebar-accent))}.active\:text-sidebar-accent-foreground:active{color:hsl(var(--sidebar-accent-foreground))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group\/menu-item:focus-within .group-focus-within\/menu-item\:opacity-100{opacity:1}.group\/menu-item:hover .group-hover\/menu-item\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.group.toast .group-\[\.toast\]\:absolute{position:absolute}.group.toast .group-\[\.toast\]\:left-3{left:.75rem}.group.toast .group-\[\.toast\]\:top-3{top:.75rem}.group.toast .group-\[\.toast\]\:h-5{height:1.25rem}.group.toast .group-\[\.toast\]\:w-5{width:1.25rem}.group.toast .group-\[\.toast\]\:rounded-md{border-radius:calc(var(--radius) - 2px)}.group.toaster .group-\[\.toaster\]\:border-border{border-color:hsl(var(--border))}.group.toast .group-\[\.toast\]\:bg-muted{background-color:hsl(var(--muted))}.group.toast .group-\[\.toast\]\:bg-primary{background-color:hsl(var(--primary))}.group.toaster .group-\[\.toaster\]\:bg-background{background-color:hsl(var(--background))}.group.toast .group-\[\.toast\]\:p-1{padding:.25rem}.group.toaster .group-\[\.toaster\]\:pr-8{padding-right:2rem}.group.toast .group-\[\.toast\]\:text-foreground\/70{color:hsl(var(--foreground) / .7)}.group.toast .group-\[\.toast\]\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toast .group-\[\.toast\]\:text-primary-foreground{color:hsl(var(--primary-foreground))}.group.toaster .group-\[\.toaster\]\:text-foreground{color:hsl(var(--foreground))}.group.toast .group-\[\.toast\]\:opacity-100{opacity:1}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group.toast .group-\[\.toast\]\:transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.group.toast .hover\:group-\[\.toast\]\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.group.toast .hover\:group-\[\.toast\]\:text-foreground:hover{color:hsl(var(--foreground))}.group.toast .focus\:group-\[\.toast\]\:opacity-100:focus{opacity:1}.group.toast .focus\:group-\[\.toast\]\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.group.toast .focus\:group-\[\.toast\]\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group.toast .focus\:group-\[\.toast\]\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.peer\/menu-button:hover~.peer-hover\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.has-\[\[data-variant\=inset\]\]\:bg-sidebar:has([data-variant=inset]){background-color:hsl(var(--sidebar-background))}.has-\[\:disabled\]\:opacity-50:has(:disabled){opacity:.5}.group\/menu-item:has([data-sidebar=menu-action]) .group-has-\[\[data-sidebar\=menu-action\]\]\/menu-item\:pr-8{padding-right:2rem}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:bg-accent\/50[aria-selected=true]{background-color:hsl(var(--accent) / .5)}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.aria-selected\:opacity-100[aria-selected=true]{opacity:1}.aria-selected\:opacity-30[aria-selected=true]{opacity:.3}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[panel-group-direction\=vertical\]\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\[panel-group-direction\=vertical\]\:w-full[data-panel-group-direction=vertical]{width:100%}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=open\]\:rotate-90[data-state=open]{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[panel-group-direction\=vertical\]\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.data-\[active\=true\]\:bg-sidebar-accent[data-active=true]{background-color:hsl(var(--sidebar-accent))}.data-\[active\]\:bg-accent\/50[data-active]{background-color:hsl(var(--accent) / .5)}.data-\[selected\=\'true\'\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=on\]\:bg-accent[data-state=on],.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:hsl(var(--accent) / .5)}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[active\=true\]\:font-medium[data-active=true]{font-weight:500}.data-\[active\=true\]\:text-sidebar-accent-foreground[data-active=true]{color:hsl(var(--sidebar-accent-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=on\]\:text-accent-foreground[data-state=on],.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=open\]\:opacity-100[data-state=open]{opacity:1}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.data-\[motion\^\=from-\]\:animate-in[data-motion^=from-],.data-\[state\=open\]\:animate-in[data-state=open],.data-\[state\=visible\]\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[motion\^\=to-\]\:animate-out[data-motion^=to-],.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[state\=hidden\]\:animate-out[data-state=hidden]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[motion\^\=from-\]\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\[motion\^\=to-\]\:fade-out[data-motion^=to-],.data-\[state\=closed\]\:fade-out-0[data-state=closed],.data-\[state\=hidden\]\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open],.data-\[state\=visible\]\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[motion\=from-end\]\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\[motion\=from-start\]\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\[motion\=to-end\]\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\[motion\=to-start\]\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=closed\]\:duration-300[data-state=closed]{animation-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{animation-duration:.5s}.data-\[panel-group-direction\=vertical\]\:after\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:0}.data-\[panel-group-direction\=vertical\]\:after\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:.25rem}.data-\[panel-group-direction\=vertical\]\:after\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\[panel-group-direction\=vertical\]\:after\:-translate-y-1\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[panel-group-direction\=vertical\]\:after\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=open\]\:hover\:bg-sidebar-accent:hover[data-state=open]{background-color:hsl(var(--sidebar-accent))}.data-\[state\=open\]\:hover\:text-sidebar-accent-foreground:hover[data-state=open]{color:hsl(var(--sidebar-accent-foreground))}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:left-\[calc\(var\(--sidebar-width\)\*-1\)\]{left:calc(var(--sidebar-width) * -1)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:right-\[calc\(var\(--sidebar-width\)\*-1\)\]{right:calc(var(--sidebar-width) * -1)}.group[data-side=left] .group-data-\[side\=left\]\:-right-4{right:-1rem}.group[data-side=right] .group-data-\[side\=right\]\:left-0{left:0}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:-mt-8{margin-top:-2rem}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:hidden{display:none}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:\!size-8{width:2rem!important;height:2rem!important}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[--sidebar-width-icon\]{width:var(--sidebar-width-icon)}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)_\+_theme\(spacing\.4\)\)\]{width:calc(var(--sidebar-width-icon) + 1rem)}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)_\+_theme\(spacing\.4\)_\+2px\)\]{width:calc(var(--sidebar-width-icon) + 1rem + 2px)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:w-0{width:0px}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-side=right] .group-data-\[side\=right\]\:rotate-180,.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:overflow-hidden{overflow:hidden}.group[data-variant=floating] .group-data-\[variant\=floating\]\:rounded-lg{border-radius:var(--radius)}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border{border-width:1px}.group[data-side=left] .group-data-\[side\=left\]\:border-r{border-right-width:1px}.group[data-side=right] .group-data-\[side\=right\]\:border-l{border-left-width:1px}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border-sidebar-border{border-color:hsl(var(--sidebar-border))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:\!p-0{padding:0!important}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:\!p-2{padding:.5rem!important}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:opacity-0{opacity:0}.group[data-variant=floating] .group-data-\[variant\=floating\]\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:after\:left-full:after{content:var(--tw-content);left:100%}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:hover\:bg-sidebar:hover{background-color:hsl(var(--sidebar-background))}.peer\/menu-button[data-size=default]~.peer-data-\[size\=default\]\/menu-button\:top-1\.5{top:.375rem}.peer\/menu-button[data-size=lg]~.peer-data-\[size\=lg\]\/menu-button\:top-2\.5{top:.625rem}.peer\/menu-button[data-size=sm]~.peer-data-\[size\=sm\]\/menu-button\:top-1{top:.25rem}.peer[data-variant=inset]~.peer-data-\[variant\=inset\]\:min-h-\[calc\(100svh-theme\(spacing\.4\)\)\]{min-height:calc(100svh - 1rem)}.peer\/menu-button[data-active=true]~.peer-data-\[active\=true\]\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.dark\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:from-gray-900:is(.dark *){--tw-gradient-from: #111827 var(--tw-gradient-from-position);--tw-gradient-to: rgb(17 24 39 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:to-gray-800:is(.dark *){--tw-gradient-to: #1f2937 var(--tw-gradient-to-position)}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}@media (min-width: 640px){.sm\:bottom-\[-20rem\]{bottom:-20rem}.sm\:left-\[calc\(50\%\+30rem\)\]{left:calc(50% + 30rem)}.sm\:left-\[calc\(50\%-30rem\)\]{left:calc(50% - 30rem)}.sm\:top-\[-20rem\]{top:-20rem}.sm\:mt-0{margin-top:0}.sm\:mt-24{margin-top:6rem}.sm\:flex{display:flex}.sm\:w-\[72\.1875rem\]{width:72.1875rem}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2\.5{gap:.625rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-32{padding-top:8rem;padding-bottom:8rem}.sm\:text-left{text-align:left}.sm\:text-4xl{font-size:2.25rem;line-height:2.5rem}.sm\:text-6xl{font-size:3.75rem;line-height:1}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:mb-0{margin-bottom:0}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-64{width:16rem}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:border-l{border-left-width:1px}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:opacity-0{opacity:0}.after\:md\:hidden:after{content:var(--tw-content);display:none}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:m-2{margin:.5rem}.peer[data-state=collapsed][data-variant=inset]~.md\:peer-data-\[state\=collapsed\]\:peer-data-\[variant\=inset\]\:ml-2{margin-left:.5rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:ml-0{margin-left:0}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:rounded-xl{border-radius:.75rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}@media (min-width: 1024px){.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:mx-0{margin-left:0;margin-right:0}.lg\:mt-0{margin-top:0}.lg\:flex{display:flex}.lg\:w-64{width:16rem}.lg\:flex-auto{flex:1 1 auto}.lg\:flex-shrink-0{flex-shrink:0}.lg\:flex-grow{flex-grow:1}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}.lg\:gap-x-10{-moz-column-gap:2.5rem;column-gap:2.5rem}.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:py-40{padding-top:10rem;padding-bottom:10rem}}@media (min-width: 1280px){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\[\&\:has\(\[aria-selected\]\)\]\:bg-accent:has([aria-selected]){background-color:hsl(var(--accent))}.first\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-l-md:has([aria-selected]):first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.last\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-r-md:has([aria-selected]):last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\.day-outside\)\]\:bg-accent\/50:has([aria-selected].day-outside){background-color:hsl(var(--accent) / .5)}.\[\&\:has\(\[aria-selected\]\.day-range-end\)\]\:rounded-r-md:has([aria-selected].day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>button\]\:hidden>button{display:none}.\[\&\>span\:last-child\]\:truncate>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:size-4>svg{width:1rem;height:1rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:shrink-0>svg{flex-shrink:0}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\]\:text-sidebar-accent-foreground>svg{color:hsl(var(--sidebar-accent-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-panel-group-direction\=vertical\]\>div\]\:rotate-90[data-panel-group-direction=vertical]>div{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-side=left][data-collapsible=offcanvas] .\[\[data-side\=left\]\[data-collapsible\=offcanvas\]_\&\]\:-right-2{right:-.5rem}[data-side=left][data-state=collapsed] .\[\[data-side\=left\]\[data-state\=collapsed\]_\&\]\:cursor-e-resize{cursor:e-resize}[data-side=left] .\[\[data-side\=left\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-side=right][data-collapsible=offcanvas] .\[\[data-side\=right\]\[data-collapsible\=offcanvas\]_\&\]\:-left-2{left:-.5rem}[data-side=right][data-state=collapsed] .\[\[data-side\=right\]\[data-state\=collapsed\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-side=right] .\[\[data-side\=right\]_\&\]\:cursor-e-resize{cursor:e-resize} diff --git a/dist/assets/index-BgDz3VL9.js b/dist/assets/index-BgDz3VL9.js new file mode 100644 index 00000000..21be3941 --- /dev/null +++ b/dist/assets/index-BgDz3VL9.js @@ -0,0 +1,715 @@ +var uk=t=>{throw TypeError(t)};var nS=(t,e,n)=>e.has(t)||uk("Cannot "+n);var ge=(t,e,n)=>(nS(t,e,"read from private field"),n?n.call(t):e.get(t)),pn=(t,e,n)=>e.has(t)?uk("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),zt=(t,e,n,r)=>(nS(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Qr=(t,e,n)=>(nS(t,e,"access private method"),n);var Bg=(t,e,n,r)=>({set _(i){zt(t,e,i,n)},get _(){return ge(t,e,r)}});function HW(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var Hg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Q$={exports:{}},Kb={},X$={exports:{}},Yt={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var lg=Symbol.for("react.element"),zW=Symbol.for("react.portal"),VW=Symbol.for("react.fragment"),GW=Symbol.for("react.strict_mode"),KW=Symbol.for("react.profiler"),WW=Symbol.for("react.provider"),qW=Symbol.for("react.context"),YW=Symbol.for("react.forward_ref"),QW=Symbol.for("react.suspense"),XW=Symbol.for("react.memo"),JW=Symbol.for("react.lazy"),dk=Symbol.iterator;function ZW(t){return t===null||typeof t!="object"?null:(t=dk&&t[dk]||t["@@iterator"],typeof t=="function"?t:null)}var J$={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Z$=Object.assign,eL={};function kf(t,e,n){this.props=t,this.context=e,this.refs=eL,this.updater=n||J$}kf.prototype.isReactComponent={};kf.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};kf.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function tL(){}tL.prototype=kf.prototype;function xj(t,e,n){this.props=t,this.context=e,this.refs=eL,this.updater=n||J$}var bj=xj.prototype=new tL;bj.constructor=xj;Z$(bj,kf.prototype);bj.isPureReactComponent=!0;var fk=Array.isArray,nL=Object.prototype.hasOwnProperty,wj={current:null},rL={key:!0,ref:!0,__self:!0,__source:!0};function iL(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)nL.call(e,r)&&!rL.hasOwnProperty(r)&&(i[r]=e[r]);var c=arguments.length-2;if(c===1)i.children=n;else if(1>>1,J=R[q];if(0>>1;qi(oe,Y))sei(le,oe)?(R[q]=le,R[se]=Y,q=se):(R[q]=oe,R[F]=Y,q=F);else if(sei(le,Y))R[q]=le,R[se]=Y,q=se;else break e}}return L}function i(R,L){var Y=R.sortIndex-L.sortIndex;return Y!==0?Y:R.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var l=[],u=[],d=1,f=null,h=3,p=!1,g=!1,m=!1,v=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(R){for(var L=n(u);L!==null;){if(L.callback===null)r(u);else if(L.startTime<=R)r(u),L.sortIndex=L.expirationTime,e(l,L);else break;L=n(u)}}function S(R){if(m=!1,w(R),!g)if(n(l)!==null)g=!0,D(C);else{var L=n(u);L!==null&&B(S,L.startTime-R)}}function C(R,L){g=!1,m&&(m=!1,b(j),j=-1),p=!0;var Y=h;try{for(w(L),f=n(l);f!==null&&(!(f.expirationTime>L)||R&&!I());){var q=f.callback;if(typeof q=="function"){f.callback=null,h=f.priorityLevel;var J=q(f.expirationTime<=L);L=t.unstable_now(),typeof J=="function"?f.callback=J:f===n(l)&&r(l),w(L)}else r(l);f=n(l)}if(f!==null)var me=!0;else{var F=n(u);F!==null&&B(S,F.startTime-L),me=!1}return me}finally{f=null,h=Y,p=!1}}var _=!1,A=null,j=-1,T=5,k=-1;function I(){return!(t.unstable_now()-kR||125q?(R.sortIndex=Y,e(u,R),n(l)===null&&R===n(u)&&(m?(b(j),j=-1):m=!0,B(S,Y-q))):(R.sortIndex=J,e(l,R),g||p||(g=!0,D(C))),R},t.unstable_shouldYield=I,t.unstable_wrapCallback=function(R){var L=h;return function(){var Y=h;h=L;try{return R.apply(this,arguments)}finally{h=Y}}}})(uL);lL.exports=uL;var uq=lL.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var dq=y,is=uq;function Ce(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),MC=Object.prototype.hasOwnProperty,fq=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,pk={},mk={};function hq(t){return MC.call(mk,t)?!0:MC.call(pk,t)?!1:fq.test(t)?mk[t]=!0:(pk[t]=!0,!1)}function pq(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function mq(t,e,n,r){if(e===null||typeof e>"u"||pq(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Ci(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Wr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Wr[t]=new Ci(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Wr[e]=new Ci(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Wr[t]=new Ci(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Wr[t]=new Ci(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Wr[t]=new Ci(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Wr[t]=new Ci(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Wr[t]=new Ci(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Wr[t]=new Ci(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Wr[t]=new Ci(t,5,!1,t.toLowerCase(),null,!1,!1)});var Cj=/[\-:]([a-z])/g;function _j(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Cj,_j);Wr[e]=new Ci(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Cj,_j);Wr[e]=new Ci(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Cj,_j);Wr[e]=new Ci(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Wr[t]=new Ci(t,1,!1,t.toLowerCase(),null,!1,!1)});Wr.xlinkHref=new Ci("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Wr[t]=new Ci(t,1,!1,t.toLowerCase(),null,!0,!0)});function Aj(t,e,n,r){var i=Wr.hasOwnProperty(e)?Wr[e]:null;(i!==null?i.type!==0:r||!(2c||i[o]!==s[c]){var l=` +`+i[o].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=o&&0<=c);break}}}finally{sS=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Fh(t):""}function gq(t){switch(t.tag){case 5:return Fh(t.type);case 16:return Fh("Lazy");case 13:return Fh("Suspense");case 19:return Fh("SuspenseList");case 0:case 2:case 15:return t=oS(t.type,!1),t;case 11:return t=oS(t.type.render,!1),t;case 1:return t=oS(t.type,!0),t;default:return""}}function FC(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Zu:return"Fragment";case Ju:return"Portal";case DC:return"Profiler";case jj:return"StrictMode";case $C:return"Suspense";case LC:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case hL:return(t.displayName||"Context")+".Consumer";case fL:return(t._context.displayName||"Context")+".Provider";case Ej:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Nj:return e=t.displayName||null,e!==null?e:FC(t.type)||"Memo";case ic:e=t._payload,t=t._init;try{return FC(t(e))}catch{}}return null}function vq(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return FC(e);case 8:return e===jj?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Kc(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function mL(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function yq(t){var e=mL(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Gg(t){t._valueTracker||(t._valueTracker=yq(t))}function gL(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=mL(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function my(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function UC(t,e){var n=e.checked;return Yn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function vk(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Kc(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function vL(t,e){e=e.checked,e!=null&&Aj(t,"checked",e,!1)}function BC(t,e){vL(t,e);var n=Kc(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?HC(t,e.type,n):e.hasOwnProperty("defaultValue")&&HC(t,e.type,Kc(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function yk(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function HC(t,e,n){(e!=="number"||my(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Uh=Array.isArray;function md(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Kg.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ap(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Zh={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},xq=["Webkit","ms","Moz","O"];Object.keys(Zh).forEach(function(t){xq.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Zh[e]=Zh[t]})});function wL(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Zh.hasOwnProperty(t)&&Zh[t]?(""+e).trim():e+"px"}function SL(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=wL(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var bq=Yn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function GC(t,e){if(e){if(bq[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Ce(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Ce(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Ce(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Ce(62))}}function KC(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var WC=null;function Tj(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var qC=null,gd=null,vd=null;function wk(t){if(t=fg(t)){if(typeof qC!="function")throw Error(Ce(280));var e=t.stateNode;e&&(e=Xb(e),qC(t.stateNode,t.type,e))}}function CL(t){gd?vd?vd.push(t):vd=[t]:gd=t}function _L(){if(gd){var t=gd,e=vd;if(vd=gd=null,wk(t),e)for(t=0;t>>=0,t===0?32:31-(kq(t)/Oq|0)|0}var Wg=64,qg=4194304;function Bh(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function xy(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var c=o&~i;c!==0?r=Bh(c):(s&=o,s!==0&&(r=Bh(s)))}else o=n&~i,o!==0?r=Bh(o):s!==0&&(r=Bh(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function ug(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Xs(e),t[e]=n}function Dq(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=tp),Pk=" ",kk=!1;function VL(t,e){switch(t){case"keyup":return u7.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function GL(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ed=!1;function f7(t,e){switch(t){case"compositionend":return GL(e);case"keypress":return e.which!==32?null:(kk=!0,Pk);case"textInput":return t=e.data,t===Pk&&kk?null:t;default:return null}}function h7(t,e){if(ed)return t==="compositionend"||!$j&&VL(t,e)?(t=HL(),Bv=Rj=xc=null,ed=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Mk(n)}}function YL(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?YL(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function QL(){for(var t=window,e=my();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=my(t.document)}return e}function Lj(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function S7(t){var e=QL(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&YL(n.ownerDocument.documentElement,n)){if(r!==null&&Lj(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=Dk(n,s);var o=Dk(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,td=null,e_=null,rp=null,t_=!1;function $k(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;t_||td==null||td!==my(r)||(r=td,"selectionStart"in r&&Lj(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),rp&&kp(rp,r)||(rp=r,r=Sy(e_,"onSelect"),0id||(t.current=a_[id],a_[id]=null,id--)}function Pn(t,e){id++,a_[id]=t.current,t.current=e}var Wc={},oi=cl(Wc),Oi=cl(!1),su=Wc;function Vd(t,e){var n=t.type.contextTypes;if(!n)return Wc;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Ii(t){return t=t.childContextTypes,t!=null}function _y(){Fn(Oi),Fn(oi)}function Vk(t,e,n){if(oi.current!==Wc)throw Error(Ce(168));Pn(oi,e),Pn(Oi,n)}function sF(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(Ce(108,vq(t)||"Unknown",i));return Yn({},n,r)}function Ay(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Wc,su=oi.current,Pn(oi,t),Pn(Oi,Oi.current),!0}function Gk(t,e,n){var r=t.stateNode;if(!r)throw Error(Ce(169));n?(t=sF(t,e,su),r.__reactInternalMemoizedMergedChildContext=t,Fn(Oi),Fn(oi),Pn(oi,t)):Fn(Oi),Pn(Oi,n)}var pa=null,Jb=!1,bS=!1;function oF(t){pa===null?pa=[t]:pa.push(t)}function R7(t){Jb=!0,oF(t)}function ll(){if(!bS&&pa!==null){bS=!0;var t=0,e=xn;try{var n=pa;for(xn=1;t>=o,i-=o,va=1<<32-Xs(e)+i|n<j?(T=A,A=null):T=A.sibling;var k=h(b,A,w[j],S);if(k===null){A===null&&(A=T);break}t&&A&&k.alternate===null&&e(b,A),x=s(k,x,j),_===null?C=k:_.sibling=k,_=k,A=T}if(j===w.length)return n(b,A),zn&&_l(b,j),C;if(A===null){for(;jj?(T=A,A=null):T=A.sibling;var I=h(b,A,k.value,S);if(I===null){A===null&&(A=T);break}t&&A&&I.alternate===null&&e(b,A),x=s(I,x,j),_===null?C=I:_.sibling=I,_=I,A=T}if(k.done)return n(b,A),zn&&_l(b,j),C;if(A===null){for(;!k.done;j++,k=w.next())k=f(b,k.value,S),k!==null&&(x=s(k,x,j),_===null?C=k:_.sibling=k,_=k);return zn&&_l(b,j),C}for(A=r(b,A);!k.done;j++,k=w.next())k=p(A,b,j,k.value,S),k!==null&&(t&&k.alternate!==null&&A.delete(k.key===null?j:k.key),x=s(k,x,j),_===null?C=k:_.sibling=k,_=k);return t&&A.forEach(function(E){return e(b,E)}),zn&&_l(b,j),C}function v(b,x,w,S){if(typeof w=="object"&&w!==null&&w.type===Zu&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Vg:e:{for(var C=w.key,_=x;_!==null;){if(_.key===C){if(C=w.type,C===Zu){if(_.tag===7){n(b,_.sibling),x=i(_,w.props.children),x.return=b,b=x;break e}}else if(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===ic&&qk(C)===_.type){n(b,_.sibling),x=i(_,w.props),x.ref=xh(b,_,w),x.return=b,b=x;break e}n(b,_);break}else e(b,_);_=_.sibling}w.type===Zu?(x=Ql(w.props.children,b.mode,S,w.key),x.return=b,b=x):(S=Yv(w.type,w.key,w.props,null,b.mode,S),S.ref=xh(b,x,w),S.return=b,b=S)}return o(b);case Ju:e:{for(_=w.key;x!==null;){if(x.key===_)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(b,x.sibling),x=i(x,w.children||[]),x.return=b,b=x;break e}else{n(b,x);break}else e(b,x);x=x.sibling}x=NS(w,b.mode,S),x.return=b,b=x}return o(b);case ic:return _=w._init,v(b,x,_(w._payload),S)}if(Uh(w))return g(b,x,w,S);if(ph(w))return m(b,x,w,S);tv(b,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(b,x.sibling),x=i(x,w),x.return=b,b=x):(n(b,x),x=ES(w,b.mode,S),x.return=b,b=x),o(b)):n(b,x)}return v}var Kd=uF(!0),dF=uF(!1),Ny=cl(null),Ty=null,ad=null,Hj=null;function zj(){Hj=ad=Ty=null}function Vj(t){var e=Ny.current;Fn(Ny),t._currentValue=e}function u_(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function xd(t,e){Ty=t,Hj=ad=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Pi=!0),t.firstContext=null)}function Es(t){var e=t._currentValue;if(Hj!==t)if(t={context:t,memoizedValue:e,next:null},ad===null){if(Ty===null)throw Error(Ce(308));ad=t,Ty.dependencies={lanes:0,firstContext:t}}else ad=ad.next=t;return e}var Ol=null;function Gj(t){Ol===null?Ol=[t]:Ol.push(t)}function fF(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,Gj(e)):(n.next=i.next,i.next=n),e.interleaved=n,Oa(t,r)}function Oa(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var sc=!1;function Kj(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function hF(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Aa(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Tc(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,sn&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Oa(t,n)}return i=r.interleaved,i===null?(e.next=e,Gj(r)):(e.next=i.next,i.next=e),r.interleaved=e,Oa(t,n)}function zv(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,kj(t,n)}}function Yk(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Py(t,e,n,r){var i=t.updateQueue;sc=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,c=i.shared.pending;if(c!==null){i.shared.pending=null;var l=c,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var d=t.alternate;d!==null&&(d=d.updateQueue,c=d.lastBaseUpdate,c!==o&&(c===null?d.firstBaseUpdate=u:c.next=u,d.lastBaseUpdate=l))}if(s!==null){var f=i.baseState;o=0,d=u=l=null,c=s;do{var h=c.lane,p=c.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var g=t,m=c;switch(h=e,p=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=Yn({},f,h);break e;case 2:sc=!0}}c.callback!==null&&c.lane!==0&&(t.flags|=64,h=i.effects,h===null?i.effects=[c]:h.push(c))}else p={eventTime:p,lane:h,tag:c.tag,payload:c.payload,callback:c.callback,next:null},d===null?(u=d=p,l=f):d=d.next=p,o|=h;if(c=c.next,c===null){if(c=i.shared.pending,c===null)break;h=c,c=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(d===null&&(l=f),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=d,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);cu|=o,t.lanes=o,t.memoizedState=f}}function Qk(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=SS.transition;SS.transition={};try{t(!1),e()}finally{xn=n,SS.transition=r}}function PF(){return Ns().memoizedState}function L7(t,e,n){var r=kc(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},kF(t))OF(e,n);else if(n=fF(t,e,n,r),n!==null){var i=bi();Js(n,t,r,i),IF(n,e,r)}}function F7(t,e,n){var r=kc(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(kF(t))OF(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,c=s(o,n);if(i.hasEagerState=!0,i.eagerState=c,oo(c,o)){var l=e.interleaved;l===null?(i.next=i,Gj(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=fF(t,e,i,r),n!==null&&(i=bi(),Js(n,t,r,i),IF(n,e,r))}}function kF(t){var e=t.alternate;return t===qn||e!==null&&e===qn}function OF(t,e){ip=Oy=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function IF(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,kj(t,n)}}var Iy={readContext:Es,useCallback:Xr,useContext:Xr,useEffect:Xr,useImperativeHandle:Xr,useInsertionEffect:Xr,useLayoutEffect:Xr,useMemo:Xr,useReducer:Xr,useRef:Xr,useState:Xr,useDebugValue:Xr,useDeferredValue:Xr,useTransition:Xr,useMutableSource:Xr,useSyncExternalStore:Xr,useId:Xr,unstable_isNewReconciler:!1},U7={readContext:Es,useCallback:function(t,e){return _o().memoizedState=[t,e===void 0?null:e],t},useContext:Es,useEffect:Jk,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Gv(4194308,4,AF.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Gv(4194308,4,t,e)},useInsertionEffect:function(t,e){return Gv(4,2,t,e)},useMemo:function(t,e){var n=_o();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=_o();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=L7.bind(null,qn,t),[r.memoizedState,t]},useRef:function(t){var e=_o();return t={current:t},e.memoizedState=t},useState:Xk,useDebugValue:eE,useDeferredValue:function(t){return _o().memoizedState=t},useTransition:function(){var t=Xk(!1),e=t[0];return t=$7.bind(null,t[1]),_o().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=qn,i=_o();if(zn){if(n===void 0)throw Error(Ce(407));n=n()}else{if(n=e(),Lr===null)throw Error(Ce(349));au&30||vF(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,Jk(xF.bind(null,r,s,t),[t]),r.flags|=2048,Fp(9,yF.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=_o(),e=Lr.identifierPrefix;if(zn){var n=ya,r=va;n=(r&~(1<<32-Xs(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=$p++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[ko]=e,t[Rp]=r,zF(t,e,!1,!1),e.stateNode=t;e:{switch(o=KC(n,r),n){case"dialog":On("cancel",t),On("close",t),i=r;break;case"iframe":case"object":case"embed":On("load",t),i=r;break;case"video":case"audio":for(i=0;iYd&&(e.flags|=128,r=!0,bh(s,!1),e.lanes=4194304)}else{if(!r)if(t=ky(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),bh(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!zn)return Jr(e),null}else 2*sr()-s.renderingStartTime>Yd&&n!==1073741824&&(e.flags|=128,r=!0,bh(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=sr(),e.sibling=null,n=Wn.current,Pn(Wn,r?n&1|2:n&1),e):(Jr(e),null);case 22:case 23:return oE(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Wi&1073741824&&(Jr(e),e.subtreeFlags&6&&(e.flags|=8192)):Jr(e),null;case 24:return null;case 25:return null}throw Error(Ce(156,e.tag))}function q7(t,e){switch(Uj(e),e.tag){case 1:return Ii(e.type)&&_y(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Wd(),Fn(Oi),Fn(oi),Yj(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return qj(e),null;case 13:if(Fn(Wn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Ce(340));Gd()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Fn(Wn),null;case 4:return Wd(),null;case 10:return Vj(e.type._context),null;case 22:case 23:return oE(),null;case 24:return null;default:return null}}var rv=!1,ri=!1,Y7=typeof WeakSet=="function"?WeakSet:Set,Ye=null;function cd(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Zn(t,e,r)}else n.current=null}function x_(t,e,n){try{n()}catch(r){Zn(t,e,r)}}var lO=!1;function Q7(t,e){if(n_=by,t=QL(),Lj(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,c=-1,l=-1,u=0,d=0,f=t,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(c=o+i),f!==s||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===t)break t;if(h===n&&++u===i&&(c=o),h===s&&++d===r&&(l=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(r_={focusedElem:t,selectionRange:n},by=!1,Ye=e;Ye!==null;)if(e=Ye,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Ye=t;else for(;Ye!==null;){e=Ye;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,v=g.memoizedState,b=e.stateNode,x=b.getSnapshotBeforeUpdate(e.elementType===e.type?m:Fs(e.type,m),v);b.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ce(163))}}catch(S){Zn(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,Ye=t;break}Ye=e.return}return g=lO,lO=!1,g}function sp(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&x_(e,n,s)}i=i.next}while(i!==r)}}function t0(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function b_(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function KF(t){var e=t.alternate;e!==null&&(t.alternate=null,KF(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[ko],delete e[Rp],delete e[o_],delete e[O7],delete e[I7])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function WF(t){return t.tag===5||t.tag===3||t.tag===4}function uO(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||WF(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function w_(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Cy));else if(r!==4&&(t=t.child,t!==null))for(w_(t,e,n),t=t.sibling;t!==null;)w_(t,e,n),t=t.sibling}function S_(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(S_(t,e,n),t=t.sibling;t!==null;)S_(t,e,n),t=t.sibling}var zr=null,Hs=!1;function Xa(t,e,n){for(n=n.child;n!==null;)qF(t,e,n),n=n.sibling}function qF(t,e,n){if(Lo&&typeof Lo.onCommitFiberUnmount=="function")try{Lo.onCommitFiberUnmount(Wb,n)}catch{}switch(n.tag){case 5:ri||cd(n,e);case 6:var r=zr,i=Hs;zr=null,Xa(t,e,n),zr=r,Hs=i,zr!==null&&(Hs?(t=zr,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):zr.removeChild(n.stateNode));break;case 18:zr!==null&&(Hs?(t=zr,n=n.stateNode,t.nodeType===8?xS(t.parentNode,n):t.nodeType===1&&xS(t,n),Tp(t)):xS(zr,n.stateNode));break;case 4:r=zr,i=Hs,zr=n.stateNode.containerInfo,Hs=!0,Xa(t,e,n),zr=r,Hs=i;break;case 0:case 11:case 14:case 15:if(!ri&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&x_(n,e,o),i=i.next}while(i!==r)}Xa(t,e,n);break;case 1:if(!ri&&(cd(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(c){Zn(n,e,c)}Xa(t,e,n);break;case 21:Xa(t,e,n);break;case 22:n.mode&1?(ri=(r=ri)||n.memoizedState!==null,Xa(t,e,n),ri=r):Xa(t,e,n);break;default:Xa(t,e,n)}}function dO(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Y7),e.forEach(function(r){var i=s9.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Ms(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=sr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*J7(r/1960))-r,10t?16:t,bc===null)var r=!1;else{if(t=bc,bc=null,Dy=0,sn&6)throw Error(Ce(331));var i=sn;for(sn|=4,Ye=t.current;Ye!==null;){var s=Ye,o=s.child;if(Ye.flags&16){var c=s.deletions;if(c!==null){for(var l=0;lsr()-iE?Yl(t,0):rE|=n),Ri(t,e)}function n4(t,e){e===0&&(t.mode&1?(e=qg,qg<<=1,!(qg&130023424)&&(qg=4194304)):e=1);var n=bi();t=Oa(t,e),t!==null&&(ug(t,e,n),Ri(t,n))}function i9(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),n4(t,n)}function s9(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(Ce(314))}r!==null&&r.delete(e),n4(t,n)}var r4;r4=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Oi.current)Pi=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Pi=!1,K7(t,e,n);Pi=!!(t.flags&131072)}else Pi=!1,zn&&e.flags&1048576&&aF(e,Ey,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Kv(t,e),t=e.pendingProps;var i=Vd(e,oi.current);xd(e,n),i=Xj(null,e,r,t,i,n);var s=Jj();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Ii(r)?(s=!0,Ay(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Kj(e),i.updater=e0,e.stateNode=i,i._reactInternals=e,f_(e,r,t,n),e=m_(null,e,r,!0,s,n)):(e.tag=0,zn&&s&&Fj(e),fi(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Kv(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=a9(r),t=Fs(r,t),i){case 0:e=p_(null,e,r,t,n);break e;case 1:e=oO(null,e,r,t,n);break e;case 11:e=iO(null,e,r,t,n);break e;case 14:e=sO(null,e,r,Fs(r.type,t),n);break e}throw Error(Ce(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fs(r,i),p_(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fs(r,i),oO(t,e,r,i,n);case 3:e:{if(UF(e),t===null)throw Error(Ce(387));r=e.pendingProps,s=e.memoizedState,i=s.element,hF(t,e),Py(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=qd(Error(Ce(423)),e),e=aO(t,e,r,n,i);break e}else if(r!==i){i=qd(Error(Ce(424)),e),e=aO(t,e,r,n,i);break e}else for(Ji=Nc(e.stateNode.containerInfo.firstChild),Zi=e,zn=!0,Ks=null,n=dF(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Gd(),r===i){e=Ia(t,e,n);break e}fi(t,e,r,n)}e=e.child}return e;case 5:return pF(e),t===null&&l_(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,i_(r,i)?o=null:s!==null&&i_(r,s)&&(e.flags|=32),FF(t,e),fi(t,e,o,n),e.child;case 6:return t===null&&l_(e),null;case 13:return BF(t,e,n);case 4:return Wj(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Kd(e,null,r,n):fi(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fs(r,i),iO(t,e,r,i,n);case 7:return fi(t,e,e.pendingProps,n),e.child;case 8:return fi(t,e,e.pendingProps.children,n),e.child;case 12:return fi(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,Pn(Ny,r._currentValue),r._currentValue=o,s!==null)if(oo(s.value,o)){if(s.children===i.children&&!Oi.current){e=Ia(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var c=s.dependencies;if(c!==null){o=s.child;for(var l=c.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=Aa(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),u_(s.return,n,e),c.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Ce(341));o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),u_(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}fi(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,xd(e,n),i=Es(i),r=r(i),e.flags|=1,fi(t,e,r,n),e.child;case 14:return r=e.type,i=Fs(r,e.pendingProps),i=Fs(r.type,i),sO(t,e,r,i,n);case 15:return $F(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Fs(r,i),Kv(t,e),e.tag=1,Ii(r)?(t=!0,Ay(e)):t=!1,xd(e,n),RF(e,r,i),f_(e,r,i,n),m_(null,e,r,!0,t,n);case 19:return HF(t,e,n);case 22:return LF(t,e,n)}throw Error(Ce(156,e.tag))};function i4(t,e){return kL(t,e)}function o9(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ss(t,e,n,r){return new o9(t,e,n,r)}function cE(t){return t=t.prototype,!(!t||!t.isReactComponent)}function a9(t){if(typeof t=="function")return cE(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Ej)return 11;if(t===Nj)return 14}return 2}function Oc(t,e){var n=t.alternate;return n===null?(n=Ss(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Yv(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")cE(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Zu:return Ql(n.children,i,s,e);case jj:o=8,i|=8;break;case DC:return t=Ss(12,n,e,i|2),t.elementType=DC,t.lanes=s,t;case $C:return t=Ss(13,n,e,i),t.elementType=$C,t.lanes=s,t;case LC:return t=Ss(19,n,e,i),t.elementType=LC,t.lanes=s,t;case pL:return r0(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case fL:o=10;break e;case hL:o=9;break e;case Ej:o=11;break e;case Nj:o=14;break e;case ic:o=16,r=null;break e}throw Error(Ce(130,t==null?t:typeof t,""))}return e=Ss(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function Ql(t,e,n,r){return t=Ss(7,t,r,e),t.lanes=n,t}function r0(t,e,n,r){return t=Ss(22,t,r,e),t.elementType=pL,t.lanes=n,t.stateNode={isHidden:!1},t}function ES(t,e,n){return t=Ss(6,t,null,e),t.lanes=n,t}function NS(t,e,n){return e=Ss(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function c9(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=cS(0),this.expirationTimes=cS(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=cS(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function lE(t,e,n,r,i,s,o,c,l){return t=new c9(t,e,n,c,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Ss(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Kj(s),t}function l9(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(c4)}catch(t){console.error(t)}}c4(),cL.exports=ss;var Rf=cL.exports;const l4=dn(Rf);var u4,xO=Rf;u4=xO.createRoot,xO.hydrateRoot;var bO=["light","dark"],p9="(prefers-color-scheme: dark)",m9=y.createContext(void 0),g9={setTheme:t=>{},themes:[]},v9=()=>{var t;return(t=y.useContext(m9))!=null?t:g9};y.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:s,value:o,attrs:c,nonce:l})=>{let u=s==="system",d=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${c.map(g=>`'${g}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,f=i?bO.includes(s)&&s?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",h=(g,m=!1,v=!0)=>{let b=o?o[g]:g,x=m?g+"|| ''":`'${b}'`,w="";return i&&v&&!m&&bO.includes(g)&&(w+=`d.style.colorScheme = '${g}';`),n==="class"?m||b?w+=`c.add(${x})`:w+="null":b&&(w+=`d[s](n,${x})`),w},p=t?`!function(){${d}${h(t)}}()`:r?`!function(){try{${d}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${u})){var t='${p9}',m=window.matchMedia(t);if(m.media!==t||m.matches){${h("dark")}}else{${h("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${h(o?"x[e]":"e",!0)}}${u?"":"else{"+h(s,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${e}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${h(o?"x[e]":"e",!0)}}else{${h(s,!1,!1)};}${f}}catch(t){}}();`;return y.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:p}})});var y9=t=>{switch(t){case"success":return w9;case"info":return C9;case"warning":return S9;case"error":return _9;default:return null}},x9=Array(12).fill(0),b9=({visible:t})=>P.createElement("div",{className:"sonner-loading-wrapper","data-visible":t},P.createElement("div",{className:"sonner-spinner"},x9.map((e,n)=>P.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),w9=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},P.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),S9=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},P.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),C9=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},P.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),_9=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},P.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),A9=()=>{let[t,e]=P.useState(document.hidden);return P.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},E_=1,j9=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:n,...r}=t,i=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:E_++,s=this.toasts.find(c=>c.id===i),o=t.dismissible===void 0?!0:t.dismissible;return s?this.toasts=this.toasts.map(c=>c.id===i?(this.publish({...c,...t,id:i,title:n}),{...c,...t,id:i,dismissible:o,title:n}):c):this.addToast({title:n,...r,dismissible:o,id:i}),i},this.dismiss=t=>(t||this.toasts.forEach(e=>{this.subscribers.forEach(n=>n({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let n;e.loading!==void 0&&(n=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let r=t instanceof Promise?t:t(),i=n!==void 0;return r.then(async s=>{if(N9(s)&&!s.ok){i=!1;let o=typeof e.error=="function"?await e.error(`HTTP error! status: ${s.status}`):e.error,c=typeof e.description=="function"?await e.description(`HTTP error! status: ${s.status}`):e.description;this.create({id:n,type:"error",message:o,description:c})}else if(e.success!==void 0){i=!1;let o=typeof e.success=="function"?await e.success(s):e.success,c=typeof e.description=="function"?await e.description(s):e.description;this.create({id:n,type:"success",message:o,description:c})}}).catch(async s=>{if(e.error!==void 0){i=!1;let o=typeof e.error=="function"?await e.error(s):e.error,c=typeof e.description=="function"?await e.description(s):e.description;this.create({id:n,type:"error",message:o,description:c})}}).finally(()=>{var s;i&&(this.dismiss(n),n=void 0),(s=e.finally)==null||s.call(e)}),n},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||E_++;return this.create({jsx:t(n),id:n,...e}),n},this.subscribers=[],this.toasts=[]}},Ki=new j9,E9=(t,e)=>{let n=(e==null?void 0:e.id)||E_++;return Ki.addToast({title:t,...e,id:n}),n},N9=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",T9=E9,P9=()=>Ki.toasts,ne=Object.assign(T9,{success:Ki.success,info:Ki.info,warning:Ki.warning,error:Ki.error,custom:Ki.custom,message:Ki.message,promise:Ki.promise,dismiss:Ki.dismiss,loading:Ki.loading},{getHistory:P9});function k9(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}k9(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} +`);function ov(t){return t.label!==void 0}var O9=3,I9="32px",R9=4e3,M9=356,D9=14,$9=20,L9=200;function F9(...t){return t.filter(Boolean).join(" ")}var U9=t=>{var e,n,r,i,s,o,c,l,u,d;let{invert:f,toast:h,unstyled:p,interacting:g,setHeights:m,visibleToasts:v,heights:b,index:x,toasts:w,expanded:S,removeToast:C,defaultRichColors:_,closeButton:A,style:j,cancelButtonStyle:T,actionButtonStyle:k,className:I="",descriptionClassName:E="",duration:O,position:M,gap:U,loadingIcon:D,expandByDefault:B,classNames:R,icons:L,closeButtonAriaLabel:Y="Close toast",pauseWhenPageIsHidden:q,cn:J}=t,[me,F]=P.useState(!1),[oe,se]=P.useState(!1),[le,ke]=P.useState(!1),[ue,we]=P.useState(!1),[Ae,ee]=P.useState(0),[wt,et]=P.useState(0),Ct=P.useRef(null),Xe=P.useRef(null),nn=x===0,N=x+1<=v,$=h.type,z=h.dismissible!==!1,G=h.className||"",Q=h.descriptionClassName||"",H=P.useMemo(()=>b.findIndex(at=>at.toastId===h.id)||0,[b,h.id]),Z=P.useMemo(()=>{var at;return(at=h.closeButton)!=null?at:A},[h.closeButton,A]),he=P.useMemo(()=>h.duration||O||R9,[h.duration,O]),xe=P.useRef(0),Oe=P.useRef(0),be=P.useRef(0),We=P.useRef(null),[ot,Rt]=M.split("-"),Ke=P.useMemo(()=>b.reduce((at,Wt,st)=>st>=H?at:at+Wt.height,0),[b,H]),Ze=A9(),_t=h.invert||f,Kt=$==="loading";Oe.current=P.useMemo(()=>H*U+Ke,[H,Ke]),P.useEffect(()=>{F(!0)},[]),P.useLayoutEffect(()=>{if(!me)return;let at=Xe.current,Wt=at.style.height;at.style.height="auto";let st=at.getBoundingClientRect().height;at.style.height=Wt,et(st),m(Je=>Je.find(fn=>fn.toastId===h.id)?Je.map(fn=>fn.toastId===h.id?{...fn,height:st}:fn):[{toastId:h.id,height:st,position:h.position},...Je])},[me,h.title,h.description,m,h.id]);let Qn=P.useCallback(()=>{se(!0),ee(Oe.current),m(at=>at.filter(Wt=>Wt.toastId!==h.id)),setTimeout(()=>{C(h)},L9)},[h,C,m,Oe]);P.useEffect(()=>{if(h.promise&&$==="loading"||h.duration===1/0||h.type==="loading")return;let at,Wt=he;return S||g||q&&Ze?(()=>{if(be.current{var st;(st=h.onAutoClose)==null||st.call(h,h),Qn()},Wt)),()=>clearTimeout(at)},[S,g,B,h,he,Qn,h.promise,$,q,Ze]),P.useEffect(()=>{let at=Xe.current;if(at){let Wt=at.getBoundingClientRect().height;return et(Wt),m(st=>[{toastId:h.id,height:Wt,position:h.position},...st]),()=>m(st=>st.filter(Je=>Je.toastId!==h.id))}},[m,h.id]),P.useEffect(()=>{h.delete&&Qn()},[Qn,h.delete]);function Xt(){return L!=null&&L.loading?P.createElement("div",{className:"sonner-loader","data-visible":$==="loading"},L.loading):D?P.createElement("div",{className:"sonner-loader","data-visible":$==="loading"},D):P.createElement(b9,{visible:$==="loading"})}return P.createElement("li",{"aria-live":h.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:Xe,className:J(I,G,R==null?void 0:R.toast,(e=h==null?void 0:h.classNames)==null?void 0:e.toast,R==null?void 0:R.default,R==null?void 0:R[$],(n=h==null?void 0:h.classNames)==null?void 0:n[$]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:_,"data-styled":!(h.jsx||h.unstyled||p),"data-mounted":me,"data-promise":!!h.promise,"data-removed":oe,"data-visible":N,"data-y-position":ot,"data-x-position":Rt,"data-index":x,"data-front":nn,"data-swiping":le,"data-dismissible":z,"data-type":$,"data-invert":_t,"data-swipe-out":ue,"data-expanded":!!(S||B&&me),style:{"--index":x,"--toasts-before":x,"--z-index":w.length-x,"--offset":`${oe?Ae:Oe.current}px`,"--initial-height":B?"auto":`${wt}px`,...j,...h.style},onPointerDown:at=>{Kt||!z||(Ct.current=new Date,ee(Oe.current),at.target.setPointerCapture(at.pointerId),at.target.tagName!=="BUTTON"&&(ke(!0),We.current={x:at.clientX,y:at.clientY}))},onPointerUp:()=>{var at,Wt,st,Je;if(ue||!z)return;We.current=null;let fn=Number(((at=Xe.current)==null?void 0:at.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Is=new Date().getTime()-((Wt=Ct.current)==null?void 0:Wt.getTime()),ra=Math.abs(fn)/Is;if(Math.abs(fn)>=$9||ra>.11){ee(Oe.current),(st=h.onDismiss)==null||st.call(h,h),Qn(),we(!0);return}(Je=Xe.current)==null||Je.style.setProperty("--swipe-amount","0px"),ke(!1)},onPointerMove:at=>{var Wt;if(!We.current||!z)return;let st=at.clientY-We.current.y,Je=at.clientX-We.current.x,fn=(ot==="top"?Math.min:Math.max)(0,st),Is=at.pointerType==="touch"?10:2;Math.abs(fn)>Is?(Wt=Xe.current)==null||Wt.style.setProperty("--swipe-amount",`${st}px`):Math.abs(Je)>Is&&(We.current=null)}},Z&&!h.jsx?P.createElement("button",{"aria-label":Y,"data-disabled":Kt,"data-close-button":!0,onClick:Kt||!z?()=>{}:()=>{var at;Qn(),(at=h.onDismiss)==null||at.call(h,h)},className:J(R==null?void 0:R.closeButton,(i=h==null?void 0:h.classNames)==null?void 0:i.closeButton)},P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},P.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),P.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,h.jsx||P.isValidElement(h.title)?h.jsx||h.title:P.createElement(P.Fragment,null,$||h.icon||h.promise?P.createElement("div",{"data-icon":"",className:J(R==null?void 0:R.icon,(s=h==null?void 0:h.classNames)==null?void 0:s.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Xt():null,h.type!=="loading"?h.icon||(L==null?void 0:L[$])||y9($):null):null,P.createElement("div",{"data-content":"",className:J(R==null?void 0:R.content,(o=h==null?void 0:h.classNames)==null?void 0:o.content)},P.createElement("div",{"data-title":"",className:J(R==null?void 0:R.title,(c=h==null?void 0:h.classNames)==null?void 0:c.title)},h.title),h.description?P.createElement("div",{"data-description":"",className:J(E,Q,R==null?void 0:R.description,(l=h==null?void 0:h.classNames)==null?void 0:l.description)},h.description):null),P.isValidElement(h.cancel)?h.cancel:h.cancel&&ov(h.cancel)?P.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||T,onClick:at=>{var Wt,st;ov(h.cancel)&&z&&((st=(Wt=h.cancel).onClick)==null||st.call(Wt,at),Qn())},className:J(R==null?void 0:R.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,P.isValidElement(h.action)?h.action:h.action&&ov(h.action)?P.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||k,onClick:at=>{var Wt,st;ov(h.action)&&(at.defaultPrevented||((st=(Wt=h.action).onClick)==null||st.call(Wt,at),Qn()))},className:J(R==null?void 0:R.actionButton,(d=h==null?void 0:h.classNames)==null?void 0:d.actionButton)},h.action.label):null))};function wO(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}var B9=t=>{let{invert:e,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:i,closeButton:s,className:o,offset:c,theme:l="light",richColors:u,duration:d,style:f,visibleToasts:h=O9,toastOptions:p,dir:g=wO(),gap:m=D9,loadingIcon:v,icons:b,containerAriaLabel:x="Notifications",pauseWhenPageIsHidden:w,cn:S=F9}=t,[C,_]=P.useState([]),A=P.useMemo(()=>Array.from(new Set([n].concat(C.filter(q=>q.position).map(q=>q.position)))),[C,n]),[j,T]=P.useState([]),[k,I]=P.useState(!1),[E,O]=P.useState(!1),[M,U]=P.useState(l!=="system"?l:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),D=P.useRef(null),B=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),R=P.useRef(null),L=P.useRef(!1),Y=P.useCallback(q=>{var J;(J=C.find(me=>me.id===q.id))!=null&&J.delete||Ki.dismiss(q.id),_(me=>me.filter(({id:F})=>F!==q.id))},[C]);return P.useEffect(()=>Ki.subscribe(q=>{if(q.dismiss){_(J=>J.map(me=>me.id===q.id?{...me,delete:!0}:me));return}setTimeout(()=>{l4.flushSync(()=>{_(J=>{let me=J.findIndex(F=>F.id===q.id);return me!==-1?[...J.slice(0,me),{...J[me],...q},...J.slice(me+1)]:[q,...J]})})})}),[]),P.useEffect(()=>{if(l!=="system"){U(l);return}l==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?U("dark"):U("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:q})=>{U(q?"dark":"light")})},[l]),P.useEffect(()=>{C.length<=1&&I(!1)},[C]),P.useEffect(()=>{let q=J=>{var me,F;r.every(oe=>J[oe]||J.code===oe)&&(I(!0),(me=D.current)==null||me.focus()),J.code==="Escape"&&(document.activeElement===D.current||(F=D.current)!=null&&F.contains(document.activeElement))&&I(!1)};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[r]),P.useEffect(()=>{if(D.current)return()=>{R.current&&(R.current.focus({preventScroll:!0}),R.current=null,L.current=!1)}},[D.current]),C.length?P.createElement("section",{"aria-label":`${x} ${B}`,tabIndex:-1},A.map((q,J)=>{var me;let[F,oe]=q.split("-");return P.createElement("ol",{key:q,dir:g==="auto"?wO():g,tabIndex:-1,ref:D,className:o,"data-sonner-toaster":!0,"data-theme":M,"data-y-position":F,"data-x-position":oe,style:{"--front-toast-height":`${((me=j[0])==null?void 0:me.height)||0}px`,"--offset":typeof c=="number"?`${c}px`:c||I9,"--width":`${M9}px`,"--gap":`${m}px`,...f},onBlur:se=>{L.current&&!se.currentTarget.contains(se.relatedTarget)&&(L.current=!1,R.current&&(R.current.focus({preventScroll:!0}),R.current=null))},onFocus:se=>{se.target instanceof HTMLElement&&se.target.dataset.dismissible==="false"||L.current||(L.current=!0,R.current=se.relatedTarget)},onMouseEnter:()=>I(!0),onMouseMove:()=>I(!0),onMouseLeave:()=>{E||I(!1)},onPointerDown:se=>{se.target instanceof HTMLElement&&se.target.dataset.dismissible==="false"||O(!0)},onPointerUp:()=>O(!1)},C.filter(se=>!se.position&&J===0||se.position===q).map((se,le)=>{var ke,ue;return P.createElement(U9,{key:se.id,icons:b,index:le,toast:se,defaultRichColors:u,duration:(ke=p==null?void 0:p.duration)!=null?ke:d,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:e,visibleToasts:h,closeButton:(ue=p==null?void 0:p.closeButton)!=null?ue:s,interacting:E,position:q,style:p==null?void 0:p.style,unstyled:p==null?void 0:p.unstyled,classNames:p==null?void 0:p.classNames,cancelButtonStyle:p==null?void 0:p.cancelButtonStyle,actionButtonStyle:p==null?void 0:p.actionButtonStyle,removeToast:Y,toasts:C.filter(we=>we.position==se.position),heights:j.filter(we=>we.position==se.position),setHeights:T,expandByDefault:i,gap:m,loadingIcon:v,expanded:k,pauseWhenPageIsHidden:w,cn:S})}))})):null};const H9=({...t})=>{const{theme:e="system"}=v9();return a.jsx(B9,{theme:e,className:"toaster group",position:"bottom-right",visibleToasts:2,closeButton:!0,toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:pr-8",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",closeButton:"group-[.toast]:absolute group-[.toast]:left-3 group-[.toast]:top-3 group-[.toast]:h-5 group-[.toast]:w-5 group-[.toast]:rounded-md group-[.toast]:p-1 group-[.toast]:text-foreground/70 group-[.toast]:opacity-100 group-[.toast]:transition-opacity hover:group-[.toast]:text-foreground hover:group-[.toast]:bg-muted/50 focus:group-[.toast]:opacity-100 focus:group-[.toast]:outline-none focus:group-[.toast]:ring-1 focus:group-[.toast]:ring-ring"}},...t})};function Ne(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function z9(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function c0(...t){return e=>t.forEach(n=>z9(n,e))}function Pt(...t){return y.useCallback(c0(...t),t)}function V9(t,e){const n=y.createContext(e),r=s=>{const{children:o,...c}=s,l=y.useMemo(()=>c,Object.values(c));return a.jsx(n.Provider,{value:l,children:o})};r.displayName=t+"Provider";function i(s){const o=y.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[r,i]}function Ui(t,e=[]){let n=[];function r(s,o){const c=y.createContext(o),l=n.length;n=[...n,o];const u=f=>{var b;const{scope:h,children:p,...g}=f,m=((b=h==null?void 0:h[t])==null?void 0:b[l])||c,v=y.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})};u.displayName=s+"Provider";function d(f,h){var m;const p=((m=h==null?void 0:h[t])==null?void 0:m[l])||c,g=y.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(o=>y.createContext(o));return function(c){const l=(c==null?void 0:c[t])||s;return y.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,G9(i,...e)]}function G9(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(s)[`__scope${u}`];return{...c,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var Go=y.forwardRef((t,e)=>{const{children:n,...r}=t,i=y.Children.toArray(n),s=i.find(K9);if(s){const o=s.props.children,c=i.map(l=>l===s?y.Children.count(o)>1?y.Children.only(null):y.isValidElement(o)?o.props.children:null:l);return a.jsx(N_,{...r,ref:e,children:y.isValidElement(o)?y.cloneElement(o,void 0,c):null})}return a.jsx(N_,{...r,ref:e,children:n})});Go.displayName="Slot";var N_=y.forwardRef((t,e)=>{const{children:n,...r}=t;if(y.isValidElement(n)){const i=q9(n);return y.cloneElement(n,{...W9(r,n.props),ref:e?c0(e,i):i})}return y.Children.count(n)>1?y.Children.only(null):null});N_.displayName="SlotClone";var hE=({children:t})=>a.jsx(a.Fragment,{children:t});function K9(t){return y.isValidElement(t)&&t.type===hE}function W9(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...c)=>{s(...c),i(...c)}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function q9(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Y9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],it=Y9.reduce((t,e)=>{const n=y.forwardRef((r,i)=>{const{asChild:s,...o}=r,c=s?Go:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...o,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function d4(t,e){t&&Rf.flushSync(()=>t.dispatchEvent(e))}function Ar(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function Q9(t,e=globalThis==null?void 0:globalThis.document){const n=Ar(t);y.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var X9="DismissableLayer",T_="dismissableLayer.update",J9="dismissableLayer.pointerDownOutside",Z9="dismissableLayer.focusOutside",SO,f4=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),pg=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:c,...l}=t,u=y.useContext(f4),[d,f]=y.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=y.useState({}),g=Pt(e,A=>f(A)),m=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(v),x=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=x>=b,C=nY(A=>{const j=A.target,T=[...u.branches].some(k=>k.contains(j));!S||T||(i==null||i(A),o==null||o(A),A.defaultPrevented||c==null||c())},h),_=rY(A=>{const j=A.target;[...u.branches].some(k=>k.contains(j))||(s==null||s(A),o==null||o(A),A.defaultPrevented||c==null||c())},h);return Q9(A=>{x===u.layers.size-1&&(r==null||r(A),!A.defaultPrevented&&c&&(A.preventDefault(),c()))},h),y.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(SO=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),CO(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=SO)}},[d,h,n,u]),y.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),CO())},[d,u]),y.useEffect(()=>{const A=()=>p({});return document.addEventListener(T_,A),()=>document.removeEventListener(T_,A)},[]),a.jsx(it.div,{...l,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:Ne(t.onFocusCapture,_.onFocusCapture),onBlurCapture:Ne(t.onBlurCapture,_.onBlurCapture),onPointerDownCapture:Ne(t.onPointerDownCapture,C.onPointerDownCapture)})});pg.displayName=X9;var eY="DismissableLayerBranch",tY=y.forwardRef((t,e)=>{const n=y.useContext(f4),r=y.useRef(null),i=Pt(e,r);return y.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),a.jsx(it.div,{...t,ref:i})});tY.displayName=eY;function nY(t,e=globalThis==null?void 0:globalThis.document){const n=Ar(t),r=y.useRef(!1),i=y.useRef(()=>{});return y.useEffect(()=>{const s=c=>{if(c.target&&!r.current){let l=function(){h4(J9,n,u,{discrete:!0})};const u={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function rY(t,e=globalThis==null?void 0:globalThis.document){const n=Ar(t),r=y.useRef(!1);return y.useEffect(()=>{const i=s=>{s.target&&!r.current&&h4(Z9,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function CO(){const t=new CustomEvent(T_);document.dispatchEvent(t)}function h4(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?d4(i,s):i.dispatchEvent(s)}var qr=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},iY=oL.useId||(()=>{}),sY=0;function Zs(t){const[e,n]=y.useState(iY());return qr(()=>{n(r=>r??String(sY++))},[t]),e?`radix-${e}`:""}const oY=["top","right","bottom","left"],qc=Math.min,Qi=Math.max,Fy=Math.round,av=Math.floor,Yc=t=>({x:t,y:t}),aY={left:"right",right:"left",bottom:"top",top:"bottom"},cY={start:"end",end:"start"};function P_(t,e,n){return Qi(t,qc(e,n))}function Ra(t,e){return typeof t=="function"?t(e):t}function Ma(t){return t.split("-")[0]}function Mf(t){return t.split("-")[1]}function pE(t){return t==="x"?"y":"x"}function mE(t){return t==="y"?"height":"width"}function Qc(t){return["top","bottom"].includes(Ma(t))?"y":"x"}function gE(t){return pE(Qc(t))}function lY(t,e,n){n===void 0&&(n=!1);const r=Mf(t),i=gE(t),s=mE(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Uy(o)),[o,Uy(o)]}function uY(t){const e=Uy(t);return[k_(t),e,k_(e)]}function k_(t){return t.replace(/start|end/g,e=>cY[e])}function dY(t,e,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?s:o;default:return[]}}function fY(t,e,n,r){const i=Mf(t);let s=dY(Ma(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(k_)))),s}function Uy(t){return t.replace(/left|right|bottom|top/g,e=>aY[e])}function hY(t){return{top:0,right:0,bottom:0,left:0,...t}}function p4(t){return typeof t!="number"?hY(t):{top:t,right:t,bottom:t,left:t}}function By(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function _O(t,e,n){let{reference:r,floating:i}=t;const s=Qc(e),o=gE(e),c=mE(o),l=Ma(e),u=s==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[c]/2-i[c]/2;let p;switch(l){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Mf(e)){case"start":p[o]-=h*(n&&u?-1:1);break;case"end":p[o]+=h*(n&&u?-1:1);break}return p}const pY=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,c=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:f}=_O(u,r,l),h=r,p={},g=0;for(let m=0;m({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:o,elements:c,middlewareData:l}=e,{element:u,padding:d=0}=Ra(t,e)||{};if(u==null)return{};const f=p4(d),h={x:n,y:r},p=gE(i),g=mE(p),m=await o.getDimensions(u),v=p==="y",b=v?"top":"left",x=v?"bottom":"right",w=v?"clientHeight":"clientWidth",S=s.reference[g]+s.reference[p]-h[p]-s.floating[g],C=h[p]-s.reference[p],_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let A=_?_[w]:0;(!A||!await(o.isElement==null?void 0:o.isElement(_)))&&(A=c.floating[w]||s.floating[g]);const j=S/2-C/2,T=A/2-m[g]/2-1,k=qc(f[b],T),I=qc(f[x],T),E=k,O=A-m[g]-I,M=A/2-m[g]/2+j,U=P_(E,M,O),D=!l.arrow&&Mf(i)!=null&&M!==U&&s.reference[g]/2-(MM<=0)){var I,E;const M=(((I=s.flip)==null?void 0:I.index)||0)+1,U=A[M];if(U)return{data:{index:M,overflows:k},reset:{placement:U}};let D=(E=k.filter(B=>B.overflows[0]<=0).sort((B,R)=>B.overflows[1]-R.overflows[1])[0])==null?void 0:E.placement;if(!D)switch(p){case"bestFit":{var O;const B=(O=k.filter(R=>{if(_){const L=Qc(R.placement);return L===x||L==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(L=>L>0).reduce((L,Y)=>L+Y,0)]).sort((R,L)=>R[1]-L[1])[0])==null?void 0:O[0];B&&(D=B);break}case"initialPlacement":D=c;break}if(i!==D)return{reset:{placement:D}}}return{}}}};function AO(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function jO(t){return oY.some(e=>t[e]>=0)}const vY=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=Ra(t,e);switch(r){case"referenceHidden":{const s=await Bp(e,{...i,elementContext:"reference"}),o=AO(s,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:jO(o)}}}case"escaped":{const s=await Bp(e,{...i,altBoundary:!0}),o=AO(s,n.floating);return{data:{escapedOffsets:o,escaped:jO(o)}}}default:return{}}}}};async function yY(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ma(n),c=Mf(n),l=Qc(n)==="y",u=["left","top"].includes(o)?-1:1,d=s&&l?-1:1,f=Ra(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof g=="number"&&(p=c==="end"?g*-1:g),l?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const xY=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:c}=e,l=await yY(e,t);return o===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},bY=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:c={fn:v=>{let{x:b,y:x}=v;return{x:b,y:x}}},...l}=Ra(t,e),u={x:n,y:r},d=await Bp(e,l),f=Qc(Ma(i)),h=pE(f);let p=u[h],g=u[f];if(s){const v=h==="y"?"top":"left",b=h==="y"?"bottom":"right",x=p+d[v],w=p-d[b];p=P_(x,p,w)}if(o){const v=f==="y"?"top":"left",b=f==="y"?"bottom":"right",x=g+d[v],w=g-d[b];g=P_(x,g,w)}const m=c.fn({...e,[h]:p,[f]:g});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:s,[f]:o}}}}}},wY=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=Ra(t,e),d={x:n,y:r},f=Qc(i),h=pE(f);let p=d[h],g=d[f];const m=Ra(c,e),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const w=h==="y"?"height":"width",S=s.reference[h]-s.floating[w]+v.mainAxis,C=s.reference[h]+s.reference[w]-v.mainAxis;pC&&(p=C)}if(u){var b,x;const w=h==="y"?"width":"height",S=["top","left"].includes(Ma(i)),C=s.reference[f]-s.floating[w]+(S&&((b=o.offset)==null?void 0:b[f])||0)+(S?0:v.crossAxis),_=s.reference[f]+s.reference[w]+(S?0:((x=o.offset)==null?void 0:x[f])||0)-(S?v.crossAxis:0);g_&&(g=_)}return{[h]:p,[f]:g}}}},SY=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:o,elements:c}=e,{apply:l=()=>{},...u}=Ra(t,e),d=await Bp(e,u),f=Ma(i),h=Mf(i),p=Qc(i)==="y",{width:g,height:m}=s.floating;let v,b;f==="top"||f==="bottom"?(v=f,b=h===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(b=f,v=h==="end"?"top":"bottom");const x=m-d.top-d.bottom,w=g-d.left-d.right,S=qc(m-d[v],x),C=qc(g-d[b],w),_=!e.middlewareData.shift;let A=S,j=C;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(j=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(A=x),_&&!h){const k=Qi(d.left,0),I=Qi(d.right,0),E=Qi(d.top,0),O=Qi(d.bottom,0);p?j=g-2*(k!==0||I!==0?k+I:Qi(d.left,d.right)):A=m-2*(E!==0||O!==0?E+O:Qi(d.top,d.bottom))}await l({...e,availableWidth:j,availableHeight:A});const T=await o.getDimensions(c.floating);return g!==T.width||m!==T.height?{reset:{rects:!0}}:{}}}};function l0(){return typeof window<"u"}function Df(t){return m4(t)?(t.nodeName||"").toLowerCase():"#document"}function es(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Jo(t){var e;return(e=(m4(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function m4(t){return l0()?t instanceof Node||t instanceof es(t).Node:!1}function ao(t){return l0()?t instanceof Element||t instanceof es(t).Element:!1}function Ko(t){return l0()?t instanceof HTMLElement||t instanceof es(t).HTMLElement:!1}function EO(t){return!l0()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof es(t).ShadowRoot}function mg(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=co(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function CY(t){return["table","td","th"].includes(Df(t))}function u0(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function vE(t){const e=yE(),n=ao(t)?co(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function _Y(t){let e=Xc(t);for(;Ko(e)&&!Qd(e);){if(vE(e))return e;if(u0(e))return null;e=Xc(e)}return null}function yE(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Qd(t){return["html","body","#document"].includes(Df(t))}function co(t){return es(t).getComputedStyle(t)}function d0(t){return ao(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Xc(t){if(Df(t)==="html")return t;const e=t.assignedSlot||t.parentNode||EO(t)&&t.host||Jo(t);return EO(e)?e.host:e}function g4(t){const e=Xc(t);return Qd(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ko(e)&&mg(e)?e:g4(e)}function Hp(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=g4(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=es(i);if(s){const c=O_(o);return e.concat(o,o.visualViewport||[],mg(i)?i:[],c&&n?Hp(c):[])}return e.concat(i,Hp(i,[],n))}function O_(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function v4(t){const e=co(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Ko(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,c=Fy(n)!==s||Fy(r)!==o;return c&&(n=s,r=o),{width:n,height:r,$:c}}function xE(t){return ao(t)?t:t.contextElement}function wd(t){const e=xE(t);if(!Ko(e))return Yc(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=v4(e);let o=(s?Fy(n.width):n.width)/r,c=(s?Fy(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const AY=Yc(0);function y4(t){const e=es(t);return!yE()||!e.visualViewport?AY:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function jY(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==es(t)?!1:e}function uu(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=xE(t);let o=Yc(1);e&&(r?ao(r)&&(o=wd(r)):o=wd(t));const c=jY(s,n,r)?y4(s):Yc(0);let l=(i.left+c.x)/o.x,u=(i.top+c.y)/o.y,d=i.width/o.x,f=i.height/o.y;if(s){const h=es(s),p=r&&ao(r)?es(r):r;let g=h,m=O_(g);for(;m&&r&&p!==g;){const v=wd(m),b=m.getBoundingClientRect(),x=co(m),w=b.left+(m.clientLeft+parseFloat(x.paddingLeft))*v.x,S=b.top+(m.clientTop+parseFloat(x.paddingTop))*v.y;l*=v.x,u*=v.y,d*=v.x,f*=v.y,l+=w,u+=S,g=es(m),m=O_(g)}}return By({width:d,height:f,x:l,y:u})}function EY(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=Jo(r),c=e?u0(e.floating):!1;if(r===o||c&&s)return n;let l={scrollLeft:0,scrollTop:0},u=Yc(1);const d=Yc(0),f=Ko(r);if((f||!f&&!s)&&((Df(r)!=="body"||mg(o))&&(l=d0(r)),Ko(r))){const h=uu(r);u=wd(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x,y:n.y*u.y-l.scrollTop*u.y+d.y}}function NY(t){return Array.from(t.getClientRects())}function I_(t,e){const n=d0(t).scrollLeft;return e?e.left+n:uu(Jo(t)).left+n}function TY(t){const e=Jo(t),n=d0(t),r=t.ownerDocument.body,i=Qi(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Qi(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+I_(t);const c=-n.scrollTop;return co(r).direction==="rtl"&&(o+=Qi(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:c}}function PY(t,e){const n=es(t),r=Jo(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,c=0,l=0;if(i){s=i.width,o=i.height;const u=yE();(!u||u&&e==="fixed")&&(c=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:c,y:l}}function kY(t,e){const n=uu(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=Ko(t)?wd(t):Yc(1),o=t.clientWidth*s.x,c=t.clientHeight*s.y,l=i*s.x,u=r*s.y;return{width:o,height:c,x:l,y:u}}function NO(t,e,n){let r;if(e==="viewport")r=PY(t,n);else if(e==="document")r=TY(Jo(t));else if(ao(e))r=kY(e,n);else{const i=y4(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return By(r)}function x4(t,e){const n=Xc(t);return n===e||!ao(n)||Qd(n)?!1:co(n).position==="fixed"||x4(n,e)}function OY(t,e){const n=e.get(t);if(n)return n;let r=Hp(t,[],!1).filter(c=>ao(c)&&Df(c)!=="body"),i=null;const s=co(t).position==="fixed";let o=s?Xc(t):t;for(;ao(o)&&!Qd(o);){const c=co(o),l=vE(o);!l&&c.position==="fixed"&&(i=null),(s?!l&&!i:!l&&c.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||mg(o)&&!l&&x4(t,o))?r=r.filter(d=>d!==o):i=c,o=Xc(o)}return e.set(t,r),r}function IY(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?u0(e)?[]:OY(e,this._c):[].concat(n),r],c=o[0],l=o.reduce((u,d)=>{const f=NO(e,d,i);return u.top=Qi(f.top,u.top),u.right=qc(f.right,u.right),u.bottom=qc(f.bottom,u.bottom),u.left=Qi(f.left,u.left),u},NO(e,c,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function RY(t){const{width:e,height:n}=v4(t);return{width:e,height:n}}function MY(t,e,n){const r=Ko(e),i=Jo(e),s=n==="fixed",o=uu(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const l=Yc(0);if(r||!r&&!s)if((Df(e)!=="body"||mg(i))&&(c=d0(e)),r){const p=uu(e,!0,s,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else i&&(l.x=I_(i));let u=0,d=0;if(i&&!r&&!s){const p=i.getBoundingClientRect();d=p.top+c.scrollTop,u=p.left+c.scrollLeft-I_(i,p)}const f=o.left+c.scrollLeft-l.x-u,h=o.top+c.scrollTop-l.y-d;return{x:f,y:h,width:o.width,height:o.height}}function TS(t){return co(t).position==="static"}function TO(t,e){if(!Ko(t)||co(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Jo(t)===n&&(n=n.ownerDocument.body),n}function b4(t,e){const n=es(t);if(u0(t))return n;if(!Ko(t)){let i=Xc(t);for(;i&&!Qd(i);){if(ao(i)&&!TS(i))return i;i=Xc(i)}return n}let r=TO(t,e);for(;r&&CY(r)&&TS(r);)r=TO(r,e);return r&&Qd(r)&&TS(r)&&!vE(r)?n:r||_Y(t)||n}const DY=async function(t){const e=this.getOffsetParent||b4,n=this.getDimensions,r=await n(t.floating);return{reference:MY(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $Y(t){return co(t).direction==="rtl"}const LY={convertOffsetParentRelativeRectToViewportRelativeRect:EY,getDocumentElement:Jo,getClippingRect:IY,getOffsetParent:b4,getElementRects:DY,getClientRects:NY,getDimensions:RY,getScale:wd,isElement:ao,isRTL:$Y};function FY(t,e){let n=null,r;const i=Jo(t);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function o(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),s();const{left:u,top:d,width:f,height:h}=t.getBoundingClientRect();if(c||e(),!f||!h)return;const p=av(d),g=av(i.clientWidth-(u+f)),m=av(i.clientHeight-(d+h)),v=av(u),x={rootMargin:-p+"px "+-g+"px "+-m+"px "+-v+"px",threshold:Qi(0,qc(1,l))||1};let w=!0;function S(C){const _=C[0].intersectionRatio;if(_!==l){if(!w)return o();_?o(!1,_):r=setTimeout(()=>{o(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(S,{...x,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(t)}return o(!0),s}function UY(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=xE(t),d=i||s?[...u?Hp(u):[],...Hp(e)]:[];d.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const f=u&&c?FY(u,n):null;let h=-1,p=null;o&&(p=new ResizeObserver(b=>{let[x]=b;x&&x.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(e)})),n()}),u&&!l&&p.observe(u),p.observe(e));let g,m=l?uu(t):null;l&&v();function v(){const b=uu(t);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&n(),m=b,g=requestAnimationFrame(v)}return n(),()=>{var b;d.forEach(x=>{i&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),f==null||f(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const BY=xY,HY=bY,zY=gY,VY=SY,GY=vY,PO=mY,KY=wY,WY=(t,e,n)=>{const r=new Map,i={platform:LY,...n},s={...i.platform,_c:r};return pY(t,e,{...i,platform:s})};var Qv=typeof document<"u"?y.useLayoutEffect:y.useEffect;function Hy(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Hy(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!Hy(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function w4(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function kO(t,e){const n=w4(t);return Math.round(e*n)/n}function PS(t){const e=y.useRef(t);return Qv(()=>{e.current=t}),e}function qY(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:c=!0,whileElementsMounted:l,open:u}=t,[d,f]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,p]=y.useState(r);Hy(h,r)||p(r);const[g,m]=y.useState(null),[v,b]=y.useState(null),x=y.useCallback(R=>{R!==_.current&&(_.current=R,m(R))},[]),w=y.useCallback(R=>{R!==A.current&&(A.current=R,b(R))},[]),S=s||g,C=o||v,_=y.useRef(null),A=y.useRef(null),j=y.useRef(d),T=l!=null,k=PS(l),I=PS(i),E=PS(u),O=y.useCallback(()=>{if(!_.current||!A.current)return;const R={placement:e,strategy:n,middleware:h};I.current&&(R.platform=I.current),WY(_.current,A.current,R).then(L=>{const Y={...L,isPositioned:E.current!==!1};M.current&&!Hy(j.current,Y)&&(j.current=Y,Rf.flushSync(()=>{f(Y)}))})},[h,e,n,I,E]);Qv(()=>{u===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,f(R=>({...R,isPositioned:!1})))},[u]);const M=y.useRef(!1);Qv(()=>(M.current=!0,()=>{M.current=!1}),[]),Qv(()=>{if(S&&(_.current=S),C&&(A.current=C),S&&C){if(k.current)return k.current(S,C,O);O()}},[S,C,O,k,T]);const U=y.useMemo(()=>({reference:_,floating:A,setReference:x,setFloating:w}),[x,w]),D=y.useMemo(()=>({reference:S,floating:C}),[S,C]),B=y.useMemo(()=>{const R={position:n,left:0,top:0};if(!D.floating)return R;const L=kO(D.floating,d.x),Y=kO(D.floating,d.y);return c?{...R,transform:"translate("+L+"px, "+Y+"px)",...w4(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:Y}},[n,c,D.floating,d.x,d.y]);return y.useMemo(()=>({...d,update:O,refs:U,elements:D,floatingStyles:B}),[d,O,U,D,B])}const YY=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?PO({element:r.current,padding:i}).fn(n):{}:r?PO({element:r,padding:i}).fn(n):{}}}},QY=(t,e)=>({...BY(t),options:[t,e]}),XY=(t,e)=>({...HY(t),options:[t,e]}),JY=(t,e)=>({...KY(t),options:[t,e]}),ZY=(t,e)=>({...zY(t),options:[t,e]}),eQ=(t,e)=>({...VY(t),options:[t,e]}),tQ=(t,e)=>({...GY(t),options:[t,e]}),nQ=(t,e)=>({...YY(t),options:[t,e]});var rQ="Arrow",S4=y.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return a.jsx(it.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});S4.displayName=rQ;var iQ=S4;function sQ(t,e=[]){let n=[];function r(s,o){const c=y.createContext(o),l=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,v=y.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=y.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,d]}const i=()=>{const s=n.map(o=>y.createContext(o));return function(c){const l=(c==null?void 0:c[t])||s;return y.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,oQ(i,...e)]}function oQ(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(s)[`__scope${u}`];return{...c,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function gg(t){const[e,n]=y.useState(void 0);return qr(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,c;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;o=u.inlineSize,c=u.blockSize}else o=t.offsetWidth,c=t.offsetHeight;n({width:o,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var bE="Popper",[C4,$f]=sQ(bE),[aQ,_4]=C4(bE),A4=t=>{const{__scopePopper:e,children:n}=t,[r,i]=y.useState(null);return a.jsx(aQ,{scope:e,anchor:r,onAnchorChange:i,children:n})};A4.displayName=bE;var j4="PopperAnchor",E4=y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=_4(j4,n),o=y.useRef(null),c=Pt(e,o);return y.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:a.jsx(it.div,{...i,ref:c})});E4.displayName=j4;var wE="PopperContent",[cQ,lQ]=C4(wE),N4=y.forwardRef((t,e)=>{var le,ke,ue,we,Ae,ee;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...m}=t,v=_4(wE,n),[b,x]=y.useState(null),w=Pt(e,wt=>x(wt)),[S,C]=y.useState(null),_=gg(S),A=(_==null?void 0:_.width)??0,j=(_==null?void 0:_.height)??0,T=r+(s!=="center"?"-"+s:""),k=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},I=Array.isArray(u)?u:[u],E=I.length>0,O={padding:k,boundary:I.filter(dQ),altBoundary:E},{refs:M,floatingStyles:U,placement:D,isPositioned:B,middlewareData:R}=qY({strategy:"fixed",placement:T,whileElementsMounted:(...wt)=>UY(...wt,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[QY({mainAxis:i+j,alignmentAxis:o}),l&&XY({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?JY():void 0,...O}),l&&ZY({...O}),eQ({...O,apply:({elements:wt,rects:et,availableWidth:Ct,availableHeight:Xe})=>{const{width:nn,height:N}=et.reference,$=wt.floating.style;$.setProperty("--radix-popper-available-width",`${Ct}px`),$.setProperty("--radix-popper-available-height",`${Xe}px`),$.setProperty("--radix-popper-anchor-width",`${nn}px`),$.setProperty("--radix-popper-anchor-height",`${N}px`)}}),S&&nQ({element:S,padding:c}),fQ({arrowWidth:A,arrowHeight:j}),h&&tQ({strategy:"referenceHidden",...O})]}),[L,Y]=k4(D),q=Ar(g);qr(()=>{B&&(q==null||q())},[B,q]);const J=(le=R.arrow)==null?void 0:le.x,me=(ke=R.arrow)==null?void 0:ke.y,F=((ue=R.arrow)==null?void 0:ue.centerOffset)!==0,[oe,se]=y.useState();return qr(()=>{b&&se(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:B?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[(we=R.transformOrigin)==null?void 0:we.x,(Ae=R.transformOrigin)==null?void 0:Ae.y].join(" "),...((ee=R.hide)==null?void 0:ee.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:a.jsx(cQ,{scope:n,placedSide:L,onArrowChange:C,arrowX:J,arrowY:me,shouldHideArrow:F,children:a.jsx(it.div,{"data-side":L,"data-align":Y,...m,ref:w,style:{...m.style,animation:B?void 0:"none"}})})})});N4.displayName=wE;var T4="PopperArrow",uQ={top:"bottom",right:"left",bottom:"top",left:"right"},P4=y.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=lQ(T4,r),o=uQ[s.placedSide];return a.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:a.jsx(iQ,{...i,ref:n,style:{...i.style,display:"block"}})})});P4.displayName=T4;function dQ(t){return t!==null}var fQ=t=>({name:"transformOrigin",options:t,fn(e){var v,b,x;const{placement:n,rects:r,middlewareData:i}=e,o=((v=i.arrow)==null?void 0:v.centerOffset)!==0,c=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[u,d]=k4(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((b=i.arrow)==null?void 0:b.x)??0)+c/2,p=(((x=i.arrow)==null?void 0:x.y)??0)+l/2;let g="",m="";return u==="bottom"?(g=o?f:`${h}px`,m=`${-l}px`):u==="top"?(g=o?f:`${h}px`,m=`${r.floating.height+l}px`):u==="right"?(g=`${-l}px`,m=o?f:`${p}px`):u==="left"&&(g=`${r.floating.width+l}px`,m=o?f:`${p}px`),{data:{x:g,y:m}}}});function k4(t){const[e,n="center"]=t.split("-");return[e,n]}var O4=A4,SE=E4,CE=N4,_E=P4,hQ="Portal",f0=y.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[i,s]=y.useState(!1);qr(()=>s(!0),[]);const o=n||i&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?l4.createPortal(a.jsx(it.div,{...r,ref:e}),o):null});f0.displayName=hQ;function pQ(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var Yr=t=>{const{present:e,children:n}=t,r=mQ(e),i=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),s=Pt(r.ref,gQ(i));return typeof n=="function"||r.isPresent?y.cloneElement(i,{ref:s}):null};Yr.displayName="Presence";function mQ(t){const[e,n]=y.useState(),r=y.useRef({}),i=y.useRef(t),s=y.useRef("none"),o=t?"mounted":"unmounted",[c,l]=pQ(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const u=cv(r.current);s.current=c==="mounted"?u:"none"},[c]),qr(()=>{const u=r.current,d=i.current;if(d!==t){const h=s.current,p=cv(u);t?l("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),qr(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,f=p=>{const m=cv(r.current).includes(p.animationName);if(p.target===e&&m&&(l("ANIMATION_END"),!i.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},h=p=>{p.target===e&&(s.current=cv(r.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:y.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function cv(t){return(t==null?void 0:t.animationName)||"none"}function gQ(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function lo({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=vQ({defaultProp:e,onChange:n}),s=t!==void 0,o=s?t:r,c=Ar(n),l=y.useCallback(u=>{if(s){const f=typeof u=="function"?u(t):u;f!==t&&c(f)}else i(u)},[s,t,i,c]);return[o,l]}function vQ({defaultProp:t,onChange:e}){const n=y.useState(t),[r]=n,i=y.useRef(r),s=Ar(e);return y.useEffect(()=>{i.current!==r&&(s(r),i.current=r)},[r,i,s]),n}var yQ="VisuallyHidden",AE=y.forwardRef((t,e)=>a.jsx(it.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));AE.displayName=yQ;var xQ=AE,[h0,oFe]=Ui("Tooltip",[$f]),jE=$f(),I4="TooltipProvider",bQ=700,OO="tooltip.open",[wQ,R4]=h0(I4),M4=t=>{const{__scopeTooltip:e,delayDuration:n=bQ,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=t,[o,c]=y.useState(!0),l=y.useRef(!1),u=y.useRef(0);return y.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),a.jsx(wQ,{scope:e,isOpenDelayed:o,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(u.current),c(!1)},[]),onClose:y.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>c(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:y.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:s})};M4.displayName=I4;var D4="Tooltip",[aFe,p0]=h0(D4),R_="TooltipTrigger",SQ=y.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=p0(R_,n),s=R4(R_,n),o=jE(n),c=y.useRef(null),l=Pt(e,c,i.onTriggerChange),u=y.useRef(!1),d=y.useRef(!1),f=y.useCallback(()=>u.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(SE,{asChild:!0,...o,children:a.jsx(it.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Ne(t.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:Ne(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:Ne(t.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Ne(t.onFocus,()=>{u.current||i.onOpen()}),onBlur:Ne(t.onBlur,i.onClose),onClick:Ne(t.onClick,i.onClose)})})});SQ.displayName=R_;var CQ="TooltipPortal",[cFe,_Q]=h0(CQ,{forceMount:void 0}),Xd="TooltipContent",$4=y.forwardRef((t,e)=>{const n=_Q(Xd,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=t,o=p0(Xd,t.__scopeTooltip);return a.jsx(Yr,{present:r||o.open,children:o.disableHoverableContent?a.jsx(L4,{side:i,...s,ref:e}):a.jsx(AQ,{side:i,...s,ref:e})})}),AQ=y.forwardRef((t,e)=>{const n=p0(Xd,t.__scopeTooltip),r=R4(Xd,t.__scopeTooltip),i=y.useRef(null),s=Pt(e,i),[o,c]=y.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,h=y.useCallback(()=>{c(null),f(!1)},[f]),p=y.useCallback((g,m)=>{const v=g.currentTarget,b={x:g.clientX,y:g.clientY},x=TQ(b,v.getBoundingClientRect()),w=PQ(b,x),S=kQ(m.getBoundingClientRect()),C=IQ([...w,...S]);c(C),f(!0)},[f]);return y.useEffect(()=>()=>h(),[h]),y.useEffect(()=>{if(l&&d){const g=v=>p(v,d),m=v=>p(v,l);return l.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[l,d,p,h]),y.useEffect(()=>{if(o){const g=m=>{const v=m.target,b={x:m.clientX,y:m.clientY},x=(l==null?void 0:l.contains(v))||(d==null?void 0:d.contains(v)),w=!OQ(b,o);x?h():w&&(h(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[l,d,o,u,h]),a.jsx(L4,{...t,ref:s})}),[jQ,EQ]=h0(D4,{isInside:!1}),L4=y.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...c}=t,l=p0(Xd,n),u=jE(n),{onClose:d}=l;return y.useEffect(()=>(document.addEventListener(OO,d),()=>document.removeEventListener(OO,d)),[d]),y.useEffect(()=>{if(l.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(l.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,d]),a.jsx(pg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(CE,{"data-state":l.stateAttribute,...u,...c,ref:e,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(hE,{children:r}),a.jsx(jQ,{scope:n,isInside:!0,children:a.jsx(xQ,{id:l.contentId,role:"tooltip",children:i||r})})]})})});$4.displayName=Xd;var F4="TooltipArrow",NQ=y.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=jE(n);return EQ(F4,n).isInside?null:a.jsx(_E,{...i,...r,ref:e})});NQ.displayName=F4;function TQ(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function PQ(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function kQ(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function OQ(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;sr!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function IQ(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),RQ(e)}function RQ(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const s=e[e.length-1],o=e[e.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var MQ=M4,U4=$4;function B4(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=LQ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const c=o.split(EE);return c[0]===""&&c.length!==1&&c.shift(),H4(c,e)||$Q(o)},getConflictingClassGroupIds:(o,c)=>{const l=n[o]||[];return c&&r[o]?[...l,...r[o]]:l}}},H4=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?H4(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(EE);return(o=e.validators.find(({validator:c})=>c(s)))==null?void 0:o.classGroupId},IO=/^\[(.+)\]$/,$Q=t=>{if(IO.test(t)){const e=IO.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},LQ=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return UQ(Object.entries(t.classGroups),n).forEach(([s,o])=>{M_(o,r,s,e)}),r},M_=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:RO(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(FQ(i)){M_(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{M_(o,RO(e,s),n,r)})})},RO=(t,e)=>{let n=t;return e.split(EE).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},FQ=t=>t.isThemeGetter,UQ=(t,e)=>e?t.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,c])=>[e+o,c])):s);return[n,i]}):t,BQ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},z4="!",HQ=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,o=c=>{const l=[];let u=0,d=0,f;for(let v=0;vd?f-d:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}};return n?c=>n({className:c,parseClassName:o}):o},zQ=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},VQ=t=>({cache:BQ(t.cacheSize),parseClassName:HQ(t),...DQ(t)}),GQ=/\s+/,KQ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(GQ);let c="";for(let l=o.length-1;l>=0;l-=1){const u=o[l],{modifiers:d,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(u);let g=!!p,m=r(g?h.substring(0,p):h);if(!m){if(!g){c=u+(c.length>0?" "+c:c);continue}if(m=r(h),!m){c=u+(c.length>0?" "+c:c);continue}g=!1}const v=zQ(d).join(":"),b=f?v+z4:v,x=b+m;if(s.includes(x))continue;s.push(x);const w=i(m,g);for(let S=0;S0?" "+c:c)}return c};function WQ(){let t=0,e,n,r="";for(;t{if(typeof t=="string")return t;let e,n="";for(let r=0;rf(d),t());return n=VQ(u),r=n.cache.get,i=n.cache.set,s=c,c(l)}function c(l){const u=r(l);if(u)return u;const d=KQ(l,n);return i(l,d),d}return function(){return s(WQ.apply(null,arguments))}}const kn=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},G4=/^\[(?:([a-z-]+):)?(.+)\]$/i,YQ=/^\d+\/\d+$/,QQ=new Set(["px","full","screen"]),XQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,JQ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ZQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,eX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,tX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ia=t=>Sd(t)||QQ.has(t)||YQ.test(t),Ja=t=>Lf(t,"length",lX),Sd=t=>!!t&&!Number.isNaN(Number(t)),kS=t=>Lf(t,"number",Sd),Sh=t=>!!t&&Number.isInteger(Number(t)),nX=t=>t.endsWith("%")&&Sd(t.slice(0,-1)),Ft=t=>G4.test(t),Za=t=>XQ.test(t),rX=new Set(["length","size","percentage"]),iX=t=>Lf(t,rX,K4),sX=t=>Lf(t,"position",K4),oX=new Set(["image","url"]),aX=t=>Lf(t,oX,dX),cX=t=>Lf(t,"",uX),Ch=()=>!0,Lf=(t,e,n)=>{const r=G4.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},lX=t=>JQ.test(t)&&!ZQ.test(t),K4=()=>!1,uX=t=>eX.test(t),dX=t=>tX.test(t),fX=()=>{const t=kn("colors"),e=kn("spacing"),n=kn("blur"),r=kn("brightness"),i=kn("borderColor"),s=kn("borderRadius"),o=kn("borderSpacing"),c=kn("borderWidth"),l=kn("contrast"),u=kn("grayscale"),d=kn("hueRotate"),f=kn("invert"),h=kn("gap"),p=kn("gradientColorStops"),g=kn("gradientColorStopPositions"),m=kn("inset"),v=kn("margin"),b=kn("opacity"),x=kn("padding"),w=kn("saturate"),S=kn("scale"),C=kn("sepia"),_=kn("skew"),A=kn("space"),j=kn("translate"),T=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",Ft,e],E=()=>[Ft,e],O=()=>["",ia,Ja],M=()=>["auto",Sd,Ft],U=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],D=()=>["solid","dashed","dotted","double","none"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],R=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",Ft],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],q=()=>[Sd,Ft];return{cacheSize:500,separator:":",theme:{colors:[Ch],spacing:[ia,Ja],blur:["none","",Za,Ft],brightness:q(),borderColor:[t],borderRadius:["none","","full",Za,Ft],borderSpacing:E(),borderWidth:O(),contrast:q(),grayscale:L(),hueRotate:q(),invert:L(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[nX,Ja],inset:I(),margin:I(),opacity:q(),padding:E(),saturate:q(),scale:q(),sepia:L(),skew:q(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",Ft]}],container:["container"],columns:[{columns:[Za]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...U(),Ft]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Sh,Ft]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ft]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",Sh,Ft]}],"grid-cols":[{"grid-cols":[Ch]}],"col-start-end":[{col:["auto",{span:["full",Sh,Ft]},Ft]}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":[Ch]}],"row-start-end":[{row:["auto",{span:[Sh,Ft]},Ft]}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ft]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ft]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...R()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...R(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...R(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ft,e]}],"min-w":[{"min-w":[Ft,e,"min","max","fit"]}],"max-w":[{"max-w":[Ft,e,"none","full","min","max","fit","prose",{screen:[Za]},Za]}],h:[{h:[Ft,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ft,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ft,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ft,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Za,Ja]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",kS]}],"font-family":[{font:[Ch]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ft]}],"line-clamp":[{"line-clamp":["none",Sd,kS]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ia,Ft]}],"list-image":[{"list-image":["none",Ft]}],"list-style-type":[{list:["none","disc","decimal",Ft]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...D(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ia,Ja]}],"underline-offset":[{"underline-offset":["auto",ia,Ft]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ft]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ft]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...U(),sX]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",iX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},aX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...D(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:D()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...D()]}],"outline-offset":[{"outline-offset":[ia,Ft]}],"outline-w":[{outline:[ia,Ja]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:O()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[ia,Ja]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Za,cX]}],"shadow-color":[{shadow:[Ch]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...B(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":B()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Za,Ft]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ft]}],duration:[{duration:q()}],ease:[{ease:["linear","in","out","in-out",Ft]}],delay:[{delay:q()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ft]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[Sh,Ft]}],"translate-x":[{"translate-x":[j]}],"translate-y":[{"translate-y":[j]}],"skew-x":[{"skew-x":[_]}],"skew-y":[{"skew-y":[_]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ft]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ft]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ft]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[ia,Ja,kS]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},hX=qQ(fX);function Pe(...t){return hX(It(t))}const pX=MQ,mX=y.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(U4,{ref:r,sideOffset:e,className:Pe("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n}));mX.displayName=U4.displayName;var m0=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},g0=typeof window>"u"||"Deno"in globalThis;function Us(){}function gX(t,e){return typeof t=="function"?t(e):t}function vX(t){return typeof t=="number"&&t>=0&&t!==1/0}function yX(t,e){return Math.max(t+(e||0)-Date.now(),0)}function MO(t,e){return typeof t=="function"?t(e):t}function xX(t,e){return typeof t=="function"?t(e):t}function DO(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:c}=t;if(o){if(r){if(e.queryHash!==NE(o,e.options))return!1}else if(!Vp(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||i&&i!==e.state.fetchStatus||s&&!s(e))}function $O(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(zp(e.options.mutationKey)!==zp(s))return!1}else if(!Vp(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function NE(t,e){return((e==null?void 0:e.queryKeyHashFn)||zp)(t)}function zp(t){return JSON.stringify(t,(e,n)=>D_(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Vp(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(n=>!Vp(t[n],e[n])):!1}function W4(t,e){if(t===e)return t;const n=LO(t)&&LO(e);if(n||D_(t)&&D_(e)){const r=n?t:Object.keys(t),i=r.length,s=n?e:Object.keys(e),o=s.length,c=n?[]:{};let l=0;for(let u=0;u{setTimeout(e,t)})}function wX(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?W4(t,e):e}function SX(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function CX(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var TE=Symbol();function q4(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===TE?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Gl,pc,Rd,H$,_X=(H$=class extends m0{constructor(){super();pn(this,Gl);pn(this,pc);pn(this,Rd);zt(this,Rd,e=>{if(!g0&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ge(this,pc)||this.setEventListener(ge(this,Rd))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,pc))==null||e.call(this),zt(this,pc,void 0))}setEventListener(e){var n;zt(this,Rd,e),(n=ge(this,pc))==null||n.call(this),zt(this,pc,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ge(this,Gl)!==e&&(zt(this,Gl,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ge(this,Gl)=="boolean"?ge(this,Gl):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Gl=new WeakMap,pc=new WeakMap,Rd=new WeakMap,H$),Y4=new _X,Md,mc,Dd,z$,AX=(z$=class extends m0{constructor(){super();pn(this,Md,!0);pn(this,mc);pn(this,Dd);zt(this,Dd,e=>{if(!g0&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){ge(this,mc)||this.setEventListener(ge(this,Dd))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,mc))==null||e.call(this),zt(this,mc,void 0))}setEventListener(e){var n;zt(this,Dd,e),(n=ge(this,mc))==null||n.call(this),zt(this,mc,e(this.setOnline.bind(this)))}setOnline(e){ge(this,Md)!==e&&(zt(this,Md,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ge(this,Md)}},Md=new WeakMap,mc=new WeakMap,Dd=new WeakMap,z$),zy=new AX;function jX(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}function EX(t){return Math.min(1e3*2**t,3e4)}function Q4(t){return(t??"online")==="online"?zy.isOnline():!0}var X4=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function OS(t){return t instanceof X4}function J4(t){let e=!1,n=0,r=!1,i;const s=jX(),o=m=>{var v;r||(h(new X4(m)),(v=t.abort)==null||v.call(t))},c=()=>{e=!0},l=()=>{e=!1},u=()=>Y4.isFocused()&&(t.networkMode==="always"||zy.isOnline())&&t.canRun(),d=()=>Q4(t.networkMode)&&t.canRun(),f=m=>{var v;r||(r=!0,(v=t.onSuccess)==null||v.call(t,m),i==null||i(),s.resolve(m))},h=m=>{var v;r||(r=!0,(v=t.onError)==null||v.call(t,m),i==null||i(),s.reject(m))},p=()=>new Promise(m=>{var v;i=b=>{(r||u())&&m(b)},(v=t.onPause)==null||v.call(t)}).then(()=>{var m;i=void 0,r||(m=t.onContinue)==null||m.call(t)}),g=()=>{if(r)return;let m;const v=n===0?t.initialPromise:void 0;try{m=v??t.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(f).catch(b=>{var _;if(r)return;const x=t.retry??(g0?0:3),w=t.retryDelay??EX,S=typeof w=="function"?w(n,b):w,C=x===!0||typeof x=="number"&&nu()?void 0:p()).then(()=>{e?h(b):g()})})};return{promise:s,cancel:o,continue:()=>(i==null||i(),s),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?g():p().then(g),s)}}function NX(){let t=[],e=0,n=c=>{c()},r=c=>{c()},i=c=>setTimeout(c,0);const s=c=>{e?t.push(c):i(()=>{n(c)})},o=()=>{const c=t;t=[],c.length&&i(()=>{r(()=>{c.forEach(l=>{n(l)})})})};return{batch:c=>{let l;e++;try{l=c()}finally{e--,e||o()}return l},batchCalls:c=>(...l)=>{s(()=>{c(...l)})},schedule:s,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{i=c}}}var mi=NX(),Kl,V$,Z4=(V$=class{constructor(){pn(this,Kl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),vX(this.gcTime)&&zt(this,Kl,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(g0?1/0:5*60*1e3))}clearGcTimeout(){ge(this,Kl)&&(clearTimeout(ge(this,Kl)),zt(this,Kl,void 0))}},Kl=new WeakMap,V$),$d,Ld,ds,Zr,ag,Wl,Bs,ca,G$,TX=(G$=class extends Z4{constructor(e){super();pn(this,Bs);pn(this,$d);pn(this,Ld);pn(this,ds);pn(this,Zr);pn(this,ag);pn(this,Wl);zt(this,Wl,!1),zt(this,ag,e.defaultOptions),this.setOptions(e.options),this.observers=[],zt(this,ds,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,zt(this,$d,kX(this.options)),this.state=e.state??ge(this,$d),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=ge(this,Zr))==null?void 0:e.promise}setOptions(e){this.options={...ge(this,ag),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ge(this,ds).remove(this)}setData(e,n){const r=wX(this.state.data,e,this.options);return Qr(this,Bs,ca).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){Qr(this,Bs,ca).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=ge(this,Zr))==null?void 0:r.promise;return(i=ge(this,Zr))==null||i.cancel(e),n?n.then(Us).catch(Us):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ge(this,$d))}isActive(){return this.observers.some(e=>xX(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===TE||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!yX(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=ge(this,Zr))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=ge(this,Zr))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ge(this,ds).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(ge(this,Zr)&&(ge(this,Wl)?ge(this,Zr).cancel({revert:!0}):ge(this,Zr).cancelRetry()),this.scheduleGc()),ge(this,ds).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Qr(this,Bs,ca).call(this,{type:"invalidate"})}fetch(e,n){var l,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ge(this,Zr))return ge(this,Zr).continueRetry(),ge(this,Zr).promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(h=>h.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,i=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(zt(this,Wl,!0),r.signal)})},s=()=>{const f=q4(this.options,n),h={queryKey:this.queryKey,meta:this.meta};return i(h),zt(this,Wl,!1),this.options.persister?this.options.persister(f,h,this):f(h)},o={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:s};i(o),(l=this.options.behavior)==null||l.onFetch(o,this),zt(this,Ld,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&Qr(this,Bs,ca).call(this,{type:"fetch",meta:(d=o.fetchOptions)==null?void 0:d.meta});const c=f=>{var h,p,g,m;OS(f)&&f.silent||Qr(this,Bs,ca).call(this,{type:"error",error:f}),OS(f)||((p=(h=ge(this,ds).config).onError)==null||p.call(h,f,this),(m=(g=ge(this,ds).config).onSettled)==null||m.call(g,this.state.data,f,this)),this.scheduleGc()};return zt(this,Zr,J4({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var h,p,g,m;if(f===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(v){c(v);return}(p=(h=ge(this,ds).config).onSuccess)==null||p.call(h,f,this),(m=(g=ge(this,ds).config).onSettled)==null||m.call(g,f,this.state.error,this),this.scheduleGc()},onError:c,onFail:(f,h)=>{Qr(this,Bs,ca).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{Qr(this,Bs,ca).call(this,{type:"pause"})},onContinue:()=>{Qr(this,Bs,ca).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),ge(this,Zr).start()}},$d=new WeakMap,Ld=new WeakMap,ds=new WeakMap,Zr=new WeakMap,ag=new WeakMap,Wl=new WeakMap,Bs=new WeakSet,ca=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...PX(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return OS(i)&&i.revert&&ge(this,Ld)?{...ge(this,Ld),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),mi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ge(this,ds).notify({query:this,type:"updated",action:e})})},G$);function PX(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Q4(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function kX(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var jo,K$,OX=(K$=class extends m0{constructor(e={}){super();pn(this,jo);this.config=e,zt(this,jo,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??NE(i,n);let o=this.get(s);return o||(o=new TX({cache:this,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){ge(this,jo).has(e.queryHash)||(ge(this,jo).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=ge(this,jo).get(e.queryHash);n&&(e.destroy(),n===e&&ge(this,jo).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){mi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ge(this,jo).get(e)}getAll(){return[...ge(this,jo).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>DO(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>DO(e,r)):n}notify(e){mi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){mi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){mi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},jo=new WeakMap,K$),Eo,li,ql,No,ec,W$,IX=(W$=class extends Z4{constructor(e){super();pn(this,No);pn(this,Eo);pn(this,li);pn(this,ql);this.mutationId=e.mutationId,zt(this,li,e.mutationCache),zt(this,Eo,[]),this.state=e.state||RX(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){ge(this,Eo).includes(e)||(ge(this,Eo).push(e),this.clearGcTimeout(),ge(this,li).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){zt(this,Eo,ge(this,Eo).filter(n=>n!==e)),this.scheduleGc(),ge(this,li).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ge(this,Eo).length||(this.state.status==="pending"?this.scheduleGc():ge(this,li).remove(this))}continue(){var e;return((e=ge(this,ql))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,s,o,c,l,u,d,f,h,p,g,m,v,b,x,w,S,C,_,A;zt(this,ql,J4({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(j,T)=>{Qr(this,No,ec).call(this,{type:"failed",failureCount:j,error:T})},onPause:()=>{Qr(this,No,ec).call(this,{type:"pause"})},onContinue:()=>{Qr(this,No,ec).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ge(this,li).canRun(this)}));const n=this.state.status==="pending",r=!ge(this,ql).canStart();try{if(!n){Qr(this,No,ec).call(this,{type:"pending",variables:e,isPaused:r}),await((s=(i=ge(this,li).config).onMutate)==null?void 0:s.call(i,e,this));const T=await((c=(o=this.options).onMutate)==null?void 0:c.call(o,e));T!==this.state.context&&Qr(this,No,ec).call(this,{type:"pending",context:T,variables:e,isPaused:r})}const j=await ge(this,ql).start();return await((u=(l=ge(this,li).config).onSuccess)==null?void 0:u.call(l,j,e,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,j,e,this.state.context)),await((p=(h=ge(this,li).config).onSettled)==null?void 0:p.call(h,j,null,this.state.variables,this.state.context,this)),await((m=(g=this.options).onSettled)==null?void 0:m.call(g,j,null,e,this.state.context)),Qr(this,No,ec).call(this,{type:"success",data:j}),j}catch(j){try{throw await((b=(v=ge(this,li).config).onError)==null?void 0:b.call(v,j,e,this.state.context,this)),await((w=(x=this.options).onError)==null?void 0:w.call(x,j,e,this.state.context)),await((C=(S=ge(this,li).config).onSettled)==null?void 0:C.call(S,void 0,j,this.state.variables,this.state.context,this)),await((A=(_=this.options).onSettled)==null?void 0:A.call(_,void 0,j,e,this.state.context)),j}finally{Qr(this,No,ec).call(this,{type:"error",error:j})}}finally{ge(this,li).runNext(this)}}},Eo=new WeakMap,li=new WeakMap,ql=new WeakMap,No=new WeakSet,ec=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),mi.batch(()=>{ge(this,Eo).forEach(r=>{r.onMutationUpdate(e)}),ge(this,li).notify({mutation:this,type:"updated",action:e})})},W$);function RX(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Gi,cg,q$,MX=(q$=class extends m0{constructor(e={}){super();pn(this,Gi);pn(this,cg);this.config=e,zt(this,Gi,new Map),zt(this,cg,Date.now())}build(e,n,r){const i=new IX({mutationCache:this,mutationId:++Bg(this,cg)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){const n=lv(e),r=ge(this,Gi).get(n)??[];r.push(e),ge(this,Gi).set(n,r),this.notify({type:"added",mutation:e})}remove(e){var r;const n=lv(e);if(ge(this,Gi).has(n)){const i=(r=ge(this,Gi).get(n))==null?void 0:r.filter(s=>s!==e);i&&(i.length===0?ge(this,Gi).delete(n):ge(this,Gi).set(n,i))}this.notify({type:"removed",mutation:e})}canRun(e){var r;const n=(r=ge(this,Gi).get(lv(e)))==null?void 0:r.find(i=>i.state.status==="pending");return!n||n===e}runNext(e){var r;const n=(r=ge(this,Gi).get(lv(e)))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){mi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}getAll(){return[...ge(this,Gi).values()].flat()}find(e){const n={exact:!0,...e};return this.getAll().find(r=>$O(n,r))}findAll(e={}){return this.getAll().filter(n=>$O(e,n))}notify(e){mi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return mi.batch(()=>Promise.all(e.map(n=>n.continue().catch(Us))))}},Gi=new WeakMap,cg=new WeakMap,q$);function lv(t){var e;return((e=t.options.scope)==null?void 0:e.id)??String(t.mutationId)}function UO(t){return{onFetch:(e,n)=>{var d,f,h,p,g;const r=e.options,i=(h=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,s=((p=e.state.data)==null?void 0:p.pages)||[],o=((g=e.state.data)==null?void 0:g.pageParams)||[];let c={pages:[],pageParams:[]},l=0;const u=async()=>{let m=!1;const v=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(e.signal.aborted?m=!0:e.signal.addEventListener("abort",()=>{m=!0}),e.signal)})},b=q4(e.options,e.fetchOptions),x=async(w,S,C)=>{if(m)return Promise.reject();if(S==null&&w.pages.length)return Promise.resolve(w);const _={queryKey:e.queryKey,pageParam:S,direction:C?"backward":"forward",meta:e.options.meta};v(_);const A=await b(_),{maxPages:j}=e.options,T=C?CX:SX;return{pages:T(w.pages,A,j),pageParams:T(w.pageParams,S,j)}};if(i&&s.length){const w=i==="backward",S=w?DX:BO,C={pages:s,pageParams:o},_=S(r,C);c=await x(C,_,w)}else{const w=t??s.length;do{const S=l===0?o[0]??r.initialPageParam:BO(r,c);if(l>0&&S==null)break;c=await x(c,S),l++}while(l{var m,v;return(v=(m=e.options).persister)==null?void 0:v.call(m,u,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=u}}}function BO(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function DX(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var Jn,gc,vc,Fd,Ud,yc,Bd,Hd,Y$,$X=(Y$=class{constructor(t={}){pn(this,Jn);pn(this,gc);pn(this,vc);pn(this,Fd);pn(this,Ud);pn(this,yc);pn(this,Bd);pn(this,Hd);zt(this,Jn,t.queryCache||new OX),zt(this,gc,t.mutationCache||new MX),zt(this,vc,t.defaultOptions||{}),zt(this,Fd,new Map),zt(this,Ud,new Map),zt(this,yc,0)}mount(){Bg(this,yc)._++,ge(this,yc)===1&&(zt(this,Bd,Y4.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Jn).onFocus())})),zt(this,Hd,zy.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Jn).onOnline())})))}unmount(){var t,e;Bg(this,yc)._--,ge(this,yc)===0&&((t=ge(this,Bd))==null||t.call(this),zt(this,Bd,void 0),(e=ge(this,Hd))==null||e.call(this),zt(this,Hd,void 0))}isFetching(t){return ge(this,Jn).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ge(this,gc).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ge(this,Jn).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);if(e===void 0)return this.fetchQuery(t);{const n=this.defaultQueryOptions(t),r=ge(this,Jn).build(this,n);return t.revalidateIfStale&&r.isStaleByTime(MO(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(e)}}getQueriesData(t){return ge(this,Jn).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=ge(this,Jn).get(r.queryHash),s=i==null?void 0:i.state.data,o=gX(e,s);if(o!==void 0)return ge(this,Jn).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return mi.batch(()=>ge(this,Jn).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ge(this,Jn).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ge(this,Jn);mi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ge(this,Jn),r={type:"active",...t};return mi.batch(()=>(n.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries(r,e)))}cancelQueries(t={},e={}){const n={revert:!0,...e},r=mi.batch(()=>ge(this,Jn).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Us).catch(Us)}invalidateQueries(t={},e={}){return mi.batch(()=>{if(ge(this,Jn).findAll(t).forEach(r=>{r.invalidate()}),t.refetchType==="none")return Promise.resolve();const n={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(n,e)})}refetchQueries(t={},e){const n={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},r=mi.batch(()=>ge(this,Jn).findAll(t).filter(i=>!i.isDisabled()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Us)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Us)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=ge(this,Jn).build(this,e);return n.isStaleByTime(MO(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Us).catch(Us)}fetchInfiniteQuery(t){return t.behavior=UO(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Us).catch(Us)}ensureInfiniteQueryData(t){return t.behavior=UO(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return zy.isOnline()?ge(this,gc).resumePausedMutations():Promise.resolve()}getQueryCache(){return ge(this,Jn)}getMutationCache(){return ge(this,gc)}getDefaultOptions(){return ge(this,vc)}setDefaultOptions(t){zt(this,vc,t)}setQueryDefaults(t,e){ge(this,Fd).set(zp(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ge(this,Fd).values()];let n={};return e.forEach(r=>{Vp(t,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(t,e){ge(this,Ud).set(zp(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ge(this,Ud).values()];let n={};return e.forEach(r=>{Vp(t,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ge(this,vc).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=NE(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.enabled!==!0&&e.queryFn===TE&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ge(this,vc).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ge(this,Jn).clear(),ge(this,gc).clear()}},Jn=new WeakMap,gc=new WeakMap,vc=new WeakMap,Fd=new WeakMap,Ud=new WeakMap,yc=new WeakMap,Bd=new WeakMap,Hd=new WeakMap,Y$),LX=y.createContext(void 0),FX=({client:t,children:e})=>(y.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),a.jsx(LX.Provider,{value:t,children:e}));/** + * @remix-run/router v1.20.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Gp(){return Gp=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function e5(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function BX(){return Math.random().toString(36).substr(2,8)}function zO(t,e){return{usr:t.state,key:t.key,idx:e}}function $_(t,e,n,r){return n===void 0&&(n=null),Gp({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Ff(e):e,{state:n,key:e&&e.key||r||BX()})}function Vy(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Ff(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function HX(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,c=wc.Pop,l=null,u=d();u==null&&(u=0,o.replaceState(Gp({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){c=wc.Pop;let v=d(),b=v==null?null:v-u;u=v,l&&l({action:c,location:m.location,delta:b})}function h(v,b){c=wc.Push;let x=$_(m.location,v,b);u=d()+1;let w=zO(x,u),S=m.createHref(x);try{o.pushState(w,"",S)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;i.location.assign(S)}s&&l&&l({action:c,location:m.location,delta:1})}function p(v,b){c=wc.Replace;let x=$_(m.location,v,b);u=d();let w=zO(x,u),S=m.createHref(x);o.replaceState(w,"",S),s&&l&&l({action:c,location:m.location,delta:0})}function g(v){let b=i.location.origin!=="null"?i.location.origin:i.location.href,x=typeof v=="string"?v:Vy(v);return x=x.replace(/ $/,"%20"),ar(b,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,b)}let m={get action(){return c},get location(){return t(i,o)},listen(v){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(HO,f),l=v,()=>{i.removeEventListener(HO,f),l=null}},createHref(v){return e(i,v)},createURL:g,encodeLocation(v){let b=g(v);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:h,replace:p,go(v){return o.go(v)}};return m}var VO;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(VO||(VO={}));function zX(t,e,n){return n===void 0&&(n="/"),VX(t,e,n,!1)}function VX(t,e,n,r){let i=typeof e=="string"?Ff(e):e,s=PE(i.pathname||"/",n);if(s==null)return null;let o=t5(t);GX(o);let c=null;for(let l=0;c==null&&l{let l={relativePath:c===void 0?s.path||"":c,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(ar(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Ic([r,l.relativePath]),d=n.concat(l);s.children&&s.children.length>0&&(ar(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),t5(s.children,e,d,u)),!(s.path==null&&!s.index)&&e.push({path:u,score:JX(u,s.index),routesMeta:d})};return t.forEach((s,o)=>{var c;if(s.path===""||!((c=s.path)!=null&&c.includes("?")))i(s,o);else for(let l of n5(s.path))i(s,o,l)}),e}function n5(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=n5(r.join("/")),c=[];return c.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&c.push(...o),c.map(l=>t.startsWith("/")&&l===""?"/":l)}function GX(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:ZX(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const KX=/^:[\w-]+$/,WX=3,qX=2,YX=1,QX=10,XX=-2,GO=t=>t==="*";function JX(t,e){let n=t.split("/"),r=n.length;return n.some(GO)&&(r+=XX),e&&(r+=qX),n.filter(i=>!GO(i)).reduce((i,s)=>i+(KX.test(s)?WX:s===""?YX:QX),r)}function ZX(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function eJ(t,e,n){let{routesMeta:r}=t,i={},s="/",o=[];for(let c=0;c{let{paramName:h,isOptional:p}=d;if(h==="*"){let m=c[f]||"";o=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const g=c[f];return p&&!g?u[h]=void 0:u[h]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:t}}function tJ(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),e5(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,l)=>(r.push({paramName:c,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function nJ(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return e5(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function PE(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function rJ(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Ff(t):t;return{pathname:n?n.startsWith("/")?n:iJ(n,e):e,search:aJ(r),hash:cJ(i)}}function iJ(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function IS(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function sJ(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function kE(t,e){let n=sJ(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function OE(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=Ff(t):(i=Gp({},t),ar(!i.pathname||!i.pathname.includes("?"),IS("?","pathname","search",i)),ar(!i.pathname||!i.pathname.includes("#"),IS("#","pathname","hash",i)),ar(!i.search||!i.search.includes("#"),IS("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,c;if(o==null)c=n;else{let f=e.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),f-=1;i.pathname=h.join("/")}c=f>=0?e[f]:"/"}let l=rJ(i,c),u=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}const Ic=t=>t.join("/").replace(/\/\/+/g,"/"),oJ=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),aJ=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,cJ=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function lJ(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const r5=["post","put","patch","delete"];new Set(r5);const uJ=["get",...r5];new Set(uJ);/** + * React Router v6.27.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Kp(){return Kp=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),y.useCallback(function(u,d){if(d===void 0&&(d={}),!c.current)return;if(typeof u=="number"){r.go(u);return}let f=OE(u,JSON.parse(o),s,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:Ic([e,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[e,r,o,s,t])}function RE(){let{matches:t}=y.useContext(Ga),e=t[t.length-1];return e?e.params:{}}function o5(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=y.useContext(ul),{matches:i}=y.useContext(Ga),{pathname:s}=Bi(),o=JSON.stringify(kE(i,r.v7_relativeSplatPath));return y.useMemo(()=>OE(t,JSON.parse(o),s,n==="path"),[t,o,s,n])}function pJ(t,e){return mJ(t,e)}function mJ(t,e,n,r){Uf()||ar(!1);let{navigator:i}=y.useContext(ul),{matches:s}=y.useContext(Ga),o=s[s.length-1],c=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=Bi(),d;if(e){var f;let v=typeof e=="string"?Ff(e):e;l==="/"||(f=v.pathname)!=null&&f.startsWith(l)||ar(!1),d=v}else d=u;let h=d.pathname||"/",p=h;if(l!=="/"){let v=l.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(v.length).join("/")}let g=zX(t,{pathname:p}),m=bJ(g&&g.map(v=>Object.assign({},v,{params:Object.assign({},c,v.params),pathname:Ic([l,i.encodeLocation?i.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?l:Ic([l,i.encodeLocation?i.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),s,n,r);return e&&m?y.createElement(v0.Provider,{value:{location:Kp({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:wc.Pop}},m):m}function gJ(){let t=_J(),e=lJ(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},e),n?y.createElement("pre",{style:i},n):null,null)}const vJ=y.createElement(gJ,null);class yJ extends y.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?y.createElement(Ga.Provider,{value:this.props.routeContext},y.createElement(i5.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function xJ(t){let{routeContext:e,match:n,children:r}=t,i=y.useContext(IE);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),y.createElement(Ga.Provider,{value:e},r)}function bJ(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var s;if(!n)return null;if(n.errors)t=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,c=(i=n)==null?void 0:i.errors;if(c!=null){let d=o.findIndex(f=>f.route.id&&(c==null?void 0:c[f.route.id])!==void 0);d>=0||ar(!1),o=o.slice(0,Math.min(o.length,d+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,h)=>{let p,g=!1,m=null,v=null;n&&(p=c&&f.route.id?c[f.route.id]:void 0,m=f.route.errorElement||vJ,l&&(u<0&&h===0?(g=!0,v=null):u===h&&(g=!0,v=f.route.hydrateFallbackElement||null)));let b=e.concat(o.slice(0,h+1)),x=()=>{let w;return p?w=m:g?w=v:f.route.Component?w=y.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,y.createElement(xJ,{match:f,routeContext:{outlet:d,matches:b,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?y.createElement(yJ,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:x(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):x()},null)}var a5=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(a5||{}),Gy=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Gy||{});function wJ(t){let e=y.useContext(IE);return e||ar(!1),e}function SJ(t){let e=y.useContext(dJ);return e||ar(!1),e}function CJ(t){let e=y.useContext(Ga);return e||ar(!1),e}function c5(t){let e=CJ(),n=e.matches[e.matches.length-1];return n.route.id||ar(!1),n.route.id}function _J(){var t;let e=y.useContext(i5),n=SJ(Gy.UseRouteError),r=c5(Gy.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function AJ(){let{router:t}=wJ(a5.UseNavigateStable),e=c5(Gy.UseNavigateStable),n=y.useRef(!1);return s5(()=>{n.current=!0}),y.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Kp({fromRouteId:e},s)))},[t,e])}function l5(t){let{to:e,replace:n,state:r,relative:i}=t;Uf()||ar(!1);let{future:s,static:o}=y.useContext(ul),{matches:c}=y.useContext(Ga),{pathname:l}=Bi(),u=lr(),d=OE(e,kE(c,s.v7_relativeSplatPath),l,i==="path"),f=JSON.stringify(d);return y.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function $s(t){ar(!1)}function jJ(t){let{basename:e="/",children:n=null,location:r,navigationType:i=wc.Pop,navigator:s,static:o=!1,future:c}=t;Uf()&&ar(!1);let l=e.replace(/^\/*/,"/"),u=y.useMemo(()=>({basename:l,navigator:s,static:o,future:Kp({v7_relativeSplatPath:!1},c)}),[l,c,s,o]);typeof r=="string"&&(r=Ff(r));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:g="default"}=r,m=y.useMemo(()=>{let v=PE(d,l);return v==null?null:{location:{pathname:v,search:f,hash:h,state:p,key:g},navigationType:i}},[l,d,f,h,p,g,i]);return m==null?null:y.createElement(ul.Provider,{value:u},y.createElement(v0.Provider,{children:n,value:m}))}function EJ(t){let{children:e,location:n}=t;return pJ(L_(e),n)}new Promise(()=>{});function L_(t,e){e===void 0&&(e=[]);let n=[];return y.Children.forEach(t,(r,i)=>{if(!y.isValidElement(r))return;let s=[...e,i];if(r.type===y.Fragment){n.push.apply(n,L_(r.props.children,s));return}r.type!==$s&&ar(!1),!r.props.index||!r.props.children||ar(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=L_(r.props.children,s)),n.push(o)}),n}/** + * React Router DOM v6.27.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function F_(){return F_=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function TJ(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function PJ(t,e){return t.button===0&&(!e||e==="_self")&&!TJ(t)}function U_(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function kJ(t,e){let n=U_(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(s=>{n.append(i,s)})}),n}const OJ=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],IJ="6";try{window.__reactRouterVersion=IJ}catch{}const RJ="startTransition",WO=oL[RJ];function MJ(t){let{basename:e,children:n,future:r,window:i}=t,s=y.useRef();s.current==null&&(s.current=UX({window:i,v5Compat:!0}));let o=s.current,[c,l]=y.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=y.useCallback(f=>{u&&WO?WO(()=>l(f)):l(f)},[l,u]);return y.useLayoutEffect(()=>o.listen(d),[o,d]),y.createElement(jJ,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const DJ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",$J=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bs=y.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:c,target:l,to:u,preventScrollReset:d,viewTransition:f}=e,h=NJ(e,OJ),{basename:p}=y.useContext(ul),g,m=!1;if(typeof u=="string"&&$J.test(u)&&(g=u,DJ))try{let w=new URL(window.location.href),S=u.startsWith("//")?new URL(w.protocol+u):new URL(u),C=PE(S.pathname,p);S.origin===w.origin&&C!=null?u=C+S.search+S.hash:m=!0}catch{}let v=fJ(u,{relative:i}),b=LJ(u,{replace:o,state:c,target:l,preventScrollReset:d,relative:i,viewTransition:f});function x(w){r&&r(w),w.defaultPrevented||b(w)}return y.createElement("a",F_({},h,{href:g||v,onClick:m||s?r:x,ref:n,target:l}))});var qO;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(qO||(qO={}));var YO;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(YO||(YO={}));function LJ(t,e){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,viewTransition:c}=e===void 0?{}:e,l=lr(),u=Bi(),d=o5(t,{relative:o});return y.useCallback(f=>{if(PJ(f,n)){f.preventDefault();let h=r!==void 0?r:Vy(u)===Vy(d);l(t,{replace:h,state:i,preventScrollReset:s,relative:o,viewTransition:c})}},[u,l,d,r,i,n,t,s,o,c])}function FJ(t){let e=y.useRef(U_(t)),n=y.useRef(!1),r=Bi(),i=y.useMemo(()=>kJ(r.search,n.current?null:e.current),[r.search]),s=lr(),o=y.useCallback((c,l)=>{const u=U_(typeof c=="function"?c(i):c);n.current=!0,s("?"+u,l)},[s,i]);return[i,o]}/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UJ=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),u5=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var BJ={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const HJ=y.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...c},l)=>y.createElement("svg",{ref:l,...BJ,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:u5("lucide",i),...c},[...o.map(([u,d])=>y.createElement(u,d)),...Array.isArray(s)?s:[s]]));/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const De=(t,e)=>{const n=y.forwardRef(({className:r,...i},s)=>y.createElement(HJ,{ref:s,iconNode:e,className:u5(`lucide-${UJ(t)}`,r),...i}));return n.displayName=`${t}`,n};/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ma=De("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const QO=De("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Wp=De("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RS=De("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xa=De("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const du=De("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const XO=De("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zJ=De("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VJ=De("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const B_=De("ChartNoAxesColumnIncreasing",[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const GJ=De("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uo=De("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Da=De("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fs=De("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fu=De("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const KJ=De("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ME=De("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zh=De("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const d5=De("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const WJ=De("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qJ=De("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DE=De("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const YJ=De("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qp=De("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const H_=De("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const JO=De("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Jc=De("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const z_=De("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const QJ=De("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Yp=De("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const XJ=De("FileVideo",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $E=De("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const f5=De("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hs=De("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const JJ=De("Grid2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const V_=De("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ky=De("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cp=De("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ZJ=De("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const eZ=De("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const G_=De("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tZ=De("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hu=De("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uv=De("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const eo=De("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nZ=De("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ZO=De("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const eI=De("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rZ=De("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iZ=De("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const To=De("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Wo=De("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sZ=De("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tI=De("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const K_=De("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oZ=De("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aZ=De("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vr=De("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cZ=De("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Xl=De("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LE=De("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FE=De("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UE=De("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lZ=De("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uZ=De("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dZ=De("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fZ=De("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hZ=De("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Wy=De("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pZ=De("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Xv=De("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ir=De("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mZ=De("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gZ=De("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const h5=De("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Qp=De("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Fr=De("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vZ=De("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Mi=De("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const p5=De("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function m5(t,e){return function(){return t.apply(e,arguments)}}const{toString:yZ}=Object.prototype,{getPrototypeOf:BE}=Object,{iterator:y0,toStringTag:g5}=Symbol,x0=(t=>e=>{const n=yZ.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),vo=t=>(t=t.toLowerCase(),e=>x0(e)===t),b0=t=>e=>typeof e===t,{isArray:Bf}=Array,Xp=b0("undefined");function xZ(t){return t!==null&&!Xp(t)&&t.constructor!==null&&!Xp(t.constructor)&&Di(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const v5=vo("ArrayBuffer");function bZ(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&v5(t.buffer),e}const wZ=b0("string"),Di=b0("function"),y5=b0("number"),w0=t=>t!==null&&typeof t=="object",SZ=t=>t===!0||t===!1,Jv=t=>{if(x0(t)!=="object")return!1;const e=BE(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(g5 in t)&&!(y0 in t)},CZ=vo("Date"),_Z=vo("File"),AZ=vo("Blob"),jZ=vo("FileList"),EZ=t=>w0(t)&&Di(t.pipe),NZ=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Di(t.append)&&((e=x0(t))==="formdata"||e==="object"&&Di(t.toString)&&t.toString()==="[object FormData]"))},TZ=vo("URLSearchParams"),[PZ,kZ,OZ,IZ]=["ReadableStream","Request","Response","Headers"].map(vo),RZ=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function vg(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),Bf(t))for(r=0,i=t.length;r0;)if(i=n[r],e===i.toLowerCase())return i;return null}const Rl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,b5=t=>!Xp(t)&&t!==Rl;function W_(){const{caseless:t}=b5(this)&&this||{},e={},n=(r,i)=>{const s=t&&x5(e,i)||i;Jv(e[s])&&Jv(r)?e[s]=W_(e[s],r):Jv(r)?e[s]=W_({},r):Bf(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r(vg(e,(i,s)=>{n&&Di(i)?t[s]=m5(i,n):t[s]=i},{allOwnKeys:r}),t),DZ=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),$Z=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},LZ=(t,e,n,r)=>{let i,s,o;const c={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],(!r||r(o,t,e))&&!c[o]&&(e[o]=t[o],c[o]=!0);t=n!==!1&&BE(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},FZ=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},UZ=t=>{if(!t)return null;if(Bf(t))return t;let e=t.length;if(!y5(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},BZ=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&BE(Uint8Array)),HZ=(t,e)=>{const r=(t&&t[y0]).call(t);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},zZ=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},VZ=vo("HTMLFormElement"),GZ=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),nI=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),KZ=vo("RegExp"),w5=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};vg(n,(i,s)=>{let o;(o=e(i,s,t))!==!1&&(r[s]=o||i)}),Object.defineProperties(t,r)},WZ=t=>{w5(t,(e,n)=>{if(Di(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Di(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},qZ=(t,e)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return Bf(t)?r(t):r(String(t).split(e)),n},YZ=()=>{},QZ=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function XZ(t){return!!(t&&Di(t.append)&&t[g5]==="FormData"&&t[y0])}const JZ=t=>{const e=new Array(10),n=(r,i)=>{if(w0(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=Bf(r)?[]:{};return vg(r,(o,c)=>{const l=n(o,i+1);!Xp(l)&&(s[c]=l)}),e[i]=void 0,s}}return r};return n(t,0)},ZZ=vo("AsyncFunction"),eee=t=>t&&(w0(t)||Di(t))&&Di(t.then)&&Di(t.catch),S5=((t,e)=>t?setImmediate:e?((n,r)=>(Rl.addEventListener("message",({source:i,data:s})=>{i===Rl&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),Rl.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Di(Rl.postMessage)),tee=typeof queueMicrotask<"u"?queueMicrotask.bind(Rl):typeof process<"u"&&process.nextTick||S5,nee=t=>t!=null&&Di(t[y0]),re={isArray:Bf,isArrayBuffer:v5,isBuffer:xZ,isFormData:NZ,isArrayBufferView:bZ,isString:wZ,isNumber:y5,isBoolean:SZ,isObject:w0,isPlainObject:Jv,isReadableStream:PZ,isRequest:kZ,isResponse:OZ,isHeaders:IZ,isUndefined:Xp,isDate:CZ,isFile:_Z,isBlob:AZ,isRegExp:KZ,isFunction:Di,isStream:EZ,isURLSearchParams:TZ,isTypedArray:BZ,isFileList:jZ,forEach:vg,merge:W_,extend:MZ,trim:RZ,stripBOM:DZ,inherits:$Z,toFlatObject:LZ,kindOf:x0,kindOfTest:vo,endsWith:FZ,toArray:UZ,forEachEntry:HZ,matchAll:zZ,isHTMLForm:VZ,hasOwnProperty:nI,hasOwnProp:nI,reduceDescriptors:w5,freezeMethods:WZ,toObjectSet:qZ,toCamelCase:GZ,noop:YZ,toFiniteNumber:QZ,findKey:x5,global:Rl,isContextDefined:b5,isSpecCompliantForm:XZ,toJSONObject:JZ,isAsyncFn:ZZ,isThenable:eee,setImmediate:S5,asap:tee,isIterable:nee};function $t(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}re.inherits($t,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:re.toJSONObject(this.config),code:this.code,status:this.status}}});const C5=$t.prototype,_5={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{_5[t]={value:t}});Object.defineProperties($t,_5);Object.defineProperty(C5,"isAxiosError",{value:!0});$t.from=(t,e,n,r,i,s)=>{const o=Object.create(C5);return re.toFlatObject(t,o,function(l){return l!==Error.prototype},c=>c!=="isAxiosError"),$t.call(o,t.message,e,n,r,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};const ree=null;function q_(t){return re.isPlainObject(t)||re.isArray(t)}function A5(t){return re.endsWith(t,"[]")?t.slice(0,-2):t}function rI(t,e,n){return t?t.concat(e).map(function(i,s){return i=A5(i),!n&&s?"["+i+"]":i}).join(n?".":""):e}function iee(t){return re.isArray(t)&&!t.some(q_)}const see=re.toFlatObject(re,{},null,function(e){return/^is[A-Z]/.test(e)});function S0(t,e,n){if(!re.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=re.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,v){return!re.isUndefined(v[m])});const r=n.metaTokens,i=n.visitor||d,s=n.dots,o=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&re.isSpecCompliantForm(e);if(!re.isFunction(i))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(re.isDate(g))return g.toISOString();if(!l&&re.isBlob(g))throw new $t("Blob is not supported. Use a Buffer instead.");return re.isArrayBuffer(g)||re.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function d(g,m,v){let b=g;if(g&&!v&&typeof g=="object"){if(re.endsWith(m,"{}"))m=r?m:m.slice(0,-2),g=JSON.stringify(g);else if(re.isArray(g)&&iee(g)||(re.isFileList(g)||re.endsWith(m,"[]"))&&(b=re.toArray(g)))return m=A5(m),b.forEach(function(w,S){!(re.isUndefined(w)||w===null)&&e.append(o===!0?rI([m],S,s):o===null?m:m+"[]",u(w))}),!1}return q_(g)?!0:(e.append(rI(v,m,s),u(g)),!1)}const f=[],h=Object.assign(see,{defaultVisitor:d,convertValue:u,isVisitable:q_});function p(g,m){if(!re.isUndefined(g)){if(f.indexOf(g)!==-1)throw Error("Circular reference detected in "+m.join("."));f.push(g),re.forEach(g,function(b,x){(!(re.isUndefined(b)||b===null)&&i.call(e,b,re.isString(x)?x.trim():x,m,h))===!0&&p(b,m?m.concat(x):[x])}),f.pop()}}if(!re.isObject(t))throw new TypeError("data must be an object");return p(t),e}function iI(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function HE(t,e){this._pairs=[],t&&S0(t,this,e)}const j5=HE.prototype;j5.append=function(e,n){this._pairs.push([e,n])};j5.toString=function(e){const n=e?function(r){return e.call(this,r,iI)}:iI;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function oee(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function E5(t,e,n){if(!e)return t;const r=n&&n.encode||oee;re.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let s;if(i?s=i(e,n):s=re.isURLSearchParams(e)?e.toString():new HE(e,n).toString(r),s){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class sI{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){re.forEach(this.handlers,function(r){r!==null&&e(r)})}}const N5={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},aee=typeof URLSearchParams<"u"?URLSearchParams:HE,cee=typeof FormData<"u"?FormData:null,lee=typeof Blob<"u"?Blob:null,uee={isBrowser:!0,classes:{URLSearchParams:aee,FormData:cee,Blob:lee},protocols:["http","https","file","blob","url","data"]},zE=typeof window<"u"&&typeof document<"u",Y_=typeof navigator=="object"&&navigator||void 0,dee=zE&&(!Y_||["ReactNative","NativeScript","NS"].indexOf(Y_.product)<0),fee=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",hee=zE&&window.location.href||"http://localhost",pee=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:zE,hasStandardBrowserEnv:dee,hasStandardBrowserWebWorkerEnv:fee,navigator:Y_,origin:hee},Symbol.toStringTag,{value:"Module"})),si={...pee,...uee};function mee(t,e){return S0(t,new si.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,s){return si.isNode&&re.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function gee(t){return re.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function vee(t){const e={},n=Object.keys(t);let r;const i=n.length;let s;for(r=0;r=n.length;return o=!o&&re.isArray(i)?i.length:o,l?(re.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!c):((!i[o]||!re.isObject(i[o]))&&(i[o]=[]),e(n,r,i[o],s)&&re.isArray(i[o])&&(i[o]=vee(i[o])),!c)}if(re.isFormData(t)&&re.isFunction(t.entries)){const n={};return re.forEachEntry(t,(r,i)=>{e(gee(r),i,n,0)}),n}return null}function yee(t,e,n){if(re.isString(t))try{return(e||JSON.parse)(t),re.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(0,JSON.stringify)(t)}const yg={transitional:N5,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,s=re.isObject(e);if(s&&re.isHTMLForm(e)&&(e=new FormData(e)),re.isFormData(e))return i?JSON.stringify(T5(e)):e;if(re.isArrayBuffer(e)||re.isBuffer(e)||re.isStream(e)||re.isFile(e)||re.isBlob(e)||re.isReadableStream(e))return e;if(re.isArrayBufferView(e))return e.buffer;if(re.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return mee(e,this.formSerializer).toString();if((c=re.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return S0(c?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(n.setContentType("application/json",!1),yee(e)):e}],transformResponse:[function(e){const n=this.transitional||yg.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(re.isResponse(e)||re.isReadableStream(e))return e;if(e&&re.isString(e)&&(r&&!this.responseType||i)){const o=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(c){if(o)throw c.name==="SyntaxError"?$t.from(c,$t.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:si.classes.FormData,Blob:si.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};re.forEach(["delete","get","head","post","put","patch"],t=>{yg.headers[t]={}});const xee=re.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),bee=t=>{const e={};let n,r,i;return t&&t.split(` +`).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!n||e[n]&&xee[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},oI=Symbol("internals");function _h(t){return t&&String(t).trim().toLowerCase()}function Zv(t){return t===!1||t==null?t:re.isArray(t)?t.map(Zv):String(t)}function wee(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const See=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function MS(t,e,n,r,i){if(re.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!re.isString(e)){if(re.isString(r))return e.indexOf(r)!==-1;if(re.isRegExp(r))return r.test(e)}}function Cee(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function _ee(t,e){const n=re.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,s,o){return this[r].call(this,e,i,s,o)},configurable:!0})})}class $i{constructor(e){e&&this.set(e)}set(e,n,r){const i=this;function s(c,l,u){const d=_h(l);if(!d)throw new Error("header name must be a non-empty string");const f=re.findKey(i,d);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||l]=Zv(c))}const o=(c,l)=>re.forEach(c,(u,d)=>s(u,d,l));if(re.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if(re.isString(e)&&(e=e.trim())&&!See(e))o(bee(e),n);else if(re.isObject(e)&&re.isIterable(e)){let c={},l,u;for(const d of e){if(!re.isArray(d))throw TypeError("Object iterator must return a key-value pair");c[u=d[0]]=(l=c[u])?re.isArray(l)?[...l,d[1]]:[l,d[1]]:d[1]}o(c,n)}else e!=null&&s(n,e,r);return this}get(e,n){if(e=_h(e),e){const r=re.findKey(this,e);if(r){const i=this[r];if(!n)return i;if(n===!0)return wee(i);if(re.isFunction(n))return n.call(this,i,r);if(re.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=_h(e),e){const r=re.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||MS(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let i=!1;function s(o){if(o=_h(o),o){const c=re.findKey(r,o);c&&(!n||MS(r,r[c],c,n))&&(delete r[c],i=!0)}}return re.isArray(e)?e.forEach(s):s(e),i}clear(e){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const s=n[r];(!e||MS(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const n=this,r={};return re.forEach(this,(i,s)=>{const o=re.findKey(r,s);if(o){n[o]=Zv(i),delete n[s];return}const c=e?Cee(s):String(s).trim();c!==s&&delete n[s],n[c]=Zv(i),r[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return re.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&re.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[oI]=this[oI]={accessors:{}}).accessors,i=this.prototype;function s(o){const c=_h(o);r[c]||(_ee(i,o),r[c]=!0)}return re.isArray(e)?e.forEach(s):s(e),this}}$i.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);re.reduceDescriptors($i.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});re.freezeMethods($i);function DS(t,e){const n=this||yg,r=e||n,i=$i.from(r.headers);let s=r.data;return re.forEach(t,function(c){s=c.call(n,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function P5(t){return!!(t&&t.__CANCEL__)}function Hf(t,e,n){$t.call(this,t??"canceled",$t.ERR_CANCELED,e,n),this.name="CanceledError"}re.inherits(Hf,$t,{__CANCEL__:!0});function k5(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new $t("Request failed with status code "+n.status,[$t.ERR_BAD_REQUEST,$t.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Aee(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function jee(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const u=Date.now(),d=r[s];o||(o=u),n[i]=l,r[i]=u;let f=s,h=0;for(;f!==i;)h+=n[f++],f=f%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),u-o{n=d,i=null,s&&(clearTimeout(s),s=null),t.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?o(u,d):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},r-f)))},()=>i&&o(i)]}const qy=(t,e,n=3)=>{let r=0;const i=jee(50,250);return Eee(s=>{const o=s.loaded,c=s.lengthComputable?s.total:void 0,l=o-r,u=i(l),d=o<=c;r=o;const f={loaded:o,total:c,progress:c?o/c:void 0,bytes:l,rate:u||void 0,estimated:u&&c&&d?(c-o)/u:void 0,event:s,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(f)},n)},aI=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},cI=t=>(...e)=>re.asap(()=>t(...e)),Nee=si.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,si.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(si.origin),si.navigator&&/(msie|trident)/i.test(si.navigator.userAgent)):()=>!0,Tee=si.hasStandardBrowserEnv?{write(t,e,n,r,i,s){const o=[t+"="+encodeURIComponent(e)];re.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),re.isString(r)&&o.push("path="+r),re.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Pee(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function kee(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function O5(t,e,n){let r=!Pee(e);return t&&(r||n==!1)?kee(t,e):e}const lI=t=>t instanceof $i?{...t}:t;function pu(t,e){e=e||{};const n={};function r(u,d,f,h){return re.isPlainObject(u)&&re.isPlainObject(d)?re.merge.call({caseless:h},u,d):re.isPlainObject(d)?re.merge({},d):re.isArray(d)?d.slice():d}function i(u,d,f,h){if(re.isUndefined(d)){if(!re.isUndefined(u))return r(void 0,u,f,h)}else return r(u,d,f,h)}function s(u,d){if(!re.isUndefined(d))return r(void 0,d)}function o(u,d){if(re.isUndefined(d)){if(!re.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function c(u,d,f){if(f in e)return r(u,d);if(f in t)return r(void 0,u)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(u,d,f)=>i(lI(u),lI(d),f,!0)};return re.forEach(Object.keys(Object.assign({},t,e)),function(d){const f=l[d]||i,h=f(t[d],e[d],d);re.isUndefined(h)&&f!==c||(n[d]=h)}),n}const I5=t=>{const e=pu({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:c}=e;e.headers=o=$i.from(o),e.url=E5(O5(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let l;if(re.isFormData(n)){if(si.hasStandardBrowserEnv||si.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((l=o.getContentType())!==!1){const[u,...d]=l?l.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...d].join("; "))}}if(si.hasStandardBrowserEnv&&(r&&re.isFunction(r)&&(r=r(e)),r||r!==!1&&Nee(e.url))){const u=i&&s&&Tee.read(s);u&&o.set(i,u)}return e},Oee=typeof XMLHttpRequest<"u",Iee=Oee&&function(t){return new Promise(function(n,r){const i=I5(t);let s=i.data;const o=$i.from(i.headers).normalize();let{responseType:c,onUploadProgress:l,onDownloadProgress:u}=i,d,f,h,p,g;function m(){p&&p(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let v=new XMLHttpRequest;v.open(i.method.toUpperCase(),i.url,!0),v.timeout=i.timeout;function b(){if(!v)return;const w=$i.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),C={data:!c||c==="text"||c==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:w,config:t,request:v};k5(function(A){n(A),m()},function(A){r(A),m()},C),v=null}"onloadend"in v?v.onloadend=b:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(b)},v.onabort=function(){v&&(r(new $t("Request aborted",$t.ECONNABORTED,t,v)),v=null)},v.onerror=function(){r(new $t("Network Error",$t.ERR_NETWORK,t,v)),v=null},v.ontimeout=function(){let S=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const C=i.transitional||N5;i.timeoutErrorMessage&&(S=i.timeoutErrorMessage),r(new $t(S,C.clarifyTimeoutError?$t.ETIMEDOUT:$t.ECONNABORTED,t,v)),v=null},s===void 0&&o.setContentType(null),"setRequestHeader"in v&&re.forEach(o.toJSON(),function(S,C){v.setRequestHeader(C,S)}),re.isUndefined(i.withCredentials)||(v.withCredentials=!!i.withCredentials),c&&c!=="json"&&(v.responseType=i.responseType),u&&([h,g]=qy(u,!0),v.addEventListener("progress",h)),l&&v.upload&&([f,p]=qy(l),v.upload.addEventListener("progress",f),v.upload.addEventListener("loadend",p)),(i.cancelToken||i.signal)&&(d=w=>{v&&(r(!w||w.type?new Hf(null,t,v):w),v.abort(),v=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const x=Aee(i.url);if(x&&si.protocols.indexOf(x)===-1){r(new $t("Unsupported protocol "+x+":",$t.ERR_BAD_REQUEST,t));return}v.send(s||null)})},Ree=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const s=function(u){if(!i){i=!0,c();const d=u instanceof Error?u:this.reason;r.abort(d instanceof $t?d:new Hf(d instanceof Error?d.message:d))}};let o=e&&setTimeout(()=>{o=null,s(new $t(`timeout ${e} of ms exceeded`,$t.ETIMEDOUT))},e);const c=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),t=null)};t.forEach(u=>u.addEventListener("abort",s));const{signal:l}=r;return l.unsubscribe=()=>re.asap(c),l}},Mee=function*(t,e){let n=t.byteLength;if(n{const i=Dee(t,e);let s=0,o,c=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:d}=await i.next();if(u){c(),l.close();return}let f=d.byteLength;if(n){let h=s+=f;n(h)}l.enqueue(new Uint8Array(d))}catch(u){throw c(u),u}},cancel(l){return c(l),i.return()}},{highWaterMark:2})},C0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",R5=C0&&typeof ReadableStream=="function",Lee=C0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),M5=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Fee=R5&&M5(()=>{let t=!1;const e=new Request(si.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),dI=64*1024,Q_=R5&&M5(()=>re.isReadableStream(new Response("").body)),Yy={stream:Q_&&(t=>t.body)};C0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Yy[e]&&(Yy[e]=re.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new $t(`Response type '${e}' is not supported`,$t.ERR_NOT_SUPPORT,r)})})})(new Response);const Uee=async t=>{if(t==null)return 0;if(re.isBlob(t))return t.size;if(re.isSpecCompliantForm(t))return(await new Request(si.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(re.isArrayBufferView(t)||re.isArrayBuffer(t))return t.byteLength;if(re.isURLSearchParams(t)&&(t=t+""),re.isString(t))return(await Lee(t)).byteLength},Bee=async(t,e)=>{const n=re.toFiniteNumber(t.getContentLength());return n??Uee(e)},Hee=C0&&(async t=>{let{url:e,method:n,data:r,signal:i,cancelToken:s,timeout:o,onDownloadProgress:c,onUploadProgress:l,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:h}=I5(t);u=u?(u+"").toLowerCase():"text";let p=Ree([i,s&&s.toAbortSignal()],o),g;const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let v;try{if(l&&Fee&&n!=="get"&&n!=="head"&&(v=await Bee(d,r))!==0){let C=new Request(e,{method:"POST",body:r,duplex:"half"}),_;if(re.isFormData(r)&&(_=C.headers.get("content-type"))&&d.setContentType(_),C.body){const[A,j]=aI(v,qy(cI(l)));r=uI(C.body,dI,A,j)}}re.isString(f)||(f=f?"include":"omit");const b="credentials"in Request.prototype;g=new Request(e,{...h,signal:p,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:b?f:void 0});let x=await fetch(g);const w=Q_&&(u==="stream"||u==="response");if(Q_&&(c||w&&m)){const C={};["status","statusText","headers"].forEach(T=>{C[T]=x[T]});const _=re.toFiniteNumber(x.headers.get("content-length")),[A,j]=c&&aI(_,qy(cI(c),!0))||[];x=new Response(uI(x.body,dI,A,()=>{j&&j(),m&&m()}),C)}u=u||"text";let S=await Yy[re.findKey(Yy,u)||"text"](x,t);return!w&&m&&m(),await new Promise((C,_)=>{k5(C,_,{data:S,headers:$i.from(x.headers),status:x.status,statusText:x.statusText,config:t,request:g})})}catch(b){throw m&&m(),b&&b.name==="TypeError"&&/Load failed|fetch/i.test(b.message)?Object.assign(new $t("Network Error",$t.ERR_NETWORK,t,g),{cause:b.cause||b}):$t.from(b,b&&b.code,t,g)}}),X_={http:ree,xhr:Iee,fetch:Hee};re.forEach(X_,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const fI=t=>`- ${t}`,zee=t=>re.isFunction(t)||t===null||t===!1,D5={getAdapter:t=>{t=re.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let s=0;s`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : +`+s.map(fI).join(` +`):" "+fI(s[0]):"as no adapter specified";throw new $t("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:X_};function $S(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Hf(null,t)}function hI(t){return $S(t),t.headers=$i.from(t.headers),t.data=DS.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),D5.getAdapter(t.adapter||yg.adapter)(t).then(function(r){return $S(t),r.data=DS.call(t,t.transformResponse,r),r.headers=$i.from(r.headers),r},function(r){return P5(r)||($S(t),r&&r.response&&(r.response.data=DS.call(t,t.transformResponse,r.response),r.response.headers=$i.from(r.response.headers))),Promise.reject(r)})}const $5="1.9.0",_0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{_0[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const pI={};_0.transitional=function(e,n,r){function i(s,o){return"[Axios v"+$5+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,c)=>{if(e===!1)throw new $t(i(o," has been removed"+(n?" in "+n:"")),$t.ERR_DEPRECATED);return n&&!pI[o]&&(pI[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(s,o,c):!0}};_0.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function Vee(t,e,n){if(typeof t!="object")throw new $t("options must be an object",$t.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const s=r[i],o=e[s];if(o){const c=t[s],l=c===void 0||o(c,s,t);if(l!==!0)throw new $t("option "+s+" must be "+l,$t.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new $t("Unknown option "+s,$t.ERR_BAD_OPTION)}}const ey={assertOptions:Vee,validators:_0},So=ey.validators;class Jl{constructor(e){this.defaults=e||{},this.interceptors={request:new sI,response:new sI}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+s):r.stack=s}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=pu(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&ey.assertOptions(r,{silentJSONParsing:So.transitional(So.boolean),forcedJSONParsing:So.transitional(So.boolean),clarifyTimeoutError:So.transitional(So.boolean)},!1),i!=null&&(re.isFunction(i)?n.paramsSerializer={serialize:i}:ey.assertOptions(i,{encode:So.function,serialize:So.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ey.assertOptions(n,{baseUrl:So.spelling("baseURL"),withXsrfToken:So.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&re.merge(s.common,s[n.method]);s&&re.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),n.headers=$i.concat(o,s);const c=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(l=l&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,f=0,h;if(!l){const g=[hI.bind(this),void 0];for(g.unshift.apply(g,c),g.push.apply(g,u),h=g.length,d=Promise.resolve(n);f{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(c=>{r.subscribe(c),s=c}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},e(function(s,o,c){r.reason||(r.reason=new Hf(s,o,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new VE(function(i){e=i}),cancel:e}}}function Gee(t){return function(n){return t.apply(null,n)}}function Kee(t){return re.isObject(t)&&t.isAxiosError===!0}const J_={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(J_).forEach(([t,e])=>{J_[e]=t});function L5(t){const e=new Jl(t),n=m5(Jl.prototype.request,e);return re.extend(n,Jl.prototype,e,{allOwnKeys:!0}),re.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return L5(pu(t,i))},n}const vr=L5(yg);vr.Axios=Jl;vr.CanceledError=Hf;vr.CancelToken=VE;vr.isCancel=P5;vr.VERSION=$5;vr.toFormData=S0;vr.AxiosError=$t;vr.Cancel=vr.CanceledError;vr.all=function(e){return Promise.all(e)};vr.spread=Gee;vr.isAxiosError=Kee;vr.mergeConfig=pu;vr.AxiosHeaders=$i;vr.formToJSON=t=>T5(re.isHTMLForm(t)?new FormData(t):t);vr.getAdapter=D5.getAdapter;vr.HttpStatusCode=J_;vr.default=vr;const F5="https://ai-sandbox.oliver.solutions/semblance_back/api",Le=vr.create({baseURL:F5,headers:{"Content-Type":"application/json"},timeout:6e5});Le.interceptors.request.use(t=>{var n,r;const e=localStorage.getItem("auth_token");return e&&(t.headers.Authorization=`Bearer ${e}`),t.method==="put"&&((n=t.url)!=null&&n.includes("/focus-groups/"))&&console.log("🌐 API Request:",{method:t.method,url:t.url,baseURL:t.baseURL,fullURL:`${t.baseURL}${t.url}`,data:t.data}),(r=t.url)!=null&&r.includes("/folders/")&&console.log("🌐 API Folder Request:",{method:t.method,url:t.url,baseURL:t.baseURL,fullURL:`${t.baseURL}${t.url}`,data:t.data}),t},t=>Promise.reject(t));const Z_="auth_error",Wee=t=>{t!=null&&t.isPersonaCreation||(localStorage.removeItem("auth_token"),localStorage.removeItem("user"));const e=new CustomEvent(Z_,{detail:t||{}});window.dispatchEvent(e)};Le.interceptors.response.use(t=>t,t=>{var e,n,r,i,s,o;if(t.response&&t.response.status===401){const c=t.config&&(((e=t.config.url)==null?void 0:e.includes("/personas"))||((n=t.config.url)==null?void 0:n.includes("/personas/batch"))||t.config.method&&((r=t.config.url)==null?void 0:r.startsWith("/personas")));console.log("API Error:",{url:(i=t.config)==null?void 0:i.url,method:(s=t.config)==null?void 0:s.method,isPersonaRequest:c}),c?console.warn("Authentication error in persona request, letting component handle it"):Wee({source:(o=t.config)==null?void 0:o.url,isPersonaCreation:!1})}return Promise.reject(t)});const ty={login:(t,e)=>Le.post("/auth/login",{username:t,password:e}),loginWithMicrosoft:t=>Le.post("/auth/microsoft",{id_token:t}),register:(t,e,n)=>Le.post("/auth/register",{username:t,email:e,password:n}),getProfile:()=>Le.get("/auth/me")},$r={getAll:()=>Le.get("/personas/all"),getById:t=>Le.get(`/personas/${t}`),create:t=>Le.post("/personas",t),update:(t,e)=>t&&t.startsWith("local-")?(console.log("Cannot update with local ID, creating new instead:",t),Le.post("/personas",e)):Le.put(`/personas/${t}`,e),delete:t=>{const e=typeof t=="object"&&t!==null&&t._id||t;return console.log(`Deleting persona with ID: ${e}`),Le.delete(`/personas/${e}`)},createBatch:t=>Le.post("/personas/batch",t),exportProfile:(t,e)=>Le.post(`/personas/${t}/export-profile`,e||{},{timeout:3e5})},da={generate:t=>Le.post("/ai-personas/generate",t||{},{timeout:6e5}),generateAndSave:t=>Le.post("/ai-personas/generate-and-save",t||{},{timeout:6e5}),batchGenerate:t=>Le.post("/ai-personas/batch-generate",t,{timeout:6e5}),batchGenerateAndSave:t=>Le.post("/ai-personas/batch-generate-and-save",t,{timeout:6e5}),generateBasicProfiles:(t,e=5,n=.8)=>Le.post("/ai-personas/generate-basic-profiles",{audience_brief:t,count:e,temperature:n},{timeout:6e5}),completePersona:(t,e=.7)=>Le.post("/ai-personas/complete-persona",{basic_profile:t,temperature:e},{timeout:6e5}),completeAndSavePersona:(t,e=.7)=>Le.post("/ai-personas/complete-and-save-persona",{basic_profile:t,temperature:e},{timeout:6e5}),generatePersonaSummary:(t,e=.7)=>Le.post("/ai-personas/generate-persona-summary",{persona_data:t,temperature:e},{timeout:6e5}),batchGenerateWithStages:async(t,e,n=5,r=.7,i,s)=>{var o;try{console.log(`šŸ“” API call to generate-basic-profiles with model: ${s||"gemini-2.5-pro"}`);const l=(await Le.post("/ai-personas/generate-basic-profiles",{audience_brief:t,research_objective:e,count:n,temperature:.7,customer_data_session_id:i,llm_model:s||"gemini-2.5-pro"},{timeout:6e5})).data.profiles,u=[],d=[],f=[];console.log(`šŸ“” API call to complete-and-save-persona with model: ${s||"gemini-2.5-pro"}`);const h=l.map(g=>Le.post("/ai-personas/complete-and-save-persona",{basic_profile:g,temperature:r,customer_data_session_id:i,llm_model:s||"gemini-2.5-pro"},{timeout:6e5}));if((await Promise.allSettled(h)).forEach((g,m)=>{if(g.status==="fulfilled")u.push(g.value.data.persona),d.push(g.value.data.persona_id);else{const v=l[m],b={index:m,name:v.name||`Persona ${m+1}`,error:g.reason};f.push(b),console.error(`Failed to complete persona ${m+1} (${v.name||"unnamed"}):`,g.reason)}}),u.length===0&&f.length>0)throw new Error(`Failed to generate any personas. ${f.length} profile(s) failed.`);return{data:{message:`Generated and saved ${u.length} personas${f.length>0?` (${f.length} failed)`:""}`,personas:u,persona_ids:d,errors:f.length>0?f:void 0,partial_success:f.length>0&&u.length>0}}}catch(c){throw((o=c.response)==null?void 0:o.status)===504||c.code==="ECONNABORTED"?new Error("Timeout error: The server took too long to generate personas. Please try with fewer personas or try again later."):c}},enhanceAudienceBrief:(t,e,n=.7)=>Le.post("/ai-personas/enhance-audience-brief",{audience_brief:t,research_objective:e,temperature:n},{timeout:6e5}),batchGenerateSummaries:(t,e=.7,n)=>(console.log(`šŸ“” Frontend: API call to batch-generate-summaries with model: ${n||"gemini-2.5-pro"}`),Le.post("/ai-personas/batch-generate-summaries",{persona_ids:t,temperature:e,llm_model:n||"gemini-2.5-pro"},{timeout:9e5})),uploadCustomerData:t=>{const e=new FormData;for(let n=0;nLe.delete(`/ai-personas/cleanup-customer-data/${t}`)},bt={getAll:()=>Le.get("/focus-groups"),getById:t=>Le.get(`/focus-groups/${t}`),create:t=>Le.post("/focus-groups",t),update:(t,e)=>Le.put(`/focus-groups/${t}`,e),delete:t=>Le.delete(`/focus-groups/${t}`),addParticipant:(t,e)=>Le.post(`/focus-groups/${t}/participants`,{persona_id:e}),removeParticipant:(t,e)=>Le.delete(`/focus-groups/${t}/participants/${e}`),sendMessage:(t,e)=>Le.post(`/focus-groups/${t}/messages`,e),getMessages:t=>Le.get(`/focus-groups/${t}/messages`),updateMessageHighlight:(t,e,n)=>Le.patch(`/focus-groups/${t}/messages/${e}`,{highlighted:n}),describeAsset:(t,e)=>Le.post(`/focus-groups/${t}/describe-asset`,{asset_filename:e},{timeout:12e4}),generateDiscussionGuide:t=>Le.post("/focus-groups/generate-discussion-guide",t,{timeout:6e5}),generateDiscussionGuideForGroup:(t,e)=>Le.post(`/focus-groups/${t}/generate-discussion-guide`,e,{timeout:6e5}),downloadDiscussionGuide:async t=>{try{const e=await Le.get(`/focus-groups/${t}/discussion-guide/download`,{responseType:"blob",timeout:3e4}),n=e.headers["content-disposition"];let r="discussion-guide.md";if(n){const c=n.match(/filename="([^"]+)"/);c&&(r=c[1])}const i=new Blob([e.data],{type:"text/markdown"}),s=URL.createObjectURL(i),o=document.createElement("a");return o.href=s,o.download=r,o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(s),{success:!0,filename:r}}catch(e){throw console.error("Error downloading discussion guide:",e),new Error("Failed to download discussion guide")}},createNote:(t,e)=>Le.post(`/focus-groups/${t}/notes`,e),getNotes:t=>Le.get(`/focus-groups/${t}/notes`),deleteNote:(t,e)=>Le.delete(`/focus-groups/${t}/notes/${e}`),uploadAssets:(t,e,n)=>(n===!0&&e.append("replace","true"),Le.post(`/focus-groups/${t}/assets`,e,{headers:{"Content-Type":"multipart/form-data"},timeout:12e4})),getAssets:t=>Le.get(`/focus-groups/${t}/assets`),getAssetUrl:(t,e)=>`${F5}/focus-groups/${t}/assets/${e}`,updateAssetName:(t,e,n)=>Le.patch(`/focus-groups/${t}/assets/${e}`,{user_assigned_name:n}),deleteAsset:(t,e)=>Le.delete(`/focus-groups/${t}/assets/${e}`)},er={generateResponse:(t,e,n,r=.7)=>Le.post("/focus-group-ai/generate-response",{focus_group_id:t,persona_id:e,current_topic:n,temperature:r},{timeout:6e5}),generateKeyThemes:(t,e=.7)=>Le.post("/focus-group-ai/generate-key-themes",{focus_group_id:t,temperature:e},{timeout:6e5}),getKeyThemes:t=>Le.get(`/focus-group-ai/key-themes/${t}`),deleteKeyTheme:(t,e)=>Le.delete(`/focus-group-ai/key-themes/${t}/${e}`),getModeratorStatus:t=>Le.get(`/focus-group-ai/moderator/status/${t}`),advanceModeratorDiscussion:t=>Le.post(`/focus-group-ai/moderator/advance/${t}`,{},{timeout:6e5}),setModeratorPosition:(t,e,n)=>Le.put(`/focus-group-ai/moderator/position/${t}`,{section_id:e,item_id:n}),startAutonomousConversation:(t,e)=>Le.post(`/focus-group-ai/autonomous/start/${t}`,{initial_prompt:e},{timeout:6e5}),stopAutonomousConversation:(t,e)=>Le.post(`/focus-group-ai/autonomous/stop/${t}`,{reason:e}),getAutonomousConversationStatus:t=>Le.get(`/focus-group-ai/autonomous/status/${t}`),getConversationState:t=>Le.get(`/focus-group-ai/conversation/state/${t}`),getConversationAnalytics:t=>Le.get(`/focus-group-ai/conversation/analytics/${t}`),makeConversationDecision:(t,e=.7,n="ai")=>Le.post(`/focus-group-ai/conversation/decision/${t}`,{temperature:e,mode:n},{timeout:6e5}),getConversationInsights:t=>Le.get(`/focus-group-ai/conversation/insights/${t}`,{timeout:6e5}),manualIntervention:(t,e,n,r)=>Le.post(`/focus-group-ai/conversation/intervene/${t}`,{action:e,message:n,participant_id:r}),getReasoningHistory:t=>Le.get(`/focus-group-ai/conversation/reasoning-history/${t}`),endSession:(t,e)=>Le.post(`/focus-group-ai/moderator/end-session/${t}`,{reason:e||"session_ended"})},Po={getAll:()=>Le.get("/folders"),getById:t=>Le.get(`/folders/${t}`),create:t=>Le.post("/folders",t),update:(t,e)=>Le.put(`/folders/${t}`,e),delete:t=>Le.delete(`/folders/${t}`),addPersona:(t,e)=>Le.post(`/folders/${t}/personas`,{persona_id:e}),removePersona:(t,e)=>Le.delete(`/folders/${t}/personas/${e}`),addPersonasBatch:(t,e)=>Le.post(`/folders/${t}/personas/batch`,{persona_ids:e}),removePersonasBatch:(t,e)=>(console.log(`🌐 API removePersonasBatch: Sending POST to /folders/${t}/personas/remove-batch with persona_ids:`,e),Le.post(`/folders/${t}/personas/remove-batch`,{persona_ids:e})),addPersonaToMultipleFolders:(t,e)=>{const n=e.map(r=>Le.post(`/folders/${r}/personas`,{persona_id:t}));return Promise.all(n)},removePersonaFromAllFolders:t=>{throw new Error("Use removePersona for specific folders")}};/*! @azure/msal-common v15.10.0 2025-08-05 */const pe={LIBRARY_NAME:"MSAL.JS",SKU:"msal.js.common",DEFAULT_AUTHORITY:"https://login.microsoftonline.com/common/",DEFAULT_AUTHORITY_HOST:"login.microsoftonline.com",DEFAULT_COMMON_TENANT:"common",ADFS:"adfs",DSTS:"dstsv2",AAD_INSTANCE_DISCOVERY_ENDPT:"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",CIAM_AUTH_URL:".ciamlogin.com",AAD_TENANT_DOMAIN_SUFFIX:".onmicrosoft.com",RESOURCE_DELIM:"|",NO_ACCOUNT:"NO_ACCOUNT",CLAIMS:"claims",CONSUMER_UTID:"9188040d-6c67-4c5b-b112-36a304b66dad",OPENID_SCOPE:"openid",PROFILE_SCOPE:"profile",OFFLINE_ACCESS_SCOPE:"offline_access",EMAIL_SCOPE:"email",CODE_GRANT_TYPE:"authorization_code",RT_GRANT_TYPE:"refresh_token",S256_CODE_CHALLENGE_METHOD:"S256",URL_FORM_CONTENT_TYPE:"application/x-www-form-urlencoded;charset=utf-8",AUTHORIZATION_PENDING:"authorization_pending",NOT_DEFINED:"not_defined",EMPTY_STRING:"",NOT_APPLICABLE:"N/A",NOT_AVAILABLE:"Not Available",FORWARD_SLASH:"/",IMDS_ENDPOINT:"http://169.254.169.254/metadata/instance/compute/location",IMDS_VERSION:"2020-06-01",IMDS_TIMEOUT:2e3,AZURE_REGION_AUTO_DISCOVER_FLAG:"TryAutoDetect",REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX:"login.microsoft.com",KNOWN_PUBLIC_CLOUDS:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"],SHR_NONCE_VALIDITY:240,INVALID_INSTANCE:"invalid_instance"},Sc={SUCCESS:200,SUCCESS_RANGE_START:200,SUCCESS_RANGE_END:299,REDIRECT:302,CLIENT_ERROR:400,CLIENT_ERROR_RANGE_START:400,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,REQUEST_TIMEOUT:408,GONE:410,TOO_MANY_REQUESTS:429,CLIENT_ERROR_RANGE_END:499,SERVER_ERROR:500,SERVER_ERROR_RANGE_START:500,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,SERVER_ERROR_RANGE_END:599,MULTI_SIDED_ERROR:600},Ml={GET:"GET",POST:"POST"},xg=[pe.OPENID_SCOPE,pe.PROFILE_SCOPE,pe.OFFLINE_ACCESS_SCOPE],mI=[...xg,pe.EMAIL_SCOPE],hi={CONTENT_TYPE:"Content-Type",CONTENT_LENGTH:"Content-Length",RETRY_AFTER:"Retry-After",CCS_HEADER:"X-AnchorMailbox",WWWAuthenticate:"WWW-Authenticate",AuthenticationInfo:"Authentication-Info",X_MS_REQUEST_ID:"x-ms-request-id",X_MS_HTTP_VERSION:"x-ms-httpver"},gI={ACTIVE_ACCOUNT_FILTERS:"active-account-filters"},Rc={COMMON:"common",ORGANIZATIONS:"organizations",CONSUMERS:"consumers"},dv={ACCESS_TOKEN:"access_token",XMS_CC:"xms_cc"},gi={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",CREATE:"create",NO_SESSION:"no_session"},GE={CODE:"code",IDTOKEN_TOKEN:"id_token token",IDTOKEN_TOKEN_REFRESHTOKEN:"id_token token refresh_token"},A0={QUERY:"query",FRAGMENT:"fragment"},qee={QUERY:"query",FRAGMENT:"fragment",FORM_POST:"form_post"},U5={IMPLICIT_GRANT:"implicit",AUTHORIZATION_CODE_GRANT:"authorization_code",CLIENT_CREDENTIALS_GRANT:"client_credentials",RESOURCE_OWNER_PASSWORD_GRANT:"password",REFRESH_TOKEN_GRANT:"refresh_token",DEVICE_CODE_GRANT:"device_code",JWT_BEARER:"urn:ietf:params:oauth:grant-type:jwt-bearer"},fv={MSSTS_ACCOUNT_TYPE:"MSSTS",ADFS_ACCOUNT_TYPE:"ADFS",MSAV1_ACCOUNT_TYPE:"MSA",GENERIC_ACCOUNT_TYPE:"Generic"},Jp={CACHE_KEY_SEPARATOR:"-",CLIENT_INFO_SEPARATOR:"."},Gr={ID_TOKEN:"IdToken",ACCESS_TOKEN:"AccessToken",ACCESS_TOKEN_WITH_AUTH_SCHEME:"AccessToken_With_AuthScheme",REFRESH_TOKEN:"RefreshToken"},KE="appmetadata",Yee="client_info",Qy="1",Xy={CACHE_KEY:"authority-metadata",REFRESH_TIME_SECONDS:3600*24},zi={CONFIG:"config",CACHE:"cache",NETWORK:"network",HARDCODED_VALUES:"hardcoded_values"},Br={SCHEMA_VERSION:5,MAX_LAST_HEADER_BYTES:330,MAX_CACHED_ERRORS:50,CACHE_KEY:"server-telemetry",CATEGORY_SEPARATOR:"|",VALUE_SEPARATOR:",",OVERFLOW_TRUE:"1",OVERFLOW_FALSE:"0",UNKNOWN_ERROR:"unknown_error"},yn={BEARER:"Bearer",POP:"pop",SSH:"ssh-cert"},lp={DEFAULT_THROTTLE_TIME_SECONDS:60,DEFAULT_MAX_THROTTLE_TIME_SECONDS:3600,THROTTLING_PREFIX:"throttling",X_MS_LIB_CAPABILITY_VALUE:"retry-after, h429"},vI={INVALID_GRANT_ERROR:"invalid_grant",CLIENT_MISMATCH_ERROR:"client_mismatch"},Fu={FAILED_AUTO_DETECTION:"1",INTERNAL_CACHE:"2",ENVIRONMENT_VARIABLE:"3",IMDS:"4"},LS={CONFIGURED_NO_AUTO_DETECTION:"2",AUTO_DETECTION_REQUESTED_SUCCESSFUL:"4",AUTO_DETECTION_REQUESTED_FAILED:"5"},jl={NOT_APPLICABLE:"0",FORCE_REFRESH_OR_CLAIMS:"1",NO_CACHED_ACCESS_TOKEN:"2",CACHED_ACCESS_TOKEN_EXPIRED:"3",PROACTIVELY_REFRESHED:"4"},Qee={Jwt:"JWT",Jwk:"JWK",Pop:"pop"},B5=300;/*! @azure/msal-common v15.10.0 2025-08-05 */const Jy="unexpected_error",Xee="post_request_failed";/*! @azure/msal-common v15.10.0 2025-08-05 */const yI={[Jy]:"Unexpected error in authentication.",[Xee]:"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."};class Cn extends Error{constructor(e,n,r){const i=n?`${e}: ${n}`:e;super(i),Object.setPrototypeOf(this,Cn.prototype),this.errorCode=e||pe.EMPTY_STRING,this.errorMessage=n||pe.EMPTY_STRING,this.subError=r||pe.EMPTY_STRING,this.name="AuthError"}setCorrelationId(e){this.correlationId=e}}function eA(t,e){return new Cn(t,e?`${yI[t]} ${e}`:yI[t])}/*! @azure/msal-common v15.10.0 2025-08-05 */const WE="client_info_decoding_error",H5="client_info_empty_error",qE="token_parsing_error",z5="null_or_empty_token",fa="endpoints_resolution_error",V5="network_error",G5="openid_config_error",K5="hash_not_deserialized",Jd="invalid_state",W5="state_mismatch",tA="state_not_found",q5="nonce_mismatch",YE="auth_time_not_found",Y5="max_age_transpired",Jee="multiple_matching_tokens",Zee="multiple_matching_accounts",Q5="multiple_matching_appMetadata",X5="request_cannot_be_made",J5="cannot_remove_empty_scope",Z5="cannot_append_scopeset",nA="empty_input_scopeset",ete="device_code_polling_cancelled",tte="device_code_expired",nte="device_code_unknown_error",QE="no_account_in_silent_request",eU="invalid_cache_record",XE="invalid_cache_environment",rA="no_account_found",iA="no_crypto_object",rte="unexpected_credential_type",ite="invalid_assertion",ste="invalid_client_credential",Mc="token_refresh_required",ote="user_timeout_reached",tU="token_claims_cnf_required_for_signedjwt",nU="authorization_code_missing_from_server_response",rU="binding_key_not_removed",iU="end_session_endpoint_not_supported",JE="key_id_missing",ate="no_network_connectivity",cte="user_canceled",lte="missing_tenant_id_error",Vt="method_not_implemented",ute="nested_app_auth_bridge_disabled";/*! @azure/msal-common v15.10.0 2025-08-05 */const xI={[WE]:"The client info could not be parsed/decoded correctly",[H5]:"The client info was empty",[qE]:"Token cannot be parsed",[z5]:"The token is null or empty",[fa]:"Endpoints cannot be resolved",[V5]:"Network request failed",[G5]:"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints.",[K5]:"The hash parameters could not be deserialized",[Jd]:"State was not the expected format",[W5]:"State mismatch error",[tA]:"State not found",[q5]:"Nonce mismatch error",[YE]:"Max Age was requested and the ID token is missing the auth_time variable. auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information.",[Y5]:"Max Age is set to 0, or too much time has elapsed since the last end-user authentication.",[Jee]:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account.",[Zee]:"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account",[Q5]:"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata",[X5]:"Token request cannot be made without authorization code or refresh token.",[J5]:"Cannot remove null or empty scope from ScopeSet",[Z5]:"Cannot append ScopeSet",[nA]:"Empty input ScopeSet cannot be processed",[ete]:"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.",[tte]:"Device code is expired.",[nte]:"Device code stopped polling for unknown reasons.",[QE]:"Please pass an account object, silent flow is not supported without account information",[eU]:"Cache record object was null or undefined.",[XE]:"Invalid environment when attempting to create cache entry",[rA]:"No account found in cache for given key.",[iA]:"No crypto object detected.",[rte]:"Unexpected credential type.",[ite]:"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515",[ste]:"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential",[Mc]:"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired.",[ote]:"User defined timeout for device code polling reached",[tU]:"Cannot generate a POP jwt if the token_claims are not populated",[nU]:"Server response does not contain an authorization code to proceed",[rU]:"Could not remove the credential's binding key from storage.",[iU]:"The provided authority does not support logout",[JE]:"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.",[ate]:"No network connectivity. Check your internet connection.",[cte]:"User cancelled the flow.",[lte]:"A tenant id - not common, organizations, or consumers - must be specified when using the client_credentials flow.",[Vt]:"This method has not been implemented",[ute]:"The nested app auth bridge is disabled"};class ZE extends Cn{constructor(e,n){super(e,n?`${xI[e]}: ${n}`:xI[e]),this.name="ClientAuthError",Object.setPrototypeOf(this,ZE.prototype)}}function Se(t,e){return new ZE(t,e)}/*! @azure/msal-common v15.10.0 2025-08-05 */const Zy={createNewGuid:()=>{throw Se(Vt)},base64Decode:()=>{throw Se(Vt)},base64Encode:()=>{throw Se(Vt)},base64UrlEncode:()=>{throw Se(Vt)},encodeKid:()=>{throw Se(Vt)},async getPublicKeyThumbprint(){throw Se(Vt)},async removeTokenBindingKey(){throw Se(Vt)},async clearKeystore(){throw Se(Vt)},async signJwt(){throw Se(Vt)},async hashString(){throw Se(Vt)}};/*! @azure/msal-common v15.10.0 2025-08-05 */var Rn;(function(t){t[t.Error=0]="Error",t[t.Warning=1]="Warning",t[t.Info=2]="Info",t[t.Verbose=3]="Verbose",t[t.Trace=4]="Trace"})(Rn||(Rn={}));class $a{constructor(e,n,r){this.level=Rn.Info;const i=()=>{},s=e||$a.createDefaultLoggerOptions();this.localCallback=s.loggerCallback||i,this.piiLoggingEnabled=s.piiLoggingEnabled||!1,this.level=typeof s.logLevel=="number"?s.logLevel:Rn.Info,this.correlationId=s.correlationId||pe.EMPTY_STRING,this.packageName=n||pe.EMPTY_STRING,this.packageVersion=r||pe.EMPTY_STRING}static createDefaultLoggerOptions(){return{loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:Rn.Info}}clone(e,n,r){return new $a({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level,correlationId:r||this.correlationId},e,n)}logMessage(e,n){if(n.logLevel>this.level||!this.piiLoggingEnabled&&n.containsPii)return;const s=`${`[${new Date().toUTCString()}] : [${n.correlationId||this.correlationId||""}]`} : ${this.packageName}@${this.packageVersion} : ${Rn[n.logLevel]} - ${e}`;this.executeCallback(n.logLevel,s,n.containsPii||!1)}executeCallback(e,n,r){this.localCallback&&this.localCallback(e,n,r)}error(e,n){this.logMessage(e,{logLevel:Rn.Error,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}errorPii(e,n){this.logMessage(e,{logLevel:Rn.Error,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}warning(e,n){this.logMessage(e,{logLevel:Rn.Warning,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}warningPii(e,n){this.logMessage(e,{logLevel:Rn.Warning,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}info(e,n){this.logMessage(e,{logLevel:Rn.Info,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}infoPii(e,n){this.logMessage(e,{logLevel:Rn.Info,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}verbose(e,n){this.logMessage(e,{logLevel:Rn.Verbose,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}verbosePii(e,n){this.logMessage(e,{logLevel:Rn.Verbose,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}trace(e,n){this.logMessage(e,{logLevel:Rn.Trace,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}tracePii(e,n){this.logMessage(e,{logLevel:Rn.Trace,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}isPiiLoggingEnabled(){return this.piiLoggingEnabled||!1}}/*! @azure/msal-common v15.10.0 2025-08-05 */const sU="@azure/msal-common",eN="15.10.0";/*! @azure/msal-common v15.10.0 2025-08-05 */const tN={None:"none",AzurePublic:"https://login.microsoftonline.com",AzurePpe:"https://login.windows-ppe.net",AzureChina:"https://login.chinacloudapi.cn",AzureGermany:"https://login.microsoftonline.de",AzureUsGovernment:"https://login.microsoftonline.us"};/*! @azure/msal-common v15.10.0 2025-08-05 */const oU="redirect_uri_empty",dte="claims_request_parsing_error",aU="authority_uri_insecure",Vh="url_parse_error",cU="empty_url_error",lU="empty_input_scopes_error",nN="invalid_claims",uU="token_request_empty",dU="logout_request_empty",fte="invalid_code_challenge_method",rN="pkce_params_missing",iN="invalid_cloud_discovery_metadata",fU="invalid_authority_metadata",hU="untrusted_authority",j0="missing_ssh_jwk",pU="missing_ssh_kid",hte="missing_nonce_authentication_header",pte="invalid_authentication_header",mU="cannot_set_OIDCOptions",gU="cannot_allow_platform_broker",vU="authority_mismatch",yU="invalid_request_method_for_EAR",xU="invalid_authorize_post_body_parameters";/*! @azure/msal-common v15.10.0 2025-08-05 */const mte={[oU]:"A redirect URI is required for all calls, and none has been set.",[dte]:"Could not parse the given claims request object.",[aU]:"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options",[Vh]:"URL could not be parsed into appropriate segments.",[cU]:"URL was empty or null.",[lU]:"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.",[nN]:"Given claims parameter must be a stringified JSON object.",[uU]:"Token request was empty and not found in cache.",[dU]:"The logout request was null or undefined.",[fte]:'code_challenge_method passed is invalid. Valid values are "plain" and "S256".',[rN]:"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request",[iN]:"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields",[fU]:"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields.",[hU]:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.",[j0]:"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme.",[pU]:"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme.",[hte]:"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.",[pte]:"Invalid authentication header provided",[mU]:"Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",[gU]:"Cannot set allowPlatformBroker parameter to true when not in AAD protocol mode.",[vU]:"Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority.",[xU]:"Invalid authorize post body parameters provided. If you are using authorizePostBodyParameters, the request method must be POST. Please check the request method and parameters.",[yU]:"Invalid request method for EAR protocol mode. The request method cannot be GET when using EAR protocol mode. Please change the request method to POST."};class sN extends Cn{constructor(e){super(e,mte[e]),this.name="ClientConfigurationError",Object.setPrototypeOf(this,sN.prototype)}}function An(t){return new sN(t)}/*! @azure/msal-common v15.10.0 2025-08-05 */class Uo{static isEmptyObj(e){if(e)try{const n=JSON.parse(e);return Object.keys(n).length===0}catch{}return!0}static startsWith(e,n){return e.indexOf(n)===0}static endsWith(e,n){return e.length>=n.length&&e.lastIndexOf(n)===e.length-n.length}static queryStringToObject(e){const n={},r=e.split("&"),i=s=>decodeURIComponent(s.replace(/\+/g," "));return r.forEach(s=>{if(s.trim()){const[o,c]=s.split(/=(.+)/g,2);o&&c&&(n[i(o)]=i(c))}}),n}static trimArrayEntries(e){return e.map(n=>n.trim())}static removeEmptyStringsFromArray(e){return e.filter(n=>!!n)}static jsonParseHelper(e){try{return JSON.parse(e)}catch{return null}}static matchPattern(e,n){return new RegExp(e.replace(/\\/g,"\\\\").replace(/\*/g,"[^ ]*").replace(/\?/g,"\\?")).test(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Er{constructor(e){const n=e?Uo.trimArrayEntries([...e]):[],r=n?Uo.removeEmptyStringsFromArray(n):[];if(!r||!r.length)throw An(lU);this.scopes=new Set,r.forEach(i=>this.scopes.add(i))}static fromString(e){const r=(e||pe.EMPTY_STRING).split(" ");return new Er(r)}static createSearchScopes(e){const n=new Er(e);return n.containsOnlyOIDCScopes()?n.removeScope(pe.OFFLINE_ACCESS_SCOPE):n.removeOIDCScopes(),n}containsScope(e){const n=this.printScopesLowerCase().split(" "),r=new Er(n);return e?r.scopes.has(e.toLowerCase()):!1}containsScopeSet(e){return!e||e.scopes.size<=0?!1:this.scopes.size>=e.scopes.size&&e.asArray().every(n=>this.containsScope(n))}containsOnlyOIDCScopes(){let e=0;return mI.forEach(n=>{this.containsScope(n)&&(e+=1)}),this.scopes.size===e}appendScope(e){e&&this.scopes.add(e.trim())}appendScopes(e){try{e.forEach(n=>this.appendScope(n))}catch{throw Se(Z5)}}removeScope(e){if(!e)throw Se(J5);this.scopes.delete(e.trim())}removeOIDCScopes(){mI.forEach(e=>{this.scopes.delete(e)})}unionScopeSets(e){if(!e)throw Se(nA);const n=new Set;return e.scopes.forEach(r=>n.add(r.toLowerCase())),this.scopes.forEach(r=>n.add(r.toLowerCase())),n}intersectingScopeSets(e){if(!e)throw Se(nA);e.containsOnlyOIDCScopes()||e.removeOIDCScopes();const n=this.unionScopeSets(e),r=e.getScopeCount(),i=this.getScopeCount();return n.sizee.push(n)),e}printScopes(){return this.scopes?this.asArray().join(" "):pe.EMPTY_STRING}printScopesLowerCase(){return this.printScopes().toLowerCase()}}/*! @azure/msal-common v15.10.0 2025-08-05 */function bI(t,e){return!!t&&!!e&&t===e.split(".")[1]}function oN(t,e,n,r){if(r){const{oid:i,sub:s,tid:o,name:c,tfp:l,acr:u,preferred_username:d,upn:f,login_hint:h}=r,p=o||l||u||"";return{tenantId:p,localAccountId:i||s||"",name:c,username:d||f||"",loginHint:h,isHomeTenant:bI(p,t)}}else return{tenantId:n,localAccountId:e,username:"",isHomeTenant:bI(n,t)}}function aN(t,e,n,r){let i=t;if(e){const{isHomeTenant:s,...o}=e;i={...t,...o}}if(n){const{isHomeTenant:s,...o}=oN(t.homeAccountId,t.localAccountId,t.tenantId,n);return i={...i,...o,idTokenClaims:n,idToken:r},i}return i}/*! @azure/msal-common v15.10.0 2025-08-05 */function zf(t,e){const n=gte(t);try{const r=e(n);return JSON.parse(r)}catch{throw Se(qE)}}function gte(t){if(!t)throw Se(z5);const n=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(t);if(!n||n.length<4)throw Se(qE);return n[2]}function bU(t,e){if(e===0||Date.now()-3e5>t+e)throw Se(Y5)}/*! @azure/msal-common v15.10.0 2025-08-05 */function wU(t){return t.startsWith("#/")?t.substring(2):t.startsWith("#")||t.startsWith("?")?t.substring(1):t}function ex(t){if(!t||t.indexOf("=")<0)return null;try{const e=wU(t),n=Object.fromEntries(new URLSearchParams(e));if(n.code||n.ear_jwe||n.error||n.error_description||n.state)return n}catch{throw Se(K5)}return null}function Zp(t,e=!0,n){const r=new Array;return t.forEach((i,s)=>{!e&&n&&s in n?r.push(`${s}=${i}`):r.push(`${s}=${encodeURIComponent(i)}`)}),r.join("&")}/*! @azure/msal-common v15.10.0 2025-08-05 */class en{get urlString(){return this._urlString}constructor(e){if(this._urlString=e,!this._urlString)throw An(cU);e.includes("#")||(this._urlString=en.canonicalizeUri(e))}static canonicalizeUri(e){if(e){let n=e.toLowerCase();return Uo.endsWith(n,"?")?n=n.slice(0,-1):Uo.endsWith(n,"?/")&&(n=n.slice(0,-2)),Uo.endsWith(n,"/")||(n+="/"),n}return e}validateAsUri(){let e;try{e=this.getUrlComponents()}catch{throw An(Vh)}if(!e.HostNameAndPort||!e.PathSegments)throw An(Vh);if(!e.Protocol||e.Protocol.toLowerCase()!=="https:")throw An(aU)}static appendQueryString(e,n){return n?e.indexOf("?")<0?`${e}?${n}`:`${e}&${n}`:e}static removeHashFromUrl(e){return en.canonicalizeUri(e.split("#")[0])}replaceTenantPath(e){const n=this.getUrlComponents(),r=n.PathSegments;return e&&r.length!==0&&(r[0]===Rc.COMMON||r[0]===Rc.ORGANIZATIONS)&&(r[0]=e),en.constructAuthorityUriFromObject(n)}getUrlComponents(){const e=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),n=this.urlString.match(e);if(!n)throw An(Vh);const r={Protocol:n[1],HostNameAndPort:n[4],AbsolutePath:n[5],QueryString:n[7]};let i=r.AbsolutePath.split("/");return i=i.filter(s=>s&&s.length>0),r.PathSegments=i,r.QueryString&&r.QueryString.endsWith("/")&&(r.QueryString=r.QueryString.substring(0,r.QueryString.length-1)),r}static getDomainFromUrl(e){const n=RegExp("^([^:/?#]+://)?([^/?#]*)"),r=e.match(n);if(!r)throw An(Vh);return r[2]}static getAbsoluteUrl(e,n){if(e[0]===pe.FORWARD_SLASH){const i=new en(n).getUrlComponents();return i.Protocol+"//"+i.HostNameAndPort+e}return e}static constructAuthorityUriFromObject(e){return new en(e.Protocol+"//"+e.HostNameAndPort+"/"+e.PathSegments.join("/"))}static hashContainsKnownProperties(e){return!!ex(e)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const SU={endpointMetadata:{"login.microsoftonline.com":{token_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.com/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/logout"},"login.chinacloudapi.cn":{token_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.chinacloudapi.cn/{tenantid}/discovery/v2.0/keys",issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",authorization_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/logout"},"login.microsoftonline.us":{token_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.us/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/logout"}},instanceDiscoveryMetadata:{metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]}},wI=SU.endpointMetadata,cN=SU.instanceDiscoveryMetadata,CU=new Set;cN.metadata.forEach(t=>{t.aliases.forEach(e=>{CU.add(e)})});function vte(t,e){var i;let n;const r=t.canonicalAuthority;if(r){const s=new en(r).getUrlComponents().HostNameAndPort;n=SI(s,(i=t.cloudDiscoveryMetadata)==null?void 0:i.metadata,zi.CONFIG,e)||SI(s,cN.metadata,zi.HARDCODED_VALUES,e)||t.knownAuthorities}return n||[]}function SI(t,e,n,r){if(r==null||r.trace(`getAliasesFromMetadata called with source: ${n}`),t&&e){const i=tx(e,t);if(i)return r==null||r.trace(`getAliasesFromMetadata: found cloud discovery metadata in ${n}, returning aliases`),i.aliases;r==null||r.trace(`getAliasesFromMetadata: did not find cloud discovery metadata in ${n}`)}return null}function yte(t){return tx(cN.metadata,t)}function tx(t,e){for(let n=0;n1?r.sort(s=>s.idTokenClaims?-1:1)[0]:r.length===1?r[0]:null}getBaseAccountInfo(e,n){const r=this.getAccountsFilteredBy(e,n);return r.length>0?r[0].getAccountInfo():null}buildTenantProfiles(e,n,r){return e.flatMap(i=>this.getTenantProfilesFromAccountEntity(i,n,r==null?void 0:r.tenantId,r))}getTenantedAccountInfoByFilter(e,n,r,i,s){let o=null,c;if(s&&!this.tenantProfileMatchesFilter(r,s))return null;const l=this.getIdToken(e,i,n,r.tenantId);return l&&(c=zf(l.secret,this.cryptoImpl.base64Decode),!this.idTokenClaimsMatchTenantProfileFilter(c,s))?null:(o=aN(e,r,c,l==null?void 0:l.secret),o)}getTenantProfilesFromAccountEntity(e,n,r,i){const s=e.getAccountInfo();let o=s.tenantProfiles||new Map;const c=this.getTokenKeys();if(r){const u=o.get(r);if(u)o=new Map([[r,u]]);else return[]}const l=[];return o.forEach(u=>{const d=this.getTenantedAccountInfoByFilter(s,c,u,n,i);d&&l.push(d)}),l}tenantProfileMatchesFilter(e,n){return!(n.localAccountId&&!this.matchLocalAccountIdFromTenantProfile(e,n.localAccountId)||n.name&&e.name!==n.name||n.isHomeTenant!==void 0&&e.isHomeTenant!==n.isHomeTenant)}idTokenClaimsMatchTenantProfileFilter(e,n){return!(n&&(n.localAccountId&&!this.matchLocalAccountIdFromTokenClaims(e,n.localAccountId)||n.loginHint&&!this.matchLoginHintFromTokenClaims(e,n.loginHint)||n.username&&!this.matchUsername(e.preferred_username,n.username)||n.name&&!this.matchName(e,n.name)||n.sid&&!this.matchSid(e,n.sid)))}async saveCacheRecord(e,n,r){var i;if(!e)throw Se(eU);try{e.account&&await this.setAccount(e.account,n),e.idToken&&(r==null?void 0:r.idToken)!==!1&&await this.setIdTokenCredential(e.idToken,n),e.accessToken&&(r==null?void 0:r.accessToken)!==!1&&await this.saveAccessToken(e.accessToken,n),e.refreshToken&&(r==null?void 0:r.refreshToken)!==!1&&await this.setRefreshTokenCredential(e.refreshToken,n),e.appMetadata&&this.setAppMetadata(e.appMetadata,n)}catch(s){throw(i=this.commonLogger)==null||i.error("CacheManager.saveCacheRecord: failed"),s instanceof Cn?s:sA(s)}}async saveAccessToken(e,n){const r={clientId:e.clientId,credentialType:e.credentialType,environment:e.environment,homeAccountId:e.homeAccountId,realm:e.realm,tokenType:e.tokenType,requestedClaimsHash:e.requestedClaimsHash},i=this.getTokenKeys(),s=Er.fromString(e.target);i.accessToken.forEach(o=>{if(!this.accessTokenKeyMatchesFilter(o,r,!1))return;const c=this.getAccessTokenCredential(o,n);c&&this.credentialMatchesFilter(c,r)&&Er.fromString(c.target).intersectingScopeSets(s)&&this.removeAccessToken(o,n)}),await this.setAccessTokenCredential(e,n)}getAccountsFilteredBy(e,n){const r=this.getAccountKeys(),i=[];return r.forEach(s=>{var u;const o=this.getAccount(s,n);if(!o||e.homeAccountId&&!this.matchHomeAccountId(o,e.homeAccountId)||e.username&&!this.matchUsername(o.username,e.username)||e.environment&&!this.matchEnvironment(o,e.environment)||e.realm&&!this.matchRealm(o,e.realm)||e.nativeAccountId&&!this.matchNativeAccountId(o,e.nativeAccountId)||e.authorityType&&!this.matchAuthorityType(o,e.authorityType))return;const c={localAccountId:e==null?void 0:e.localAccountId,name:e==null?void 0:e.name},l=(u=o.tenantProfiles)==null?void 0:u.filter(d=>this.tenantProfileMatchesFilter(d,c));l&&l.length===0||i.push(o)}),i}credentialMatchesFilter(e,n){return!(n.clientId&&!this.matchClientId(e,n.clientId)||n.userAssertionHash&&!this.matchUserAssertionHash(e,n.userAssertionHash)||typeof n.homeAccountId=="string"&&!this.matchHomeAccountId(e,n.homeAccountId)||n.environment&&!this.matchEnvironment(e,n.environment)||n.realm&&!this.matchRealm(e,n.realm)||n.credentialType&&!this.matchCredentialType(e,n.credentialType)||n.familyId&&!this.matchFamilyId(e,n.familyId)||n.target&&!this.matchTarget(e,n.target)||(n.requestedClaimsHash||e.requestedClaimsHash)&&e.requestedClaimsHash!==n.requestedClaimsHash||e.credentialType===Gr.ACCESS_TOKEN_WITH_AUTH_SCHEME&&(n.tokenType&&!this.matchTokenType(e,n.tokenType)||n.tokenType===yn.SSH&&n.keyId&&!this.matchKeyId(e,n.keyId)))}getAppMetadataFilteredBy(e){const n=this.getKeys(),r={};return n.forEach(i=>{if(!this.isAppMetadata(i))return;const s=this.getAppMetadata(i);s&&(e.environment&&!this.matchEnvironment(s,e.environment)||e.clientId&&!this.matchClientId(s,e.clientId)||(r[i]=s))}),r}getAuthorityMetadataByAlias(e){const n=this.getAuthorityMetadataKeys();let r=null;return n.forEach(i=>{if(!this.isAuthorityMetadata(i)||i.indexOf(this.clientId)===-1)return;const s=this.getAuthorityMetadata(i);s&&s.aliases.indexOf(e)!==-1&&(r=s)}),r}removeAllAccounts(e){this.getAllAccounts({},e).forEach(r=>{this.removeAccount(r,e)})}removeAccount(e,n){this.removeAccountContext(e,n);const r=this.getAccountKeys(),i=s=>s.includes(e.homeAccountId)&&s.includes(e.environment);r.filter(i).forEach(s=>{this.removeItem(s,n),this.performanceClient.incrementFields({accountsRemoved:1},n)})}removeAccountContext(e,n){const r=this.getTokenKeys(),i=s=>s.includes(e.homeAccountId)&&s.includes(e.environment);r.idToken.filter(i).forEach(s=>{this.removeIdToken(s,n)}),r.accessToken.filter(i).forEach(s=>{this.removeAccessToken(s,n)}),r.refreshToken.filter(i).forEach(s=>{this.removeRefreshToken(s,n)})}removeAccessToken(e,n){const r=this.getAccessTokenCredential(e,n);if(this.removeItem(e,n),this.performanceClient.incrementFields({accessTokensRemoved:1},n),!r||r.credentialType.toLowerCase()!==Gr.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()||r.tokenType!==yn.POP)return;const i=r.keyId;i&&this.cryptoImpl.removeTokenBindingKey(i).catch(()=>{var s;this.commonLogger.error(`Failed to remove token binding key ${i}`,n),(s=this.performanceClient)==null||s.incrementFields({removeTokenBindingKeyFailure:1},n)})}removeAppMetadata(e){return this.getKeys().forEach(r=>{this.isAppMetadata(r)&&this.removeItem(r,e)}),!0}getIdToken(e,n,r,i,s){this.commonLogger.trace("CacheManager - getIdToken called");const o={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:Gr.ID_TOKEN,clientId:this.clientId,realm:i},c=this.getIdTokensByFilter(o,n,r),l=c.size;if(l<1)return this.commonLogger.info("CacheManager:getIdToken - No token found"),null;if(l>1){let u=c;if(!i){const d=new Map;c.forEach((h,p)=>{h.realm===e.tenantId&&d.set(p,h)});const f=d.size;if(f<1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account but none match account entity tenant id, returning first result"),c.values().next().value;if(f===1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account, defaulting to home tenant profile"),d.values().next().value;u=d}return this.commonLogger.info("CacheManager:getIdToken - Multiple matching ID tokens found, clearing them"),u.forEach((d,f)=>{this.removeIdToken(f,n)}),s&&n&&s.addFields({multiMatchedID:c.size},n),null}return this.commonLogger.info("CacheManager:getIdToken - Returning ID token"),c.values().next().value}getIdTokensByFilter(e,n,r){const i=r&&r.idToken||this.getTokenKeys().idToken,s=new Map;return i.forEach(o=>{if(!this.idTokenKeyMatchesFilter(o,{clientId:this.clientId,...e}))return;const c=this.getIdTokenCredential(o,n);c&&this.credentialMatchesFilter(c,e)&&s.set(o,c)}),s}idTokenKeyMatchesFilter(e,n){const r=e.toLowerCase();return!(n.clientId&&r.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&r.indexOf(n.homeAccountId.toLowerCase())===-1)}removeIdToken(e,n){this.removeItem(e,n)}removeRefreshToken(e,n){this.removeItem(e,n)}getAccessToken(e,n,r,i){const s=n.correlationId;this.commonLogger.trace("CacheManager - getAccessToken called",s);const o=Er.createSearchScopes(n.scopes),c=n.authenticationScheme||yn.BEARER,l=c&&c.toLowerCase()!==yn.BEARER.toLowerCase()?Gr.ACCESS_TOKEN_WITH_AUTH_SCHEME:Gr.ACCESS_TOKEN,u={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:l,clientId:this.clientId,realm:i||e.tenantId,target:o,tokenType:c,keyId:n.sshKid,requestedClaimsHash:n.requestedClaimsHash},d=r&&r.accessToken||this.getTokenKeys().accessToken,f=[];d.forEach(p=>{if(this.accessTokenKeyMatchesFilter(p,u,!0)){const g=this.getAccessTokenCredential(p,s);g&&this.credentialMatchesFilter(g,u)&&f.push(g)}});const h=f.length;return h<1?(this.commonLogger.info("CacheManager:getAccessToken - No token found",s),null):h>1?(this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them",s),f.forEach(p=>{this.removeAccessToken(this.generateCredentialKey(p),s)}),this.performanceClient.addFields({multiMatchedAT:f.length},s),null):(this.commonLogger.info("CacheManager:getAccessToken - Returning access token",s),f[0])}accessTokenKeyMatchesFilter(e,n,r){const i=e.toLowerCase();if(n.clientId&&i.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&i.indexOf(n.homeAccountId.toLowerCase())===-1||n.realm&&i.indexOf(n.realm.toLowerCase())===-1||n.requestedClaimsHash&&i.indexOf(n.requestedClaimsHash.toLowerCase())===-1)return!1;if(n.target){const s=n.target.asArray();for(let o=0;o{if(!this.accessTokenKeyMatchesFilter(s,e,!0))return;const o=this.getAccessTokenCredential(s,n);o&&this.credentialMatchesFilter(o,e)&&i.push(o)}),i}getRefreshToken(e,n,r,i,s){this.commonLogger.trace("CacheManager - getRefreshToken called");const o=n?Qy:void 0,c={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:Gr.REFRESH_TOKEN,clientId:this.clientId,familyId:o},l=i&&i.refreshToken||this.getTokenKeys().refreshToken,u=[];l.forEach(f=>{if(this.refreshTokenKeyMatchesFilter(f,c)){const h=this.getRefreshTokenCredential(f,r);h&&this.credentialMatchesFilter(h,c)&&u.push(h)}});const d=u.length;return d<1?(this.commonLogger.info("CacheManager:getRefreshToken - No refresh token found."),null):(d>1&&s&&r&&s.addFields({multiMatchedRT:d},r),this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token"),u[0])}refreshTokenKeyMatchesFilter(e,n){const r=e.toLowerCase();return!(n.familyId&&r.indexOf(n.familyId.toLowerCase())===-1||!n.familyId&&n.clientId&&r.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&r.indexOf(n.homeAccountId.toLowerCase())===-1)}readAppMetadataFromCache(e){const n={environment:e,clientId:this.clientId},r=this.getAppMetadataFilteredBy(n),i=Object.keys(r).map(o=>r[o]),s=i.length;if(s<1)return null;if(s>1)throw Se(Q5);return i[0]}isAppMetadataFOCI(e){const n=this.readAppMetadataFromCache(e);return!!(n&&n.familyId===Qy)}matchHomeAccountId(e,n){return typeof e.homeAccountId=="string"&&n===e.homeAccountId}matchLocalAccountIdFromTokenClaims(e,n){const r=e.oid||e.sub;return n===r}matchLocalAccountIdFromTenantProfile(e,n){return e.localAccountId===n}matchName(e,n){var r;return n.toLowerCase()===((r=e.name)==null?void 0:r.toLowerCase())}matchUsername(e,n){return!!(e&&typeof e=="string"&&(n==null?void 0:n.toLowerCase())===e.toLowerCase())}matchUserAssertionHash(e,n){return!!(e.userAssertionHash&&n===e.userAssertionHash)}matchEnvironment(e,n){if(this.staticAuthorityOptions){const i=vte(this.staticAuthorityOptions,this.commonLogger);if(i.includes(n)&&i.includes(e.environment))return!0}const r=this.getAuthorityMetadataByAlias(n);return!!(r&&r.aliases.indexOf(e.environment)>-1)}matchCredentialType(e,n){return e.credentialType&&n.toLowerCase()===e.credentialType.toLowerCase()}matchClientId(e,n){return!!(e.clientId&&n===e.clientId)}matchFamilyId(e,n){return!!(e.familyId&&n===e.familyId)}matchRealm(e,n){var r;return((r=e.realm)==null?void 0:r.toLowerCase())===n.toLowerCase()}matchNativeAccountId(e,n){return!!(e.nativeAccountId&&n===e.nativeAccountId)}matchLoginHintFromTokenClaims(e,n){return e.login_hint===n||e.preferred_username===n||e.upn===n}matchSid(e,n){return e.sid===n}matchAuthorityType(e,n){return!!(e.authorityType&&n.toLowerCase()===e.authorityType.toLowerCase())}matchTarget(e,n){return e.credentialType!==Gr.ACCESS_TOKEN&&e.credentialType!==Gr.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target?!1:Er.fromString(e.target).containsScopeSet(n)}matchTokenType(e,n){return!!(e.tokenType&&e.tokenType===n)}matchKeyId(e,n){return!!(e.keyId&&e.keyId===n)}isAppMetadata(e){return e.indexOf(KE)!==-1}isAuthorityMetadata(e){return e.indexOf(Xy.CACHE_KEY)!==-1}generateAuthorityMetadataCacheKey(e){return`${Xy.CACHE_KEY}-${this.clientId}-${e}`}static toObject(e,n){for(const r in n)e[r]=n[r];return e}}class xte extends oA{async setAccount(){throw Se(Vt)}getAccount(){throw Se(Vt)}async setIdTokenCredential(){throw Se(Vt)}getIdTokenCredential(){throw Se(Vt)}async setAccessTokenCredential(){throw Se(Vt)}getAccessTokenCredential(){throw Se(Vt)}async setRefreshTokenCredential(){throw Se(Vt)}getRefreshTokenCredential(){throw Se(Vt)}setAppMetadata(){throw Se(Vt)}getAppMetadata(){throw Se(Vt)}setServerTelemetry(){throw Se(Vt)}getServerTelemetry(){throw Se(Vt)}setAuthorityMetadata(){throw Se(Vt)}getAuthorityMetadata(){throw Se(Vt)}getAuthorityMetadataKeys(){throw Se(Vt)}setThrottlingCache(){throw Se(Vt)}getThrottlingCache(){throw Se(Vt)}removeItem(){throw Se(Vt)}getKeys(){throw Se(Vt)}getAccountKeys(){throw Se(Vt)}getTokenKeys(){throw Se(Vt)}generateCredentialKey(){throw Se(Vt)}generateAccountKey(){throw Se(Vt)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Li={AAD:"AAD",OIDC:"OIDC",EAR:"EAR"};/*! @azure/msal-common v15.10.0 2025-08-05 */const K={AcquireTokenByCode:"acquireTokenByCode",AcquireTokenByRefreshToken:"acquireTokenByRefreshToken",AcquireTokenSilent:"acquireTokenSilent",AcquireTokenSilentAsync:"acquireTokenSilentAsync",AcquireTokenPopup:"acquireTokenPopup",AcquireTokenPreRedirect:"acquireTokenPreRedirect",AcquireTokenRedirect:"acquireTokenRedirect",CryptoOptsGetPublicKeyThumbprint:"cryptoOptsGetPublicKeyThumbprint",CryptoOptsSignJwt:"cryptoOptsSignJwt",SilentCacheClientAcquireToken:"silentCacheClientAcquireToken",SilentIframeClientAcquireToken:"silentIframeClientAcquireToken",AwaitConcurrentIframe:"awaitConcurrentIframe",SilentRefreshClientAcquireToken:"silentRefreshClientAcquireToken",SsoSilent:"ssoSilent",StandardInteractionClientGetDiscoveredAuthority:"standardInteractionClientGetDiscoveredAuthority",FetchAccountIdWithNativeBroker:"fetchAccountIdWithNativeBroker",NativeInteractionClientAcquireToken:"nativeInteractionClientAcquireToken",BaseClientCreateTokenRequestHeaders:"baseClientCreateTokenRequestHeaders",NetworkClientSendPostRequestAsync:"networkClientSendPostRequestAsync",RefreshTokenClientExecutePostToTokenEndpoint:"refreshTokenClientExecutePostToTokenEndpoint",AuthorizationCodeClientExecutePostToTokenEndpoint:"authorizationCodeClientExecutePostToTokenEndpoint",BrokerHandhshake:"brokerHandshake",AcquireTokenByRefreshTokenInBroker:"acquireTokenByRefreshTokenInBroker",AcquireTokenByBroker:"acquireTokenByBroker",RefreshTokenClientExecuteTokenRequest:"refreshTokenClientExecuteTokenRequest",RefreshTokenClientAcquireToken:"refreshTokenClientAcquireToken",RefreshTokenClientAcquireTokenWithCachedRefreshToken:"refreshTokenClientAcquireTokenWithCachedRefreshToken",RefreshTokenClientAcquireTokenByRefreshToken:"refreshTokenClientAcquireTokenByRefreshToken",RefreshTokenClientCreateTokenRequestBody:"refreshTokenClientCreateTokenRequestBody",AcquireTokenFromCache:"acquireTokenFromCache",SilentFlowClientAcquireCachedToken:"silentFlowClientAcquireCachedToken",SilentFlowClientGenerateResultFromCacheRecord:"silentFlowClientGenerateResultFromCacheRecord",AcquireTokenBySilentIframe:"acquireTokenBySilentIframe",InitializeBaseRequest:"initializeBaseRequest",InitializeSilentRequest:"initializeSilentRequest",InitializeClientApplication:"initializeClientApplication",InitializeCache:"initializeCache",SilentIframeClientTokenHelper:"silentIframeClientTokenHelper",SilentHandlerInitiateAuthRequest:"silentHandlerInitiateAuthRequest",SilentHandlerMonitorIframeForHash:"silentHandlerMonitorIframeForHash",SilentHandlerLoadFrame:"silentHandlerLoadFrame",SilentHandlerLoadFrameSync:"silentHandlerLoadFrameSync",StandardInteractionClientCreateAuthCodeClient:"standardInteractionClientCreateAuthCodeClient",StandardInteractionClientGetClientConfiguration:"standardInteractionClientGetClientConfiguration",StandardInteractionClientInitializeAuthorizationRequest:"standardInteractionClientInitializeAuthorizationRequest",GetAuthCodeUrl:"getAuthCodeUrl",GetStandardParams:"getStandardParams",HandleCodeResponseFromServer:"handleCodeResponseFromServer",HandleCodeResponse:"handleCodeResponse",HandleResponseEar:"handleResponseEar",HandleResponsePlatformBroker:"handleResponsePlatformBroker",HandleResponseCode:"handleResponseCode",UpdateTokenEndpointAuthority:"updateTokenEndpointAuthority",AuthClientAcquireToken:"authClientAcquireToken",AuthClientExecuteTokenRequest:"authClientExecuteTokenRequest",AuthClientCreateTokenRequestBody:"authClientCreateTokenRequestBody",PopTokenGenerateCnf:"popTokenGenerateCnf",PopTokenGenerateKid:"popTokenGenerateKid",HandleServerTokenResponse:"handleServerTokenResponse",DeserializeResponse:"deserializeResponse",AuthorityFactoryCreateDiscoveredInstance:"authorityFactoryCreateDiscoveredInstance",AuthorityResolveEndpointsAsync:"authorityResolveEndpointsAsync",AuthorityResolveEndpointsFromLocalSources:"authorityResolveEndpointsFromLocalSources",AuthorityGetCloudDiscoveryMetadataFromNetwork:"authorityGetCloudDiscoveryMetadataFromNetwork",AuthorityUpdateCloudDiscoveryMetadata:"authorityUpdateCloudDiscoveryMetadata",AuthorityGetEndpointMetadataFromNetwork:"authorityGetEndpointMetadataFromNetwork",AuthorityUpdateEndpointMetadata:"authorityUpdateEndpointMetadata",AuthorityUpdateMetadataWithRegionalInformation:"authorityUpdateMetadataWithRegionalInformation",RegionDiscoveryDetectRegion:"regionDiscoveryDetectRegion",RegionDiscoveryGetRegionFromIMDS:"regionDiscoveryGetRegionFromIMDS",RegionDiscoveryGetCurrentVersion:"regionDiscoveryGetCurrentVersion",AcquireTokenByCodeAsync:"acquireTokenByCodeAsync",GetEndpointMetadataFromNetwork:"getEndpointMetadataFromNetwork",GetCloudDiscoveryMetadataFromNetworkMeasurement:"getCloudDiscoveryMetadataFromNetworkMeasurement",HandleRedirectPromiseMeasurement:"handleRedirectPromise",HandleNativeRedirectPromiseMeasurement:"handleNativeRedirectPromise",UpdateCloudDiscoveryMetadataMeasurement:"updateCloudDiscoveryMetadataMeasurement",UsernamePasswordClientAcquireToken:"usernamePasswordClientAcquireToken",NativeMessageHandlerHandshake:"nativeMessageHandlerHandshake",NativeGenerateAuthResult:"nativeGenerateAuthResult",RemoveHiddenIframe:"removeHiddenIframe",ClearTokensAndKeysWithClaims:"clearTokensAndKeysWithClaims",CacheManagerGetRefreshToken:"cacheManagerGetRefreshToken",ImportExistingCache:"importExistingCache",SetUserData:"setUserData",LocalStorageUpdated:"localStorageUpdated",GeneratePkceCodes:"generatePkceCodes",GenerateCodeVerifier:"generateCodeVerifier",GenerateCodeChallengeFromVerifier:"generateCodeChallengeFromVerifier",Sha256Digest:"sha256Digest",GetRandomValues:"getRandomValues",GenerateHKDF:"generateHKDF",GenerateBaseKey:"generateBaseKey",Base64Decode:"base64Decode",UrlEncodeArr:"urlEncodeArr",Encrypt:"encrypt",Decrypt:"decrypt",GenerateEarKey:"generateEarKey",DecryptEarResponse:"decryptEarResponse"},bte={NotStarted:0,InProgress:1,Completed:2};/*! @azure/msal-common v15.10.0 2025-08-05 */class CI{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class _U{generateId(){return"callback-id"}startMeasurement(e,n){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:bte.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:n||""},measurement:new CI}}startPerformanceMeasurement(){return new CI}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}/*! @azure/msal-common v15.10.0 2025-08-05 */const AU={tokenRenewalOffsetSeconds:B5,preventCorsPreflight:!1},wte={loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:Rn.Info,correlationId:pe.EMPTY_STRING},Ste={claimsBasedCachingEnabled:!1},Cte={async sendGetRequestAsync(){throw Se(Vt)},async sendPostRequestAsync(){throw Se(Vt)}},_te={sku:pe.SKU,version:eN,cpu:pe.EMPTY_STRING,os:pe.EMPTY_STRING},Ate={clientSecret:pe.EMPTY_STRING,clientAssertion:void 0},jte={azureCloudInstance:tN.None,tenant:`${pe.DEFAULT_COMMON_TENANT}`},Ete={application:{appName:"",appVersion:""}};function Nte({authOptions:t,systemOptions:e,loggerOptions:n,cacheOptions:r,storageInterface:i,networkInterface:s,cryptoInterface:o,clientCredentials:c,libraryInfo:l,telemetry:u,serverTelemetryManager:d,persistencePlugin:f,serializableCache:h}){const p={...wte,...n};return{authOptions:Tte(t),systemOptions:{...AU,...e},loggerOptions:p,cacheOptions:{...Ste,...r},storageInterface:i||new xte(t.clientId,Zy,new $a(p),new _U),networkInterface:s||Cte,cryptoInterface:o||Zy,clientCredentials:c||Ate,libraryInfo:{..._te,...l},telemetry:{...Ete,...u},serverTelemetryManager:d||null,persistencePlugin:f||null,serializableCache:h||null}}function Tte(t){return{clientCapabilities:[],azureCloudOptions:jte,skipAuthorityMetadataCache:!1,instanceAware:!1,encodeExtraQueryParams:!1,...t}}function jU(t){return t.authOptions.authority.options.protocolMode===Li.OIDC}/*! @azure/msal-common v15.10.0 2025-08-05 */const Ys={HOME_ACCOUNT_ID:"home_account_id",UPN:"UPN"};/*! @azure/msal-common v15.10.0 2025-08-05 */function rx(t,e){if(!t)throw Se(H5);try{const n=e(t);return JSON.parse(n)}catch{throw Se(WE)}}function _d(t){if(!t)throw Se(WE);const e=t.split(Jp.CLIENT_INFO_SEPARATOR,2);return{uid:e[0],utid:e.length<2?pe.EMPTY_STRING:e[1]}}/*! @azure/msal-common v15.10.0 2025-08-05 */const mu="client_id",EU="redirect_uri",Pte="response_type",kte="response_mode",Ote="grant_type",Ite="claims",Rte="scope",Mte="refresh_token",Dte="state",$te="nonce",Lte="prompt",Fte="code",Ute="code_challenge",Bte="code_challenge_method",Hte="code_verifier",zte="client-request-id",Vte="x-client-SKU",Gte="x-client-VER",Kte="x-client-OS",Wte="x-client-CPU",qte="x-client-current-telemetry",Yte="x-client-last-telemetry",Qte="x-ms-lib-capability",Xte="x-app-name",Jte="x-app-ver",Zte="post_logout_redirect_uri",ene="id_token_hint",tne="client_secret",nne="client_assertion",rne="client_assertion_type",NU="token_type",TU="req_cnf",_I="return_spa_code",ine="nativebroker",sne="logout_hint",one="sid",ane="login_hint",cne="domain_hint",lne="x-client-xtra-sku",ix="brk_client_id",sx="brk_redirect_uri",aA="instance_aware",une="ear_jwk",dne="ear_jwe_crypto";/*! @azure/msal-common v15.10.0 2025-08-05 */function E0(t,e,n){if(!e)return;const r=t.get(mu);r&&t.has(ix)&&(n==null||n.addFields({embeddedClientId:r,embeddedRedirectUri:t.get(EU)},e))}function uN(t,e){t.set(Pte,e)}function fne(t,e){t.set(kte,e||qee.QUERY)}function hne(t){t.set(ine,"1")}function dN(t,e,n=!0,r=xg){n&&!r.includes("openid")&&!e.includes("openid")&&r.push("openid");const i=n?[...e||[],...r]:e||[],s=new Er(i);t.set(Rte,s.printScopes())}function fN(t,e){t.set(mu,e)}function hN(t,e){t.set(EU,e)}function pne(t,e){t.set(Zte,e)}function mne(t,e){t.set(ene,e)}function gne(t,e){t.set(cne,e)}function hv(t,e){t.set(ane,e)}function ox(t,e){t.set(hi.CCS_HEADER,`UPN:${e}`)}function up(t,e){t.set(hi.CCS_HEADER,`Oid:${e.uid}@${e.utid}`)}function AI(t,e){t.set(one,e)}function pN(t,e,n){const r=Sne(e,n);try{JSON.parse(r)}catch{throw An(nN)}t.set(Ite,r)}function mN(t,e){t.set(zte,e)}function gN(t,e){t.set(Vte,e.sku),t.set(Gte,e.version),e.os&&t.set(Kte,e.os),e.cpu&&t.set(Wte,e.cpu)}function vN(t,e){e!=null&&e.appName&&t.set(Xte,e.appName),e!=null&&e.appVersion&&t.set(Jte,e.appVersion)}function vne(t,e){t.set(Lte,e)}function PU(t,e){e&&t.set(Dte,e)}function yne(t,e){t.set($te,e)}function kU(t,e,n){if(e&&n)t.set(Ute,e),t.set(Bte,n);else throw An(rN)}function xne(t,e){t.set(Fte,e)}function bne(t,e){t.set(Mte,e)}function wne(t,e){t.set(Hte,e)}function OU(t,e){t.set(tne,e)}function IU(t,e){e&&t.set(nne,e)}function RU(t,e){e&&t.set(rne,e)}function MU(t,e){t.set(Ote,e)}function yN(t){t.set(Yee,"1")}function DU(t){t.has(aA)||t.set(aA,"true")}function Dc(t,e){Object.entries(e).forEach(([n,r])=>{!t.has(n)&&r&&t.set(n,r)})}function Sne(t,e){let n;if(!t)n={};else try{n=JSON.parse(t)}catch{throw An(nN)}return e&&e.length>0&&(n.hasOwnProperty(dv.ACCESS_TOKEN)||(n[dv.ACCESS_TOKEN]={}),n[dv.ACCESS_TOKEN][dv.XMS_CC]={values:e}),JSON.stringify(n)}function xN(t,e){e&&(t.set(NU,yn.POP),t.set(TU,e))}function $U(t,e){e&&(t.set(NU,yn.SSH),t.set(TU,e))}function LU(t,e){t.set(qte,e.generateCurrentRequestHeaderValue()),t.set(Yte,e.generateLastRequestHeaderValue())}function FU(t){t.set(Qte,lp.X_MS_LIB_CAPABILITY_VALUE)}function Cne(t,e){t.set(sne,e)}function N0(t,e,n){t.has(ix)||t.set(ix,e),t.has(sx)||t.set(sx,n)}function _ne(t,e){t.set(une,encodeURIComponent(e)),t.set(dne,"eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0")}function Ane(t,e){Object.entries(e).forEach(([n,r])=>{r&&t.set(n,r)})}/*! @azure/msal-common v15.10.0 2025-08-05 */const zs={Default:0,Adfs:1,Dsts:2,Ciam:3};/*! @azure/msal-common v15.10.0 2025-08-05 */function jne(t){return t.hasOwnProperty("authorization_endpoint")&&t.hasOwnProperty("token_endpoint")&&t.hasOwnProperty("issuer")&&t.hasOwnProperty("jwks_uri")}/*! @azure/msal-common v15.10.0 2025-08-05 */function Ene(t){return t.hasOwnProperty("tenant_discovery_endpoint")&&t.hasOwnProperty("metadata")}/*! @azure/msal-common v15.10.0 2025-08-05 */function Nne(t){return t.hasOwnProperty("error")&&t.hasOwnProperty("error_description")}/*! @azure/msal-common v15.10.0 2025-08-05 */const ts=(t,e,n,r,i)=>(...s)=>{n.trace(`Executing function ${e}`);const o=r==null?void 0:r.startMeasurement(e,i);if(i){const c=e+"CallCount";r==null||r.incrementFields({[c]:1},i)}try{const c=t(...s);return o==null||o.end({success:!0}),n.trace(`Returning result from ${e}`),c}catch(c){n.trace(`Error occurred in ${e}`);try{n.trace(JSON.stringify(c))}catch{n.trace("Unable to print error message.")}throw o==null||o.end({success:!1},c),c}},fe=(t,e,n,r,i)=>(...s)=>{n.trace(`Executing function ${e}`);const o=r==null?void 0:r.startMeasurement(e,i);if(i){const c=e+"CallCount";r==null||r.incrementFields({[c]:1},i)}return r==null||r.setPreQueueTime(e,i),t(...s).then(c=>(n.trace(`Returning result from ${e}`),o==null||o.end({success:!0}),c)).catch(c=>{n.trace(`Error occurred in ${e}`);try{n.trace(JSON.stringify(c))}catch{n.trace("Unable to print error message.")}throw o==null||o.end({success:!1},c),c})};/*! @azure/msal-common v15.10.0 2025-08-05 */class T0{constructor(e,n,r,i){this.networkInterface=e,this.logger=n,this.performanceClient=r,this.correlationId=i}async detectRegion(e,n){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.RegionDiscoveryDetectRegion,this.correlationId);let r=e;if(r)n.region_source=Fu.ENVIRONMENT_VARIABLE;else{const s=T0.IMDS_OPTIONS;try{const o=await fe(this.getRegionFromIMDS.bind(this),K.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(pe.IMDS_VERSION,s);if(o.status===Sc.SUCCESS&&(r=o.body,n.region_source=Fu.IMDS),o.status===Sc.BAD_REQUEST){const c=await fe(this.getCurrentVersion.bind(this),K.RegionDiscoveryGetCurrentVersion,this.logger,this.performanceClient,this.correlationId)(s);if(!c)return n.region_source=Fu.FAILED_AUTO_DETECTION,null;const l=await fe(this.getRegionFromIMDS.bind(this),K.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(c,s);l.status===Sc.SUCCESS&&(r=l.body,n.region_source=Fu.IMDS)}}catch{return n.region_source=Fu.FAILED_AUTO_DETECTION,null}}return r||(n.region_source=Fu.FAILED_AUTO_DETECTION),r||null}async getRegionFromIMDS(e,n){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(K.RegionDiscoveryGetRegionFromIMDS,this.correlationId),this.networkInterface.sendGetRequestAsync(`${pe.IMDS_ENDPOINT}?api-version=${e}&format=text`,n,pe.IMDS_TIMEOUT)}async getCurrentVersion(e){var n;(n=this.performanceClient)==null||n.addQueueMeasurement(K.RegionDiscoveryGetCurrentVersion,this.correlationId);try{const r=await this.networkInterface.sendGetRequestAsync(`${pe.IMDS_ENDPOINT}?format=json`,e);return r.status===Sc.BAD_REQUEST&&r.body&&r.body["newest-versions"]&&r.body["newest-versions"].length>0?r.body["newest-versions"][0]:null}catch{return null}}}T0.IMDS_OPTIONS={headers:{Metadata:"true"}};/*! @azure/msal-common v15.10.0 2025-08-05 */function Fi(){return Math.round(new Date().getTime()/1e3)}function jI(t){return t.getTime()/1e3}function Ad(t){return t?new Date(Number(t)*1e3):new Date}function ax(t,e){const n=Number(t)||0;return Fi()+e>n}function Tne(t,e){const n=Number(t)+e*24*60*60*1e3;return Date.now()>n}function Pne(t){return Number(t)>Fi()}/*! @azure/msal-common v15.10.0 2025-08-05 */function P0(t,e,n,r,i){return{credentialType:Gr.ID_TOKEN,homeAccountId:t,environment:e,clientId:r,secret:n,realm:i,lastUpdatedAt:Date.now().toString()}}function k0(t,e,n,r,i,s,o,c,l,u,d,f,h,p,g){var v,b;const m={homeAccountId:t,credentialType:Gr.ACCESS_TOKEN,secret:n,cachedAt:Fi().toString(),expiresOn:o.toString(),extendedExpiresOn:c.toString(),environment:e,clientId:r,realm:i,target:s,tokenType:d||yn.BEARER,lastUpdatedAt:Date.now().toString()};if(f&&(m.userAssertionHash=f),u&&(m.refreshOn=u.toString()),p&&(m.requestedClaims=p,m.requestedClaimsHash=g),((v=m.tokenType)==null?void 0:v.toLowerCase())!==yn.BEARER.toLowerCase())switch(m.credentialType=Gr.ACCESS_TOKEN_WITH_AUTH_SCHEME,m.tokenType){case yn.POP:const x=zf(n,l);if(!((b=x==null?void 0:x.cnf)!=null&&b.kid))throw Se(tU);m.keyId=x.cnf.kid;break;case yn.SSH:m.keyId=h}return m}function UU(t,e,n,r,i,s,o){const c={credentialType:Gr.REFRESH_TOKEN,homeAccountId:t,environment:e,clientId:r,secret:n,lastUpdatedAt:Date.now().toString()};return s&&(c.userAssertionHash=s),i&&(c.familyId=i),o&&(c.expiresOn=o.toString()),c}function bN(t){return t.hasOwnProperty("homeAccountId")&&t.hasOwnProperty("environment")&&t.hasOwnProperty("credentialType")&&t.hasOwnProperty("clientId")&&t.hasOwnProperty("secret")}function EI(t){return t?bN(t)&&t.hasOwnProperty("realm")&&t.hasOwnProperty("target")&&(t.credentialType===Gr.ACCESS_TOKEN||t.credentialType===Gr.ACCESS_TOKEN_WITH_AUTH_SCHEME):!1}function kne(t){return t?bN(t)&&t.hasOwnProperty("realm")&&t.credentialType===Gr.ID_TOKEN:!1}function NI(t){return t?bN(t)&&t.credentialType===Gr.REFRESH_TOKEN:!1}function One(t,e){const n=t.indexOf(Br.CACHE_KEY)===0;let r=!0;return e&&(r=e.hasOwnProperty("failedRequests")&&e.hasOwnProperty("errors")&&e.hasOwnProperty("cacheHits")),n&&r}function Ine(t,e){let n=!1;t&&(n=t.indexOf(lp.THROTTLING_PREFIX)===0);let r=!0;return e&&(r=e.hasOwnProperty("throttleTime")),n&&r}function Rne({environment:t,clientId:e}){return[KE,t,e].join(Jp.CACHE_KEY_SEPARATOR).toLowerCase()}function Mne(t,e){return e?t.indexOf(KE)===0&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("environment"):!1}function Dne(t,e){return e?t.indexOf(Xy.CACHE_KEY)===0&&e.hasOwnProperty("aliases")&&e.hasOwnProperty("preferred_cache")&&e.hasOwnProperty("preferred_network")&&e.hasOwnProperty("canonical_authority")&&e.hasOwnProperty("authorization_endpoint")&&e.hasOwnProperty("token_endpoint")&&e.hasOwnProperty("issuer")&&e.hasOwnProperty("aliasesFromNetwork")&&e.hasOwnProperty("endpointsFromNetwork")&&e.hasOwnProperty("expiresAt")&&e.hasOwnProperty("jwks_uri"):!1}function TI(){return Fi()+Xy.REFRESH_TIME_SECONDS}function pv(t,e,n){t.authorization_endpoint=e.authorization_endpoint,t.token_endpoint=e.token_endpoint,t.end_session_endpoint=e.end_session_endpoint,t.issuer=e.issuer,t.endpointsFromNetwork=n,t.jwks_uri=e.jwks_uri}function US(t,e,n){t.aliases=e.aliases,t.preferred_cache=e.preferred_cache,t.preferred_network=e.preferred_network,t.aliasesFromNetwork=n}function PI(t){return t.expiresAt<=Fi()}/*! @azure/msal-common v15.10.0 2025-08-05 */class ti{constructor(e,n,r,i,s,o,c,l){this.canonicalAuthority=e,this._canonicalAuthority.validateAsUri(),this.networkInterface=n,this.cacheManager=r,this.authorityOptions=i,this.regionDiscoveryMetadata={region_used:void 0,region_source:void 0,region_outcome:void 0},this.logger=s,this.performanceClient=c,this.correlationId=o,this.managedIdentity=l||!1,this.regionDiscovery=new T0(n,this.logger,this.performanceClient,this.correlationId)}getAuthorityType(e){if(e.HostNameAndPort.endsWith(pe.CIAM_AUTH_URL))return zs.Ciam;const n=e.PathSegments;if(n.length)switch(n[0].toLowerCase()){case pe.ADFS:return zs.Adfs;case pe.DSTS:return zs.Dsts}return zs.Default}get authorityType(){return this.getAuthorityType(this.canonicalAuthorityUrlComponents)}get protocolMode(){return this.authorityOptions.protocolMode}get options(){return this.authorityOptions}get canonicalAuthority(){return this._canonicalAuthority.urlString}set canonicalAuthority(e){this._canonicalAuthority=new en(e),this._canonicalAuthority.validateAsUri(),this._canonicalAuthorityUrlComponents=null}get canonicalAuthorityUrlComponents(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents}get hostnameAndPort(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()}get tenant(){return this.canonicalAuthorityUrlComponents.PathSegments[0]}get authorizationEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.authorization_endpoint);throw Se(fa)}get tokenEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw Se(fa)}get deviceCodeEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));throw Se(fa)}get endSessionEndpoint(){if(this.discoveryComplete()){if(!this.metadata.end_session_endpoint)throw Se(iU);return this.replacePath(this.metadata.end_session_endpoint)}else throw Se(fa)}get selfSignedJwtAudience(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw Se(fa)}get jwksUri(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw Se(fa)}canReplaceTenant(e){return e.PathSegments.length===1&&!ti.reservedTenantDomains.has(e.PathSegments[0])&&this.getAuthorityType(e)===zs.Default&&this.protocolMode!==Li.OIDC}replaceTenant(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)}replacePath(e){let n=e;const i=new en(this.metadata.canonical_authority).getUrlComponents(),s=i.PathSegments;return this.canonicalAuthorityUrlComponents.PathSegments.forEach((c,l)=>{let u=s[l];if(l===0&&this.canReplaceTenant(i)){const d=new en(this.metadata.authorization_endpoint).getUrlComponents().PathSegments[0];u!==d&&(this.logger.verbose(`Replacing tenant domain name ${u} with id ${d}`),u=d)}c!==u&&(n=n.replace(`/${u}/`,`/${c}/`))}),this.replaceTenant(n)}get defaultOpenIdConfigurationEndpoint(){const e=this.hostnameAndPort;return this.canonicalAuthority.endsWith("v2.0/")||this.authorityType===zs.Adfs||this.protocolMode===Li.OIDC&&!this.isAliasOfKnownMicrosoftAuthority(e)?`${this.canonicalAuthority}.well-known/openid-configuration`:`${this.canonicalAuthority}v2.0/.well-known/openid-configuration`}discoveryComplete(){return!!this.metadata}async resolveEndpointsAsync(){var i,s;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityResolveEndpointsAsync,this.correlationId);const e=this.getCurrentMetadataEntity(),n=await fe(this.updateCloudDiscoveryMetadata.bind(this),K.AuthorityUpdateCloudDiscoveryMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,e.preferred_network);const r=await fe(this.updateEndpointMetadata.bind(this),K.AuthorityUpdateEndpointMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.updateCachedMetadata(e,n,{source:r}),(s=this.performanceClient)==null||s.addFields({cloudDiscoverySource:n,authorityEndpointSource:r},this.correlationId)}getCurrentMetadataEntity(){let e=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);return e||(e={aliases:[],preferred_cache:this.hostnameAndPort,preferred_network:this.hostnameAndPort,canonical_authority:this.canonicalAuthority,authorization_endpoint:"",token_endpoint:"",end_session_endpoint:"",issuer:"",aliasesFromNetwork:!1,endpointsFromNetwork:!1,expiresAt:TI(),jwks_uri:""}),e}updateCachedMetadata(e,n,r){n!==zi.CACHE&&(r==null?void 0:r.source)!==zi.CACHE&&(e.expiresAt=TI(),e.canonical_authority=this.canonicalAuthority);const i=this.cacheManager.generateAuthorityMetadataCacheKey(e.preferred_cache);this.cacheManager.setAuthorityMetadata(i,e),this.metadata=e}async updateEndpointMetadata(e){var i,s,o;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityUpdateEndpointMetadata,this.correlationId);const n=this.updateEndpointMetadataFromLocalSources(e);if(n){if(n.source===zi.HARDCODED_VALUES&&(s=this.authorityOptions.azureRegionConfiguration)!=null&&s.azureRegion&&n.metadata){const c=await fe(this.updateMetadataWithRegionalInformation.bind(this),K.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(n.metadata);pv(e,c,!1),e.canonical_authority=this.canonicalAuthority}return n.source}let r=await fe(this.getEndpointMetadataFromNetwork.bind(this),K.AuthorityGetEndpointMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return(o=this.authorityOptions.azureRegionConfiguration)!=null&&o.azureRegion&&(r=await fe(this.updateMetadataWithRegionalInformation.bind(this),K.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(r)),pv(e,r,!0),zi.NETWORK;throw Se(G5,this.defaultOpenIdConfigurationEndpoint)}updateEndpointMetadataFromLocalSources(e){this.logger.verbose("Attempting to get endpoint metadata from authority configuration");const n=this.getEndpointMetadataFromConfig();if(n)return this.logger.verbose("Found endpoint metadata in authority configuration"),pv(e,n,!1),{source:zi.CONFIG};if(this.logger.verbose("Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values."),this.authorityOptions.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get endpoint metadata from the network metadata cache.");else{const i=this.getEndpointMetadataFromHardcodedValues();if(i)return pv(e,i,!1),{source:zi.HARDCODED_VALUES,metadata:i};this.logger.verbose("Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache.")}const r=PI(e);return this.isAuthoritySameType(e)&&e.endpointsFromNetwork&&!r?(this.logger.verbose("Found endpoint metadata in the cache."),{source:zi.CACHE}):(r&&this.logger.verbose("The metadata entity is expired."),null)}isAuthoritySameType(e){return new en(e.canonical_authority).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length}getEndpointMetadataFromConfig(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch{throw An(fU)}return null}async getEndpointMetadataFromNetwork(){var r;(r=this.performanceClient)==null||r.addQueueMeasurement(K.AuthorityGetEndpointMetadataFromNetwork,this.correlationId);const e={},n=this.defaultOpenIdConfigurationEndpoint;this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from ${n}`);try{const i=await this.networkInterface.sendGetRequestAsync(n,e);return jne(i.body)?i.body:(this.logger.verbose("Authority.getEndpointMetadataFromNetwork: could not parse response as OpenID configuration"),null)}catch(i){return this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: ${i}`),null}}getEndpointMetadataFromHardcodedValues(){return this.hostnameAndPort in wI?wI[this.hostnameAndPort]:null}async updateMetadataWithRegionalInformation(e){var r,i,s;(r=this.performanceClient)==null||r.addQueueMeasurement(K.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId);const n=(i=this.authorityOptions.azureRegionConfiguration)==null?void 0:i.azureRegion;if(n){if(n!==pe.AZURE_REGION_AUTO_DISCOVER_FLAG)return this.regionDiscoveryMetadata.region_outcome=LS.CONFIGURED_NO_AUTO_DETECTION,this.regionDiscoveryMetadata.region_used=n,ti.replaceWithRegionalInformation(e,n);const o=await fe(this.regionDiscovery.detectRegion.bind(this.regionDiscovery),K.RegionDiscoveryDetectRegion,this.logger,this.performanceClient,this.correlationId)((s=this.authorityOptions.azureRegionConfiguration)==null?void 0:s.environmentRegion,this.regionDiscoveryMetadata);if(o)return this.regionDiscoveryMetadata.region_outcome=LS.AUTO_DETECTION_REQUESTED_SUCCESSFUL,this.regionDiscoveryMetadata.region_used=o,ti.replaceWithRegionalInformation(e,o);this.regionDiscoveryMetadata.region_outcome=LS.AUTO_DETECTION_REQUESTED_FAILED}return e}async updateCloudDiscoveryMetadata(e){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId);const n=this.updateCloudDiscoveryMetadataFromLocalSources(e);if(n)return n;const r=await fe(this.getCloudDiscoveryMetadataFromNetwork.bind(this),K.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return US(e,r,!0),zi.NETWORK;throw An(hU)}updateCloudDiscoveryMetadataFromLocalSources(e){this.logger.verbose("Attempting to get cloud discovery metadata from authority configuration"),this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities||pe.NOT_APPLICABLE}`),this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata||pe.NOT_APPLICABLE}`),this.logger.verbosePii(`Canonical Authority: ${e.canonical_authority||pe.NOT_APPLICABLE}`);const n=this.getCloudDiscoveryMetadataFromConfig();if(n)return this.logger.verbose("Found cloud discovery metadata in authority configuration"),US(e,n,!1),zi.CONFIG;if(this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values."),this.options.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded cloud discovery metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get cloud discovery metadata from the network metadata cache.");else{const i=yte(this.hostnameAndPort);if(i)return this.logger.verbose("Found cloud discovery metadata from hardcoded values."),US(e,i,!1),zi.HARDCODED_VALUES;this.logger.verbose("Did not find cloud discovery metadata in hardcoded values... Attempting to get cloud discovery metadata from the network metadata cache.")}const r=PI(e);return this.isAuthoritySameType(e)&&e.aliasesFromNetwork&&!r?(this.logger.verbose("Found cloud discovery metadata in the cache."),zi.CACHE):(r&&this.logger.verbose("The metadata entity is expired."),null)}getCloudDiscoveryMetadataFromConfig(){if(this.authorityType===zs.Ciam)return this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host."),ti.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);if(this.authorityOptions.cloudDiscoveryMetadata){this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");try{this.logger.verbose("Attempting to parse the cloud discovery metadata.");const e=JSON.parse(this.authorityOptions.cloudDiscoveryMetadata),n=tx(e.metadata,this.hostnameAndPort);if(this.logger.verbose("Parsed the cloud discovery metadata."),n)return this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata."),n;this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.")}catch{throw this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error."),An(iN)}}return this.isInKnownAuthorities()?(this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host."),ti.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null}async getCloudDiscoveryMetadataFromNetwork(){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId);const e=`${pe.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`,n={};let r=null;try{const s=await this.networkInterface.sendGetRequestAsync(e,n);let o,c;if(Ene(s.body))o=s.body,c=o.metadata,this.logger.verbosePii(`tenant_discovery_endpoint is: ${o.tenant_discovery_endpoint}`);else if(Nne(s.body)){if(this.logger.warning(`A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: ${s.status}`),o=s.body,o.error===pe.INVALID_INSTANCE)return this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance."),null;this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error is ${o.error}`),this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error description is ${o.error_description}`),this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []"),c=[]}else return this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse"),null;this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request."),r=tx(c,this.hostnameAndPort)}catch(s){if(s instanceof Cn)this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata. +Error: ${s.errorCode} +Error Description: ${s.errorMessage}`);else{const o=s;this.logger.error(`A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata. +Error: ${o.name} +Error Description: ${o.message}`)}return null}return r||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),r=ti.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),r}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter(n=>n&&en.getDomainFromUrl(n).toLowerCase()===this.hostnameAndPort).length>0}static generateAuthority(e,n){let r;if(n&&n.azureCloudInstance!==tN.None){const i=n.tenant?n.tenant:pe.DEFAULT_COMMON_TENANT;r=`${n.azureCloudInstance}/${i}/`}return r||e}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}getPreferredCache(){if(this.managedIdentity)return pe.DEFAULT_AUTHORITY_HOST;if(this.discoveryComplete())return this.metadata.preferred_cache;throw Se(fa)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return CU.has(e)}static isPublicCloudAuthority(e){return pe.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,n,r){const i=new en(e);i.validateAsUri();const s=i.getUrlComponents();let o=`${n}.${s.HostNameAndPort}`;this.isPublicCloudAuthority(s.HostNameAndPort)&&(o=`${n}.${pe.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const c=en.constructAuthorityUriFromObject({...i.getUrlComponents(),HostNameAndPort:o}).urlString;return r?`${c}?${r}`:c}static replaceWithRegionalInformation(e,n){const r={...e};return r.authorization_endpoint=ti.buildRegionalAuthorityString(r.authorization_endpoint,n),r.token_endpoint=ti.buildRegionalAuthorityString(r.token_endpoint,n),r.end_session_endpoint&&(r.end_session_endpoint=ti.buildRegionalAuthorityString(r.end_session_endpoint,n)),r}static transformCIAMAuthority(e){let n=e;const i=new en(e).getUrlComponents();if(i.PathSegments.length===0&&i.HostNameAndPort.endsWith(pe.CIAM_AUTH_URL)){const s=i.HostNameAndPort.split(".")[0];n=`${n}${s}${pe.AAD_TENANT_DOMAIN_SUFFIX}`}return n}}ti.reservedTenantDomains=new Set(["{tenant}","{tenantid}",Rc.COMMON,Rc.CONSUMERS,Rc.ORGANIZATIONS]);function $ne(t){var i;const r=(i=new en(t).getUrlComponents().PathSegments.slice(-1)[0])==null?void 0:i.toLowerCase();switch(r){case Rc.COMMON:case Rc.ORGANIZATIONS:case Rc.CONSUMERS:return;default:return r}}function BU(t){return t.endsWith(pe.FORWARD_SLASH)?t:`${t}${pe.FORWARD_SLASH}`}function Lne(t){const e=t.cloudDiscoveryMetadata;let n;if(e)try{n=JSON.parse(e)}catch{throw An(iN)}return{canonicalAuthority:t.authority?BU(t.authority):void 0,knownAuthorities:t.knownAuthorities,cloudDiscoveryMetadata:n}}/*! @azure/msal-common v15.10.0 2025-08-05 */async function HU(t,e,n,r,i,s,o){o==null||o.addQueueMeasurement(K.AuthorityFactoryCreateDiscoveredInstance,s);const c=ti.transformCIAMAuthority(BU(t)),l=new ti(c,e,n,r,i,s,o);try{return await fe(l.resolveEndpointsAsync.bind(l),K.AuthorityResolveEndpointsAsync,i,o,s)(),l}catch{throw Se(fa)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class ku extends Cn{constructor(e,n,r,i,s){super(e,n,r),this.name="ServerError",this.errorNo=i,this.status=s,Object.setPrototypeOf(this,ku.prototype)}}/*! @azure/msal-common v15.10.0 2025-08-05 */function O0(t,e,n){var r;return{clientId:t,authority:e.authority,scopes:e.scopes,homeAccountIdentifier:n,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,embeddedClientId:e.embeddedClientId||((r=e.tokenBodyParameters)==null?void 0:r.clientId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Oo{static generateThrottlingStorageKey(e){return`${lp.THROTTLING_PREFIX}.${JSON.stringify(e)}`}static preProcess(e,n,r){var o;const i=Oo.generateThrottlingStorageKey(n),s=e.getThrottlingCache(i);if(s){if(s.throttleTime=500&&e.status<600}static checkResponseForRetryAfter(e){return e.headers?e.headers.hasOwnProperty(hi.RETRY_AFTER)&&(e.status<200||e.status>=300):!1}static calculateThrottleTime(e){const n=e<=0?0:e,r=Date.now()/1e3;return Math.floor(Math.min(r+(n||lp.DEFAULT_THROTTLE_TIME_SECONDS),r+lp.DEFAULT_MAX_THROTTLE_TIME_SECONDS)*1e3)}static removeThrottle(e,n,r,i){const s=O0(n,r,i),o=this.generateThrottlingStorageKey(s);e.removeItem(o,r.correlationId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class I0 extends Cn{constructor(e,n,r){super(e.errorCode,e.errorMessage,e.subError),Object.setPrototypeOf(this,I0.prototype),this.name="NetworkError",this.error=e,this.httpStatus=n,this.responseHeaders=r}}function Gh(t,e,n,r){return t.errorMessage=`${t.errorMessage}, additionalErrorInfo: error.name:${r==null?void 0:r.name}, error.message:${r==null?void 0:r.message}`,new I0(t,e,n)}/*! @azure/msal-common v15.10.0 2025-08-05 */class wN{constructor(e,n){this.config=Nte(e),this.logger=new $a(this.config.loggerOptions,sU,eN),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=n}createTokenRequestHeaders(e){const n={};if(n[hi.CONTENT_TYPE]=pe.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case Ys.HOME_ACCOUNT_ID:try{const r=_d(e.credential);n[hi.CCS_HEADER]=`Oid:${r.uid}@${r.utid}`}catch(r){this.logger.verbose("Could not parse home account ID for CCS Header: "+r)}break;case Ys.UPN:n[hi.CCS_HEADER]=`UPN: ${e.credential}`;break}return n}async executePostToTokenEndpoint(e,n,r,i,s,o){var l;o&&((l=this.performanceClient)==null||l.addQueueMeasurement(o,s));const c=await this.sendPostRequest(i,e,{body:n,headers:r},s);return this.config.serverTelemetryManager&&c.status<500&&c.status!==429&&this.config.serverTelemetryManager.clearTelemetryCache(),c}async sendPostRequest(e,n,r,i){var o,c,l;Oo.preProcess(this.cacheManager,e,i);let s;try{s=await fe(this.networkClient.sendPostRequestAsync.bind(this.networkClient),K.NetworkClientSendPostRequestAsync,this.logger,this.performanceClient,i)(n,r);const u=s.headers||{};(c=this.performanceClient)==null||c.addFields({refreshTokenSize:((o=s.body.refresh_token)==null?void 0:o.length)||0,httpVerToken:u[hi.X_MS_HTTP_VERSION]||"",requestId:u[hi.X_MS_REQUEST_ID]||""},i)}catch(u){if(u instanceof I0){const d=u.responseHeaders;throw d&&((l=this.performanceClient)==null||l.addFields({httpVerToken:d[hi.X_MS_HTTP_VERSION]||"",requestId:d[hi.X_MS_REQUEST_ID]||"",contentTypeHeader:d[hi.CONTENT_TYPE]||void 0,contentLengthHeader:d[hi.CONTENT_LENGTH]||void 0,httpStatus:u.httpStatus},i)),u.error}throw u instanceof Cn?u:Se(V5)}return Oo.postProcess(this.cacheManager,e,s,i),s}async updateAuthority(e,n){var s;(s=this.performanceClient)==null||s.addQueueMeasurement(K.UpdateTokenEndpointAuthority,n);const r=`https://${e}/${this.authority.tenant}/`,i=await HU(r,this.networkClient,this.cacheManager,this.authority.options,this.logger,n,this.performanceClient);this.authority=i}createTokenQueryParameters(e){const n=new Map;return e.embeddedClientId&&N0(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenQueryParameters&&Dc(n,e.tokenQueryParameters),mN(n,e.correlationId),E0(n,e.correlationId,this.performanceClient),Zp(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */function zU(t){return t&&(t.tid||t.tfp||t.acr)||null}/*! @azure/msal-common v15.10.0 2025-08-05 */class fo{getAccountInfo(){return{homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId,loginHint:this.loginHint,name:this.name,nativeAccountId:this.nativeAccountId,authorityType:this.authorityType,tenantProfiles:new Map((this.tenantProfiles||[]).map(e=>[e.tenantId,e]))}}isSingleTenant(){return!this.tenantProfiles}static createAccount(e,n,r){var u,d,f,h,p,g,m;const i=new fo;n.authorityType===zs.Adfs?i.authorityType=fv.ADFS_ACCOUNT_TYPE:n.protocolMode===Li.OIDC?i.authorityType=fv.GENERIC_ACCOUNT_TYPE:i.authorityType=fv.MSSTS_ACCOUNT_TYPE;let s;e.clientInfo&&r&&(s=rx(e.clientInfo,r)),i.clientInfo=e.clientInfo,i.homeAccountId=e.homeAccountId,i.nativeAccountId=e.nativeAccountId;const o=e.environment||n&&n.getPreferredCache();if(!o)throw Se(XE);i.environment=o,i.realm=(s==null?void 0:s.utid)||zU(e.idTokenClaims)||"",i.localAccountId=(s==null?void 0:s.uid)||((u=e.idTokenClaims)==null?void 0:u.oid)||((d=e.idTokenClaims)==null?void 0:d.sub)||"";const c=((f=e.idTokenClaims)==null?void 0:f.preferred_username)||((h=e.idTokenClaims)==null?void 0:h.upn),l=(p=e.idTokenClaims)!=null&&p.emails?e.idTokenClaims.emails[0]:null;if(i.username=c||l||"",i.loginHint=(g=e.idTokenClaims)==null?void 0:g.login_hint,i.name=((m=e.idTokenClaims)==null?void 0:m.name)||"",i.cloudGraphHostName=e.cloudGraphHostName,i.msGraphHost=e.msGraphHost,e.tenantProfiles)i.tenantProfiles=e.tenantProfiles;else{const v=oN(e.homeAccountId,i.localAccountId,i.realm,e.idTokenClaims);i.tenantProfiles=[v]}return i}static createFromAccountInfo(e,n,r){var s;const i=new fo;return i.authorityType=e.authorityType||fv.GENERIC_ACCOUNT_TYPE,i.homeAccountId=e.homeAccountId,i.localAccountId=e.localAccountId,i.nativeAccountId=e.nativeAccountId,i.realm=e.tenantId,i.environment=e.environment,i.username=e.username,i.name=e.name,i.loginHint=e.loginHint,i.cloudGraphHostName=n,i.msGraphHost=r,i.tenantProfiles=Array.from(((s=e.tenantProfiles)==null?void 0:s.values())||[]),i}static generateHomeAccountId(e,n,r,i,s){if(!(n===zs.Adfs||n===zs.Dsts)){if(e)try{const o=rx(e,i.base64Decode);if(o.uid&&o.utid)return`${o.uid}.${o.utid}`}catch{}r.warning("No client info in response")}return(s==null?void 0:s.sub)||""}static isAccountEntity(e){return e?e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("localAccountId")&&e.hasOwnProperty("username")&&e.hasOwnProperty("authorityType"):!1}static accountInfoIsEqual(e,n,r){if(!e||!n)return!1;let i=!0;if(r){const s=e.idTokenClaims||{},o=n.idTokenClaims||{};i=s.iat===o.iat&&s.nonce===o.nonce}return e.homeAccountId===n.homeAccountId&&e.localAccountId===n.localAccountId&&e.username===n.username&&e.tenantId===n.tenantId&&e.loginHint===n.loginHint&&e.environment===n.environment&&e.nativeAccountId===n.nativeAccountId&&i}}/*! @azure/msal-common v15.10.0 2025-08-05 */const cx="no_tokens_found",VU="native_account_unavailable",SN="refresh_token_expired",CN="ux_not_allowed",Fne="interaction_required",Une="consent_required",Bne="login_required",R0="bad_token";/*! @azure/msal-common v15.10.0 2025-08-05 */const kI=[Fne,Une,Bne,R0,CN],Hne=["message_only","additional_action","basic_action","user_password_expired","consent_required","bad_token"],zne={[cx]:"No refresh token found in the cache. Please sign-in.",[VU]:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.",[SN]:"Refresh token has expired.",[R0]:"Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve.",[CN]:"`canShowUI` flag in Edge was set to false. User interaction required on web page. Please invoke an interactive API to resolve."};class ho extends Cn{constructor(e,n,r,i,s,o,c,l){super(e,n,r),Object.setPrototypeOf(this,ho.prototype),this.timestamp=i||pe.EMPTY_STRING,this.traceId=s||pe.EMPTY_STRING,this.correlationId=o||pe.EMPTY_STRING,this.claims=c||pe.EMPTY_STRING,this.name="InteractionRequiredAuthError",this.errorNo=l}}function GU(t,e,n){const r=!!t&&kI.indexOf(t)>-1,i=!!n&&Hne.indexOf(n)>-1,s=!!e&&kI.some(o=>e.indexOf(o)>-1);return r||s||i}function lx(t){return new ho(t,zne[t])}/*! @azure/msal-common v15.10.0 2025-08-05 */class Vf{static setRequestState(e,n,r){const i=Vf.generateLibraryState(e,r);return n?`${i}${pe.RESOURCE_DELIM}${n}`:i}static generateLibraryState(e,n){if(!e)throw Se(iA);const r={id:e.createNewGuid()};n&&(r.meta=n);const i=JSON.stringify(r);return e.base64Encode(i)}static parseRequestState(e,n){if(!e)throw Se(iA);if(!n)throw Se(Jd);try{const r=n.split(pe.RESOURCE_DELIM),i=r[0],s=r.length>1?r.slice(1).join(pe.RESOURCE_DELIM):pe.EMPTY_STRING,o=e.base64Decode(i),c=JSON.parse(o);return{userRequestState:s||pe.EMPTY_STRING,libraryState:c}}catch{throw Se(Jd)}}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Vne={SW:"sw"};class Zd{constructor(e,n){this.cryptoUtils=e,this.performanceClient=n}async generateCnf(e,n){var s;(s=this.performanceClient)==null||s.addQueueMeasurement(K.PopTokenGenerateCnf,e.correlationId);const r=await fe(this.generateKid.bind(this),K.PopTokenGenerateCnf,n,this.performanceClient,e.correlationId)(e),i=this.cryptoUtils.base64UrlEncode(JSON.stringify(r));return{kid:r.kid,reqCnfString:i}}async generateKid(e){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(K.PopTokenGenerateKid,e.correlationId),{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:Vne.SW}}async signPopToken(e,n,r){return this.signPayload(e,n,r)}async signPayload(e,n,r,i){const{resourceRequestMethod:s,resourceRequestUri:o,shrClaims:c,shrNonce:l,shrOptions:u}=r,d=o?new en(o):void 0,f=d==null?void 0:d.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:Fi(),m:s==null?void 0:s.toUpperCase(),u:f==null?void 0:f.HostNameAndPort,nonce:l||this.cryptoUtils.createNewGuid(),p:f==null?void 0:f.AbsolutePath,q:f!=null&&f.QueryString?[[],f.QueryString]:void 0,client_claims:c||void 0,...i},n,u,r.correlationId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Gne{constructor(e,n){this.cache=e,this.hasChanged=n}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}/*! @azure/msal-common v15.10.0 2025-08-05 */class gu{constructor(e,n,r,i,s,o,c){this.clientId=e,this.cacheStorage=n,this.cryptoObj=r,this.logger=i,this.serializableCache=s,this.persistencePlugin=o,this.performanceClient=c}validateTokenResponse(e,n){var r;if(e.error||e.error_description||e.suberror){const i=`Error(s): ${e.error_codes||pe.NOT_AVAILABLE} - Timestamp: ${e.timestamp||pe.NOT_AVAILABLE} - Description: ${e.error_description||pe.NOT_AVAILABLE} - Correlation ID: ${e.correlation_id||pe.NOT_AVAILABLE} - Trace ID: ${e.trace_id||pe.NOT_AVAILABLE}`,s=(r=e.error_codes)!=null&&r.length?e.error_codes[0]:void 0,o=new ku(e.error,i,e.suberror,s,e.status);if(n&&e.status&&e.status>=Sc.SERVER_ERROR_RANGE_START&&e.status<=Sc.SERVER_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed. +${o}`);return}else if(n&&e.status&&e.status>=Sc.CLIENT_ERROR_RANGE_START&&e.status<=Sc.CLIENT_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently available but is unable to refresh the access token. +${o}`);return}throw GU(e.error,e.error_description,e.suberror)?new ho(e.error,e.error_description,e.suberror,e.timestamp||pe.EMPTY_STRING,e.trace_id||pe.EMPTY_STRING,e.correlation_id||pe.EMPTY_STRING,e.claims||pe.EMPTY_STRING,s):o}}async handleServerTokenResponse(e,n,r,i,s,o,c,l,u){var g;(g=this.performanceClient)==null||g.addQueueMeasurement(K.HandleServerTokenResponse,e.correlation_id);let d;if(e.id_token){if(d=zf(e.id_token||pe.EMPTY_STRING,this.cryptoObj.base64Decode),s&&s.nonce&&d.nonce!==s.nonce)throw Se(q5);if(i.maxAge||i.maxAge===0){const m=d.auth_time;if(!m)throw Se(YE);bU(m,i.maxAge)}}this.homeAccountIdentifier=fo.generateHomeAccountId(e.client_info||pe.EMPTY_STRING,n.authorityType,this.logger,this.cryptoObj,d);let f;s&&s.state&&(f=Vf.parseRequestState(this.cryptoObj,s.state)),e.key_id=e.key_id||i.sshKid||void 0;const h=this.generateCacheRecord(e,n,r,i,d,o,s);let p;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),p=new Gne(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(p)),c&&!l&&h.account){const m=this.cacheStorage.generateAccountKey(h.account.getAccountInfo());if(!this.cacheStorage.getAccount(m,i.correlationId))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await gu.generateAuthenticationResult(this.cryptoObj,n,h,!1,i,d,f,void 0,u)}await this.cacheStorage.saveCacheRecord(h,i.correlationId,i.storeInCache)}finally{this.persistencePlugin&&this.serializableCache&&p&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(p))}return gu.generateAuthenticationResult(this.cryptoObj,n,h,!1,i,d,f,e,u)}generateCacheRecord(e,n,r,i,s,o,c){const l=n.getPreferredCache();if(!l)throw Se(XE);const u=zU(s);let d,f;e.id_token&&s&&(d=P0(this.homeAccountIdentifier,l,e.id_token,this.clientId,u||""),f=_N(this.cacheStorage,n,this.homeAccountIdentifier,this.cryptoObj.base64Decode,i.correlationId,s,e.client_info,l,u,c,void 0,this.logger));let h=null;if(e.access_token){const m=e.scope?Er.fromString(e.scope):new Er(i.scopes||[]),v=(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,b=(typeof e.ext_expires_in=="string"?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,x=(typeof e.refresh_in=="string"?parseInt(e.refresh_in,10):e.refresh_in)||void 0,w=r+v,S=w+b,C=x&&x>0?r+x:void 0;h=k0(this.homeAccountIdentifier,l,e.access_token,this.clientId,u||n.tenant||"",m.printScopes(),w,S,this.cryptoObj.base64Decode,C,e.token_type,o,e.key_id,i.claims,i.requestedClaimsHash)}let p=null;if(e.refresh_token){let m;if(e.refresh_token_expires_in){const v=typeof e.refresh_token_expires_in=="string"?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in;m=r+v}p=UU(this.homeAccountIdentifier,l,e.refresh_token,this.clientId,e.foci,o,m)}let g=null;return e.foci&&(g={clientId:this.clientId,environment:l,familyId:e.foci}),{account:f,idToken:d,accessToken:h,refreshToken:p,appMetadata:g}}static async generateAuthenticationResult(e,n,r,i,s,o,c,l,u){var w,S,C,_,A;let d=pe.EMPTY_STRING,f=[],h=null,p,g,m=pe.EMPTY_STRING;if(r.accessToken){if(r.accessToken.tokenType===yn.POP&&!s.popKid){const j=new Zd(e),{secret:T,keyId:k}=r.accessToken;if(!k)throw Se(JE);d=await j.signPopToken(T,k,s)}else d=r.accessToken.secret;f=Er.fromString(r.accessToken.target).asArray(),h=Ad(r.accessToken.expiresOn),p=Ad(r.accessToken.extendedExpiresOn),r.accessToken.refreshOn&&(g=Ad(r.accessToken.refreshOn))}r.appMetadata&&(m=r.appMetadata.familyId===Qy?Qy:"");const v=(o==null?void 0:o.oid)||(o==null?void 0:o.sub)||"",b=(o==null?void 0:o.tid)||"";l!=null&&l.spa_accountid&&r.account&&(r.account.nativeAccountId=l==null?void 0:l.spa_accountid);const x=r.account?aN(r.account.getAccountInfo(),void 0,o,(w=r.idToken)==null?void 0:w.secret):null;return{authority:n.canonicalAuthority,uniqueId:v,tenantId:b,scopes:f,account:x,idToken:((S=r==null?void 0:r.idToken)==null?void 0:S.secret)||"",idTokenClaims:o||{},accessToken:d,fromCache:i,expiresOn:h,extExpiresOn:p,refreshOn:g,correlationId:s.correlationId,requestId:u||pe.EMPTY_STRING,familyId:m,tokenType:((C=r.accessToken)==null?void 0:C.tokenType)||pe.EMPTY_STRING,state:c?c.userRequestState:pe.EMPTY_STRING,cloudGraphHostName:((_=r.account)==null?void 0:_.cloudGraphHostName)||pe.EMPTY_STRING,msGraphHost:((A=r.account)==null?void 0:A.msGraphHost)||pe.EMPTY_STRING,code:l==null?void 0:l.spa_code,fromNativeBroker:!1}}}function _N(t,e,n,r,i,s,o,c,l,u,d,f){f==null||f.verbose("setCachedAccount called");const p=t.getAccountKeys().find(x=>x.startsWith(n));let g=null;p&&(g=t.getAccount(p,i));const m=g||fo.createAccount({homeAccountId:n,idTokenClaims:s,clientInfo:o,environment:c,cloudGraphHostName:u==null?void 0:u.cloud_graph_host_name,msGraphHost:u==null?void 0:u.msgraph_host,nativeAccountId:d},e,r),v=m.tenantProfiles||[],b=l||m.realm;if(b&&!v.find(x=>x.tenantId===b)){const x=oN(n,m.localAccountId,b,s);v.push(x)}return m.tenantProfiles=v,m}/*! @azure/msal-common v15.10.0 2025-08-05 */async function KU(t,e,n){return typeof t=="string"?t:t({clientId:e,tokenEndpoint:n})}/*! @azure/msal-common v15.10.0 2025-08-05 */class WU extends wN{constructor(e,n){var r;super(e,n),this.includeRedirectUri=!0,this.oidcDefaultScopes=(r=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:r.defaultScopes}async acquireToken(e,n){var c,l;if((c=this.performanceClient)==null||c.addQueueMeasurement(K.AuthClientAcquireToken,e.correlationId),!e.code)throw Se(X5);const r=Fi(),i=await fe(this.executeTokenRequest.bind(this),K.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),s=(l=i.headers)==null?void 0:l[hi.X_MS_REQUEST_ID],o=new gu(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return o.validateTokenResponse(i.body),fe(o.handleServerTokenResponse.bind(o),K.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(i.body,this.authority,r,e,n,void 0,void 0,void 0,s)}getLogoutUri(e){if(!e)throw An(dU);const n=this.createLogoutUrlQueryString(e);return en.appendQueryString(this.authority.endSessionEndpoint,n)}async executeTokenRequest(e,n){var u;(u=this.performanceClient)==null||u.addQueueMeasurement(K.AuthClientExecuteTokenRequest,n.correlationId);const r=this.createTokenQueryParameters(n),i=en.appendQueryString(e.tokenEndpoint,r),s=await fe(this.createTokenRequestBody.bind(this),K.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,n.correlationId)(n);let o;if(n.clientInfo)try{const d=rx(n.clientInfo,this.cryptoUtils.base64Decode);o={credential:`${d.uid}${Jp.CLIENT_INFO_SEPARATOR}${d.utid}`,type:Ys.HOME_ACCOUNT_ID}}catch(d){this.logger.verbose("Could not parse client info for CCS Header: "+d)}const c=this.createTokenRequestHeaders(o||n.ccsCredential),l=O0(this.config.authOptions.clientId,n);return fe(this.executePostToTokenEndpoint.bind(this),K.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,n.correlationId)(i,s,c,l,n.correlationId,K.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var i,s;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(fN(n,e.embeddedClientId||((s=e.tokenBodyParameters)==null?void 0:s[mu])||this.config.authOptions.clientId),this.includeRedirectUri)hN(n,e.redirectUri);else if(!e.redirectUri)throw An(oU);if(dN(n,e.scopes,!0,this.oidcDefaultScopes),xne(n,e.code),gN(n,this.config.libraryInfo),vN(n,this.config.telemetry.application),FU(n),this.serverTelemetryManager&&!jU(this.config)&&LU(n,this.serverTelemetryManager),e.codeVerifier&&wne(n,e.codeVerifier),this.config.clientCredentials.clientSecret&&OU(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const o=this.config.clientCredentials.clientAssertion;IU(n,await KU(o.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),RU(n,o.assertionType)}if(MU(n,U5.AUTHORIZATION_CODE_GRANT),yN(n),e.authenticationScheme===yn.POP){const o=new Zd(this.cryptoUtils,this.performanceClient);let c;e.popKid?c=this.cryptoUtils.encodeKid(e.popKid):c=(await fe(o.generateCnf.bind(o),K.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,xN(n,c)}else if(e.authenticationScheme===yn.SSH)if(e.sshJwk)$U(n,e.sshJwk);else throw An(j0);(!Uo.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&pN(n,e.claims,this.config.authOptions.clientCapabilities);let r;if(e.clientInfo)try{const o=rx(e.clientInfo,this.cryptoUtils.base64Decode);r={credential:`${o.uid}${Jp.CLIENT_INFO_SEPARATOR}${o.utid}`,type:Ys.HOME_ACCOUNT_ID}}catch(o){this.logger.verbose("Could not parse client info for CCS Header: "+o)}else r=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&r)switch(r.type){case Ys.HOME_ACCOUNT_ID:try{const o=_d(r.credential);up(n,o)}catch(o){this.logger.verbose("Could not parse home account ID for CCS Header: "+o)}break;case Ys.UPN:ox(n,r.credential);break}return e.embeddedClientId&&N0(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&Dc(n,e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[_I])&&Dc(n,{[_I]:"1"}),E0(n,e.correlationId,this.performanceClient),Zp(n)}createLogoutUrlQueryString(e){const n=new Map;return e.postLogoutRedirectUri&&pne(n,e.postLogoutRedirectUri),e.correlationId&&mN(n,e.correlationId),e.idTokenHint&&mne(n,e.idTokenHint),e.state&&PU(n,e.state),e.logoutHint&&Cne(n,e.logoutHint),e.extraQueryParameters&&Dc(n,e.extraQueryParameters),this.config.authOptions.instanceAware&&DU(n),Zp(n,this.config.authOptions.encodeExtraQueryParams,e.extraQueryParameters)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Kne=300;class Wne extends wN{constructor(e,n){super(e,n)}async acquireToken(e){var o,c;(o=this.performanceClient)==null||o.addQueueMeasurement(K.RefreshTokenClientAcquireToken,e.correlationId);const n=Fi(),r=await fe(this.executeTokenRequest.bind(this),K.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),i=(c=r.headers)==null?void 0:c[hi.X_MS_REQUEST_ID],s=new gu(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return s.validateTokenResponse(r.body),fe(s.handleServerTokenResponse.bind(s),K.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(r.body,this.authority,n,e,void 0,void 0,!0,e.forceCache,i)}async acquireTokenByRefreshToken(e){var r;if(!e)throw An(uU);if((r=this.performanceClient)==null||r.addQueueMeasurement(K.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw Se(QE);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await fe(this.acquireTokenWithCachedRefreshToken.bind(this),K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(i){const s=i instanceof ho&&i.errorCode===cx,o=i instanceof ku&&i.errorCode===vI.INVALID_GRANT_ERROR&&i.subError===vI.CLIENT_MISMATCH_ERROR;if(s||o)return fe(this.acquireTokenWithCachedRefreshToken.bind(this),K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1);throw i}return fe(this.acquireTokenWithCachedRefreshToken.bind(this),K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,n){var s,o,c;(s=this.performanceClient)==null||s.addQueueMeasurement(K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const r=ts(this.cacheManager.getRefreshToken.bind(this.cacheManager),K.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,n,e.correlationId,void 0,this.performanceClient);if(!r)throw lx(cx);if(r.expiresOn&&ax(r.expiresOn,e.refreshTokenExpirationOffsetSeconds||Kne))throw(o=this.performanceClient)==null||o.addFields({rtExpiresOnMs:Number(r.expiresOn)},e.correlationId),lx(SN);const i={...e,refreshToken:r.secret,authenticationScheme:e.authenticationScheme||yn.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:Ys.HOME_ACCOUNT_ID}};try{return await fe(this.acquireToken.bind(this),K.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(i)}catch(l){if(l instanceof ho&&((c=this.performanceClient)==null||c.addFields({rtExpiresOnMs:Number(r.expiresOn)},e.correlationId),l.subError===R0)){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const u=this.cacheManager.generateCredentialKey(r);this.cacheManager.removeRefreshToken(u,e.correlationId)}throw l}}async executeTokenRequest(e,n){var l;(l=this.performanceClient)==null||l.addQueueMeasurement(K.RefreshTokenClientExecuteTokenRequest,e.correlationId);const r=this.createTokenQueryParameters(e),i=en.appendQueryString(n.tokenEndpoint,r),s=await fe(this.createTokenRequestBody.bind(this),K.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),o=this.createTokenRequestHeaders(e.ccsCredential),c=O0(this.config.authOptions.clientId,e);return fe(this.executePostToTokenEndpoint.bind(this),K.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(i,s,o,c,e.correlationId,K.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var r,i,s;(r=this.performanceClient)==null||r.addQueueMeasurement(K.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(fN(n,e.embeddedClientId||((i=e.tokenBodyParameters)==null?void 0:i[mu])||this.config.authOptions.clientId),e.redirectUri&&hN(n,e.redirectUri),dN(n,e.scopes,!0,(s=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:s.defaultScopes),MU(n,U5.REFRESH_TOKEN_GRANT),yN(n),gN(n,this.config.libraryInfo),vN(n,this.config.telemetry.application),FU(n),this.serverTelemetryManager&&!jU(this.config)&&LU(n,this.serverTelemetryManager),bne(n,e.refreshToken),this.config.clientCredentials.clientSecret&&OU(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const o=this.config.clientCredentials.clientAssertion;IU(n,await KU(o.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),RU(n,o.assertionType)}if(e.authenticationScheme===yn.POP){const o=new Zd(this.cryptoUtils,this.performanceClient);let c;e.popKid?c=this.cryptoUtils.encodeKid(e.popKid):c=(await fe(o.generateCnf.bind(o),K.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,xN(n,c)}else if(e.authenticationScheme===yn.SSH)if(e.sshJwk)$U(n,e.sshJwk);else throw An(j0);if((!Uo.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&pN(n,e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case Ys.HOME_ACCOUNT_ID:try{const o=_d(e.ccsCredential.credential);up(n,o)}catch(o){this.logger.verbose("Could not parse home account ID for CCS Header: "+o)}break;case Ys.UPN:ox(n,e.ccsCredential.credential);break}return e.embeddedClientId&&N0(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&Dc(n,e.tokenBodyParameters),E0(n,e.correlationId,this.performanceClient),Zp(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class qne extends wN{constructor(e,n){super(e,n)}async acquireCachedToken(e){var l;(l=this.performanceClient)==null||l.addQueueMeasurement(K.SilentFlowClientAcquireCachedToken,e.correlationId);let n=jl.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!Uo.isEmptyObj(e.claims))throw this.setCacheOutcome(jl.FORCE_REFRESH_OR_CLAIMS,e.correlationId),Se(Mc);if(!e.account)throw Se(QE);const r=e.account.tenantId||$ne(e.authority),i=this.cacheManager.getTokenKeys(),s=this.cacheManager.getAccessToken(e.account,e,i,r);if(s){if(Pne(s.cachedAt)||ax(s.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(jl.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),Se(Mc);s.refreshOn&&ax(s.refreshOn,0)&&(n=jl.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(jl.NO_CACHED_ACCESS_TOKEN,e.correlationId),Se(Mc);const o=e.authority||this.authority.getPreferredCache(),c={account:this.cacheManager.getAccount(this.cacheManager.generateAccountKey(e.account),e.correlationId),accessToken:s,idToken:this.cacheManager.getIdToken(e.account,e.correlationId,i,r,this.performanceClient),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(o)};return this.setCacheOutcome(n,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await fe(this.generateResultFromCacheRecord.bind(this),K.SilentFlowClientGenerateResultFromCacheRecord,this.logger,this.performanceClient,e.correlationId)(c,e),n]}setCacheOutcome(e,n){var r,i;(r=this.serverTelemetryManager)==null||r.setCacheOutcome(e),(i=this.performanceClient)==null||i.addFields({cacheOutcome:e},n),e!==jl.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,n){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.SilentFlowClientGenerateResultFromCacheRecord,n.correlationId);let r;if(e.idToken&&(r=zf(e.idToken.secret,this.config.cryptoInterface.base64Decode)),n.maxAge||n.maxAge===0){const s=r==null?void 0:r.auth_time;if(!s)throw Se(YE);bU(s,n.maxAge)}return gu.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,n,r)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Yne={sendGetRequestAsync:()=>Promise.reject(Se(Vt)),sendPostRequestAsync:()=>Promise.reject(Se(Vt))};/*! @azure/msal-common v15.10.0 2025-08-05 */function Qne(t,e,n,r){var c,l;const i=e.correlationId,s=new Map;fN(s,e.embeddedClientId||((c=e.extraQueryParameters)==null?void 0:c[mu])||t.clientId);const o=[...e.scopes||[],...e.extraScopesToConsent||[]];if(dN(s,o,!0,(l=t.authority.options.OIDCOptions)==null?void 0:l.defaultScopes),hN(s,e.redirectUri),mN(s,i),fne(s,e.responseMode),yN(s),e.prompt&&(vne(s,e.prompt),r==null||r.addFields({prompt:e.prompt},i)),e.domainHint&&(gne(s,e.domainHint),r==null||r.addFields({domainHintFromRequest:!0},i)),e.prompt!==gi.SELECT_ACCOUNT)if(e.sid&&e.prompt===gi.NONE)n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),AI(s,e.sid),r==null||r.addFields({sidFromRequest:!0},i);else if(e.account){const u=Zne(e.account);let d=ere(e.account);if(d&&e.domainHint&&(n.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),d=null),d){n.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),hv(s,d),r==null||r.addFields({loginHintFromClaim:!0},i);try{const f=_d(e.account.homeAccountId);up(s,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(u&&e.prompt===gi.NONE){n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),AI(s,u),r==null||r.addFields({sidFromClaim:!0},i);try{const f=_d(e.account.homeAccountId);up(s,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)n.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),hv(s,e.loginHint),ox(s,e.loginHint),r==null||r.addFields({loginHintFromRequest:!0},i);else if(e.account.username){n.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),hv(s,e.account.username),r==null||r.addFields({loginHintFromUpn:!0},i);try{const f=_d(e.account.homeAccountId);up(s,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(n.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),hv(s,e.loginHint),ox(s,e.loginHint),r==null||r.addFields({loginHintFromRequest:!0},i));else n.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");return e.nonce&&yne(s,e.nonce),e.state&&PU(s,e.state),(e.claims||t.clientCapabilities&&t.clientCapabilities.length>0)&&pN(s,e.claims,t.clientCapabilities),e.embeddedClientId&&N0(s,t.clientId,t.redirectUri),t.instanceAware&&(!e.extraQueryParameters||!Object.keys(e.extraQueryParameters).includes(aA))&&DU(s),s}function AN(t,e,n,r){const i=Zp(e,n,r);return en.appendQueryString(t.authorizationEndpoint,i)}function Xne(t,e){if(qU(t,e),!t.code)throw Se(nU);return t}function qU(t,e){if(!t.state||!e)throw t.state?Se(tA,"Cached State"):Se(tA,"Server State");let n,r;try{n=decodeURIComponent(t.state)}catch{throw Se(Jd,t.state)}try{r=decodeURIComponent(e)}catch{throw Se(Jd,t.state)}if(n!==r)throw Se(W5);if(t.error||t.error_description||t.suberror){const i=Jne(t);throw GU(t.error,t.error_description,t.suberror)?new ho(t.error||"",t.error_description,t.suberror,t.timestamp||"",t.trace_id||"",t.correlation_id||"",t.claims||"",i):new ku(t.error||"",t.error_description,t.suberror,i)}}function Jne(t){var r,i;const e="code=",n=(r=t.error_uri)==null?void 0:r.lastIndexOf(e);return n&&n>=0?(i=t.error_uri)==null?void 0:i.substring(n+e.length):void 0}function Zne(t){var e;return((e=t.idTokenClaims)==null?void 0:e.sid)||null}function ere(t){var e;return t.loginHint||((e=t.idTokenClaims)==null?void 0:e.login_hint)||null}/*! @azure/msal-common v15.10.0 2025-08-05 */const OI=",",YU="|";function tre(t){const{skus:e,libraryName:n,libraryVersion:r,extensionName:i,extensionVersion:s}=t,o=new Map([[0,[n,r]],[2,[i,s]]]);let c=[];if(e!=null&&e.length){if(c=e.split(OI),c.length<4)return e}else c=Array.from({length:4},()=>YU);return o.forEach((l,u)=>{var d,f;l.length===2&&((d=l[0])!=null&&d.length)&&((f=l[1])!=null&&f.length)&&nre({skuArr:c,index:u,skuName:l[0],skuVersion:l[1]})}),c.join(OI)}function nre(t){const{skuArr:e,index:n,skuName:r,skuVersion:i}=t;n>=e.length||(e[n]=[r,i].join(YU))}class em{constructor(e,n){this.cacheOutcome=jl.NOT_APPLICABLE,this.cacheManager=n,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||pe.EMPTY_STRING,this.wrapperVer=e.wrapperVer||pe.EMPTY_STRING,this.telemetryCacheKey=Br.CACHE_KEY+Jp.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${Br.VALUE_SEPARATOR}${this.cacheOutcome}`,n=[this.wrapperSKU,this.wrapperVer],r=this.getNativeBrokerErrorCode();r!=null&&r.length&&n.push(`broker_error=${r}`);const i=n.join(Br.VALUE_SEPARATOR),s=this.getRegionDiscoveryFields(),o=[e,s].join(Br.VALUE_SEPARATOR);return[Br.SCHEMA_VERSION,o,i].join(Br.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),n=em.maxErrorsToSend(e),r=e.failedRequests.slice(0,2*n).join(Br.VALUE_SEPARATOR),i=e.errors.slice(0,n).join(Br.VALUE_SEPARATOR),s=e.errors.length,o=n=Br.MAX_CACHED_ERRORS&&(n.failedRequests.shift(),n.failedRequests.shift(),n.errors.shift()),n.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof Cn?e.subError?n.errors.push(e.subError):e.errorCode?n.errors.push(e.errorCode):n.errors.push(e.toString()):n.errors.push(e.toString()):n.errors.push(Br.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,n,this.correlationId)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e,this.correlationId),e.cacheHits}getLastRequests(){const e={failedRequests:[],errors:[],cacheHits:0};return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),n=em.maxErrorsToSend(e),r=e.errors.length;if(n===r)this.cacheManager.removeItem(this.telemetryCacheKey,this.correlationId);else{const i={failedRequests:e.failedRequests.slice(n*2),errors:e.errors.slice(n),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,i,this.correlationId)}}static maxErrorsToSend(e){let n,r=0,i=0;const s=e.errors.length;for(n=0;nString.fromCodePoint(n)).join("");return btoa(e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */function to(t){return new TextDecoder().decode($c(t))}function $c(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw ze(CB)}const n=atob(e);return Uint8Array.from(n,r=>r.codePointAt(0)||0)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const pre="RSASSA-PKCS1-v1_5",Gf="AES-GCM",TB="HKDF",RN="SHA-256",mre=2048,gre=new Uint8Array([1,0,1]),DI="0123456789abcdef",$I=new Uint32Array(1),MN="raw",PB="encrypt",DN="decrypt",vre="deriveKey",yre="crypto_subtle_undefined",$N={name:pre,hash:RN,modulusLength:mre,publicExponent:gre};function xre(t){if(!window)throw ze($0);if(!window.crypto)throw ze(cA);if(!t&&!window.crypto.subtle)throw ze(cA,yre)}async function kB(t,e,n){e==null||e.addQueueMeasurement(K.Sha256Digest,n);const i=new TextEncoder().encode(t);return window.crypto.subtle.digest(RN,i)}function bre(t){return window.crypto.getRandomValues(t)}function BS(){return window.crypto.getRandomValues($I),$I[0]}function po(){const t=Date.now(),e=BS()*1024+(BS()&1023),n=new Uint8Array(16),r=Math.trunc(e/2**30),i=e&2**30-1,s=BS();n[0]=t/2**40,n[1]=t/2**32,n[2]=t/2**24,n[3]=t/2**16,n[4]=t/2**8,n[5]=t,n[6]=112|r>>>8,n[7]=r,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s;let o="";for(let c=0;c>>4),o+=DI.charAt(n[c]&15),(c===3||c===5||c===7||c===9)&&(o+="-");return o}async function wre(t,e){return window.crypto.subtle.generateKey($N,t,e)}async function HS(t){return window.crypto.subtle.exportKey(EB,t)}async function Sre(t,e,n){return window.crypto.subtle.importKey(EB,t,$N,e,n)}async function Cre(t,e){return window.crypto.subtle.sign($N,t,e)}async function LN(){const t=await OB(),n={alg:"dir",kty:"oct",k:Zc(new Uint8Array(t))};return nm(JSON.stringify(n))}async function _re(t){const e=to(t),r=JSON.parse(e).k,i=$c(r);return window.crypto.subtle.importKey(MN,i,Gf,!1,[DN])}async function Are(t,e){const n=e.split(".");if(n.length!==5)throw ze(ny,"jwe_length");const r=await _re(t).catch(()=>{throw ze(ny,"import_key")});try{const i=new TextEncoder().encode(n[0]),s=$c(n[2]),o=$c(n[3]),c=$c(n[4]),l=c.byteLength*8,u=new Uint8Array(o.length+c.length);u.set(o),u.set(c,o.length);const d=await window.crypto.subtle.decrypt({name:Gf,iv:s,tagLength:l,additionalData:i},r,u);return new TextDecoder().decode(d)}catch{throw ze(ny,"decrypt")}}async function OB(){const t=await window.crypto.subtle.generateKey({name:Gf,length:256},!0,[PB,DN]);return window.crypto.subtle.exportKey(MN,t)}async function LI(t){return window.crypto.subtle.importKey(MN,t,TB,!1,[vre])}async function IB(t,e,n){return window.crypto.subtle.deriveKey({name:TB,salt:e,hash:RN,info:new TextEncoder().encode(n)},t,{name:Gf,length:256},!1,[PB,DN])}async function jre(t,e,n){const r=new TextEncoder().encode(e),i=window.crypto.getRandomValues(new Uint8Array(16)),s=await IB(t,i,n),o=await window.crypto.subtle.encrypt({name:Gf,iv:new Uint8Array(12)},s,r);return{data:Zc(new Uint8Array(o)),nonce:Zc(i)}}async function FI(t,e,n,r){const i=$c(r),s=await IB(t,$c(e),n),o=await window.crypto.subtle.decrypt({name:Gf,iv:new Uint8Array(12)},s,i);return new TextDecoder().decode(o)}async function RB(t){const e=await kB(t),n=new Uint8Array(e);return Zc(n)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const rm="storage_not_supported",ur="stubbed_public_client_application_called",fx="in_mem_redirect_unavailable";/*! @azure/msal-browser v4.19.0 2025-08-05 */const ry={[rm]:"Given storage configuration option was not supported.",[ur]:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",[fx]:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."};ry[rm],ry[ur],ry[fx];class FN extends Cn{constructor(e,n){super(e,n),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,FN.prototype)}}function dr(t){return new FN(t,ry[t])}/*! @azure/msal-browser v4.19.0 2025-08-05 */function MB(t){t.location.hash="",typeof t.history.replaceState=="function"&&t.history.replaceState(null,"",`${t.location.origin}${t.location.pathname}${t.location.search}`)}function Ere(t){const e=t.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function UN(){return window.parent!==window}function Nre(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${Ti.POPUP_NAME_PREFIX}.`)===0}function ba(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function Tre(){const e=new en(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function Pre(){if(en.hashContainsKnownProperties(window.location.hash)&&UN())throw ze(cB)}function kre(t){if(UN()&&!t)throw ze(aB)}function Ore(){if(Nre())throw ze(lB)}function DB(){if(typeof window>"u")throw ze($0)}function $B(t){if(!t)throw ze(dp)}function BN(t){DB(),Pre(),Ore(),$B(t)}function UI(t,e){if(BN(t),kre(e.system.allowRedirectInIframe),e.cache.cacheLocation===Nr.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw dr(fx)}function LB(t){const e=document.createElement("link");e.rel="preconnect",e.href=new URL(t).origin,e.crossOrigin="anonymous",document.head.appendChild(e),window.setTimeout(()=>{try{document.head.removeChild(e)}catch{}},1e4)}function Ire(){return po()}/*! @azure/msal-browser v4.19.0 2025-08-05 */class hx{navigateInternal(e,n){return hx.defaultNavigateWindow(e,n)}navigateExternal(e,n){return hx.defaultNavigateWindow(e,n)}static defaultNavigateWindow(e,n){return n.noHistory?window.location.replace(e):window.location.assign(e),new Promise((r,i)=>{setTimeout(()=>{i(ze(dx,"failed_to_redirect"))},n.timeout)})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Rre{async sendGetRequestAsync(e,n){let r,i={},s=0;const o=BI(n);try{r=await fetch(e,{method:RI.GET,headers:o})}catch(c){throw Gh(ze(window.navigator.onLine?pB:ux),void 0,void 0,c)}i=HI(r.headers);try{return s=r.status,{headers:i,body:await r.json(),status:s}}catch(c){throw Gh(ze(lA),s,i,c)}}async sendPostRequestAsync(e,n){const r=n&&n.body||"",i=BI(n);let s,o=0,c={};try{s=await fetch(e,{method:RI.POST,headers:i,body:r})}catch(l){throw Gh(ze(window.navigator.onLine?hB:ux),void 0,void 0,l)}c=HI(s.headers);try{return o=s.status,{headers:c,body:await s.json(),status:o}}catch(l){throw Gh(ze(lA),o,c,l)}}}function BI(t){try{const e=new Headers;if(!(t&&t.headers))return e;const n=t.headers;return Object.entries(n).forEach(([r,i])=>{e.append(r,i)}),e}catch(e){throw Gh(ze(AB),void 0,void 0,e)}}function HI(t){try{const e={};return t.forEach((n,r)=>{e[r]=n}),e}catch{throw ze(jB)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Mre=6e4,dA=1e4,Dre=3e4,FB=2e3;function $re({auth:t,cache:e,system:n,telemetry:r},i){const s={clientId:pe.EMPTY_STRING,authority:`${pe.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:pe.EMPTY_STRING,authorityMetadata:pe.EMPTY_STRING,redirectUri:typeof window<"u"?ba():"",postLogoutRedirectUri:pe.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:Li.AAD,OIDCOptions:{serverResponseType:A0.FRAGMENT,defaultScopes:[pe.OPENID_SCOPE,pe.PROFILE_SCOPE,pe.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:tN.None,tenant:pe.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1,encodeExtraQueryParams:!1},o={cacheLocation:Nr.SessionStorage,cacheRetentionDays:5,temporaryCacheLocation:Nr.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===Nr.LocalStorage),claimsBasedCachingEnabled:!1},c={loggerCallback:()=>{},logLevel:Rn.Info,piiLoggingEnabled:!1},u={...{...AU,loggerOptions:c,networkClient:i?new Rre:Yne,navigationClient:new hx,loadFrameTimeout:0,windowHashTimeout:(n==null?void 0:n.loadFrameTimeout)||Mre,iframeHashTimeout:(n==null?void 0:n.loadFrameTimeout)||dA,navigateFrameWait:0,redirectNavigationTimeout:Dre,asyncPopups:!1,allowRedirectInIframe:!1,allowPlatformBroker:!1,nativeBrokerHandshakeTimeout:(n==null?void 0:n.nativeBrokerHandshakeTimeout)||FB,pollIntervalMilliseconds:Ti.DEFAULT_POLL_INTERVAL_MS},...n,loggerOptions:(n==null?void 0:n.loggerOptions)||c},d={application:{appName:pe.EMPTY_STRING,appVersion:pe.EMPTY_STRING},client:new _U};if((t==null?void 0:t.protocolMode)!==Li.OIDC&&(t!=null&&t.OIDCOptions)&&new $a(u.loggerOptions).warning(JSON.stringify(An(mU))),t!=null&&t.protocolMode&&t.protocolMode===Li.OIDC&&(u!=null&&u.allowPlatformBroker))throw An(gU);return{auth:{...s,...t,OIDCOptions:{...s.OIDCOptions,...t==null?void 0:t.OIDCOptions}},cache:{...o,...e},system:u,telemetry:{...d,...r}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Lre="@azure/msal-browser",vu="4.19.0";/*! @azure/msal-browser v4.19.0 2025-08-05 */const Or="msal",HN="browser",zS="-",tc=1,fA=1,Fre=`${Or}.${HN}.log.level`,Ure=`${Or}.${HN}.log.pii`,Bre=`${Or}.${HN}.platform.auth.dom`,zI=`${Or}.version`,VI="account.keys",GI="token.keys";function Ao(t=fA){return t<1?`${Or}.${VI}`:`${Or}.${t}.${VI}`}function Dl(t,e=tc){return e<1?`${Or}.${GI}.${t}`:`${Or}.${e}.${GI}.${t}`}/*! @azure/msal-browser v4.19.0 2025-08-05 */class zN{static loggerCallback(e,n){switch(e){case Rn.Error:console.error(n);return;case Rn.Info:console.info(n);return;case Rn.Verbose:console.debug(n);return;case Rn.Warning:console.warn(n);return;default:console.log(n);return}}constructor(e){var l;this.browserEnvironment=typeof window<"u",this.config=$re(e,this.browserEnvironment);let n;try{n=window[Nr.SessionStorage]}catch{}const r=n==null?void 0:n.getItem(Fre),i=(l=n==null?void 0:n.getItem(Ure))==null?void 0:l.toLowerCase(),s=i==="true"?!0:i==="false"?!1:void 0,o={...this.config.system.loggerOptions},c=r&&Object.keys(Rn).includes(r)?Rn[r]:void 0;c&&(o.loggerCallback=zN.loggerCallback,o.logLevel=c),s!==void 0&&(o.piiLoggingEnabled=s),this.logger=new $a(o,Lre,vu),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class yu extends zN{getModuleName(){return yu.MODULE_NAME}getId(){return yu.ID}async initialize(){return this.available=typeof window<"u",this.available}}yu.MODULE_NAME="";yu.ID="StandardOperatingContext";/*! @azure/msal-browser v4.19.0 2025-08-05 */class Hre{constructor(){this.dbName=uA,this.version=dre,this.tableName=fre,this.dbOpen=!1}async open(){return new Promise((e,n)=>{const r=window.indexedDB.open(this.dbName,this.version);r.addEventListener("upgradeneeded",i=>{i.target.result.createObjectStore(this.tableName)}),r.addEventListener("success",i=>{const s=i;this.db=s.target.result,this.dbOpen=!0,e()}),r.addEventListener("error",()=>n(ze(ON)))})}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(ze(Yu));const o=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);o.addEventListener("success",c=>{const l=c;this.closeConnection(),n(l.target.result)}),o.addEventListener("error",c=>{this.closeConnection(),r(c)})})}async setItem(e,n){return await this.validateDbIsOpen(),new Promise((r,i)=>{if(!this.db)return i(ze(Yu));const c=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(n,e);c.addEventListener("success",()=>{this.closeConnection(),r()}),c.addEventListener("error",l=>{this.closeConnection(),i(l)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(ze(Yu));const o=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);o.addEventListener("success",()=>{this.closeConnection(),n()}),o.addEventListener("error",c=>{this.closeConnection(),r(c)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,n)=>{if(!this.db)return n(ze(Yu));const s=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();s.addEventListener("success",o=>{const c=o;this.closeConnection(),e(c.target.result)}),s.addEventListener("error",o=>{this.closeConnection(),n(o)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(ze(Yu));const o=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);o.addEventListener("success",c=>{const l=c;this.closeConnection(),n(l.target.result===1)}),o.addEventListener("error",c=>{this.closeConnection(),r(c)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,n)=>{const r=window.indexedDB.deleteDatabase(uA),i=setTimeout(()=>n(!1),200);r.addEventListener("success",()=>(clearTimeout(i),e(!0))),r.addEventListener("blocked",()=>(clearTimeout(i),e(!0))),r.addEventListener("error",()=>(clearTimeout(i),n(!1)))})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class L0{constructor(){this.cache=new Map}async initialize(){}getItem(e){return this.cache.get(e)||null}getUserData(e){return this.getItem(e)}setItem(e,n){this.cache.set(e,n)}async setUserData(e,n){this.setItem(e,n)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((n,r)=>{e.push(r)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}decryptData(){return Promise.resolve(null)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class zre{constructor(e){this.inMemoryCache=new L0,this.indexedDBCache=new Hre,this.logger=e}handleDatabaseAccessError(e){if(e instanceof bg&&e.errorCode===ON)this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");else throw e}async getItem(e){const n=this.inMemoryCache.getItem(e);if(!n)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(r){this.handleDatabaseAccessError(r)}return n}async setItem(e,n){this.inMemoryCache.setItem(e,n);try{await this.indexedDBCache.setItem(e,n)}catch(r){this.handleDatabaseAccessError(r)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(n){this.handleDatabaseAccessError(n)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(e.length===0)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(n){this.handleDatabaseAccessError(n)}return e}async containsKey(e){const n=this.inMemoryCache.containsKey(e);if(!n)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(r){this.handleDatabaseAccessError(r)}return n}clearInMemory(){this.logger.verbose("Deleting in-memory keystore"),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore deleted")}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class La{constructor(e,n,r){this.logger=e,xre(r??!1),this.cache=new zre(this.logger),this.performanceClient=n}createNewGuid(){return po()}base64Encode(e){return nm(e)}base64Decode(e){return to(e)}base64UrlEncode(e){return gv(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){var d;const n=(d=this.performanceClient)==null?void 0:d.startMeasurement(K.CryptoOptsGetPublicKeyThumbprint,e.correlationId),r=await wre(La.EXTRACTABLE,La.POP_KEY_USAGES),i=await HS(r.publicKey),s={e:i.e,kty:i.kty,n:i.n},o=KI(s),c=await this.hashString(o),l=await HS(r.privateKey),u=await Sre(l,!1,["sign"]);return await this.cache.setItem(c,{privateKey:u,publicKey:r.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),n&&n.end({success:!0}),c}async removeTokenBindingKey(e){if(await this.cache.removeItem(e),await this.cache.containsKey(e))throw Se(rU)}async clearKeystore(){this.cache.clearInMemory();try{return await this.cache.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}async signJwt(e,n,r,i){var w;const s=(w=this.performanceClient)==null?void 0:w.startMeasurement(K.CryptoOptsSignJwt,i),o=await this.cache.getItem(n);if(!o)throw ze(kN);const c=await HS(o.publicKey),l=KI(c),u=gv(JSON.stringify({kid:n})),d=EN.getShrHeaderString({...r==null?void 0:r.header,alg:c.alg,kid:u}),f=gv(d);e.cnf={jwk:JSON.parse(l)};const h=gv(JSON.stringify(e)),p=`${f}.${h}`,m=new TextEncoder().encode(p),v=await Cre(o.privateKey,m),b=Zc(new Uint8Array(v)),x=`${p}.${b}`;return s&&s.end({success:!0}),x}async hashString(e){return RB(e)}}La.POP_KEY_USAGES=["sign","verify"];La.EXTRACTABLE=!0;function KI(t){return JSON.stringify(t,Object.keys(t).sort())}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Vre=24*60*60*1e3,hA={Lax:"Lax",None:"None"};class UB{initialize(){return Promise.resolve()}getItem(e){const n=`${encodeURIComponent(e)}`,r=document.cookie.split(";");for(let i=0;i{const i=decodeURIComponent(r).trim().split("=");n.push(i[0])}),n}containsKey(e){return this.getKeys().includes(e)}decryptData(){return Promise.resolve(null)}}function Gre(t){const e=new Date;return new Date(e.getTime()+t*Vre).toUTCString()}/*! @azure/msal-browser v4.19.0 2025-08-05 */function fp(t,e){const n=t.getItem(Ao(e));return n?JSON.parse(n):[]}function hp(t,e,n){const r=e.getItem(Dl(t,n));if(r){const i=JSON.parse(r);if(i&&i.hasOwnProperty("idToken")&&i.hasOwnProperty("accessToken")&&i.hasOwnProperty("refreshToken"))return i}return{idToken:[],accessToken:[],refreshToken:[]}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function pA(t){return t.hasOwnProperty("id")&&t.hasOwnProperty("nonce")&&t.hasOwnProperty("data")}/*! @azure/msal-browser v4.19.0 2025-08-05 */const WI="msal.cache.encryption",Kre="msal.broadcast.cache";class Wre{constructor(e,n,r){if(!window.localStorage)throw dr(rm);this.memoryStorage=new L0,this.initialized=!1,this.clientId=e,this.logger=n,this.performanceClient=r,this.broadcast=new BroadcastChannel(Kre)}async initialize(e){const n=new UB,r=n.getItem(WI);let i={key:"",id:""};if(r)try{i=JSON.parse(r)}catch{}if(i.key&&i.id){const s=ts($c,K.Base64Decode,this.logger,this.performanceClient,e)(i.key);this.encryptionCookie={id:i.id,key:await fe(LI,K.GenerateHKDF,this.logger,this.performanceClient,e)(s)}}else{const s=po(),o=await fe(OB,K.GenerateBaseKey,this.logger,this.performanceClient,e)(),c=ts(Zc,K.UrlEncodeArr,this.logger,this.performanceClient,e)(new Uint8Array(o));this.encryptionCookie={id:s,key:await fe(LI,K.GenerateHKDF,this.logger,this.performanceClient,e)(o)};const l={id:s,key:c};n.setItem(WI,JSON.stringify(l),0,!0,hA.None)}await fe(this.importExistingCache.bind(this),K.ImportExistingCache,this.logger,this.performanceClient,e)(e),this.broadcast.addEventListener("message",this.updateCache.bind(this)),this.initialized=!0}getItem(e){return window.localStorage.getItem(e)}getUserData(e){if(!this.initialized)throw ze(dp);return this.memoryStorage.getItem(e)}async decryptData(e,n,r){if(!this.initialized||!this.encryptionCookie)throw ze(dp);if(n.id!==this.encryptionCookie.id)return this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},r),null;const i=await fe(FI,K.Decrypt,this.logger,this.performanceClient,r)(this.encryptionCookie.key,n.nonce,this.getContext(e),n.data);if(!i)return null;try{return JSON.parse(i)}catch{return this.performanceClient.incrementFields({encryptedCacheCorruptionCount:1},r),null}}setItem(e,n){window.localStorage.setItem(e,n)}async setUserData(e,n,r,i){if(!this.initialized||!this.encryptionCookie)throw ze(dp);const{data:s,nonce:o}=await fe(jre,K.Encrypt,this.logger,this.performanceClient,r)(this.encryptionCookie.key,n,this.getContext(e)),c={id:this.encryptionCookie.id,nonce:o,data:s,lastUpdatedAt:i};this.memoryStorage.setItem(e,n),this.setItem(e,JSON.stringify(c)),this.broadcast.postMessage({key:e,value:n,context:this.getContext(e)})}removeItem(e){this.memoryStorage.containsKey(e)&&(this.memoryStorage.removeItem(e),this.broadcast.postMessage({key:e,value:null,context:this.getContext(e)})),window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}clear(){this.memoryStorage.clear(),fp(this).forEach(r=>this.removeItem(r));const n=hp(this.clientId,this);n.idToken.forEach(r=>this.removeItem(r)),n.accessToken.forEach(r=>this.removeItem(r)),n.refreshToken.forEach(r=>this.removeItem(r)),this.getKeys().forEach(r=>{(r.startsWith(Or)||r.indexOf(this.clientId)!==-1)&&this.removeItem(r)})}async importExistingCache(e){if(!this.encryptionCookie)return;let n=fp(this);n=await this.importArray(n,e),n.length?this.setItem(Ao(),JSON.stringify(n)):this.removeItem(Ao());const r=hp(this.clientId,this);r.idToken=await this.importArray(r.idToken,e),r.accessToken=await this.importArray(r.accessToken,e),r.refreshToken=await this.importArray(r.refreshToken,e),r.idToken.length||r.accessToken.length||r.refreshToken.length?this.setItem(Dl(this.clientId),JSON.stringify(r)):this.removeItem(Dl(this.clientId))}async getItemFromEncryptedCache(e,n){if(!this.encryptionCookie)return null;const r=this.getItem(e);if(!r)return null;let i;try{i=JSON.parse(r)}catch{return null}return pA(i)?i.id!==this.encryptionCookie.id?(this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},n),null):fe(FI,K.Decrypt,this.logger,this.performanceClient,n)(this.encryptionCookie.key,i.nonce,this.getContext(e),i.data):(this.performanceClient.incrementFields({unencryptedCacheCount:1},n),i)}async importArray(e,n){const r=[],i=[];return e.forEach(s=>{const o=this.getItemFromEncryptedCache(s,n).then(c=>{c?(this.memoryStorage.setItem(s,c),r.push(s)):this.removeItem(s)});i.push(o)}),await Promise.all(i),r}getContext(e){let n="";return e.includes(this.clientId)&&(n=this.clientId),n}updateCache(e){this.logger.trace("Updating internal cache from broadcast event");const n=this.performanceClient.startMeasurement(K.LocalStorageUpdated);n.add({isBackground:!0});const{key:r,value:i,context:s}=e.data;if(!r){this.logger.error("Broadcast event missing key"),n.end({success:!1,errorCode:"noKey"});return}if(s&&s!==this.clientId){this.logger.trace(`Ignoring broadcast event from clientId: ${s}`),n.end({success:!1,errorCode:"contextMismatch"});return}i?(this.memoryStorage.setItem(r,i),this.logger.verbose("Updated item in internal cache")):(this.memoryStorage.removeItem(r),this.logger.verbose("Removed item from internal cache")),n.end({success:!0})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class qre{constructor(){if(!window.sessionStorage)throw dr(rm)}async initialize(){}getItem(e){return window.sessionStorage.getItem(e)}getUserData(e){return this.getItem(e)}setItem(e,n){window.sessionStorage.setItem(e,n)}async setUserData(e,n){this.setItem(e,n)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}decryptData(){return Promise.resolve(null)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const qe={INITIALIZE_START:"msal:initializeStart",INITIALIZE_END:"msal:initializeEnd",ACCOUNT_ADDED:"msal:accountAdded",ACCOUNT_REMOVED:"msal:accountRemoved",ACTIVE_ACCOUNT_CHANGED:"msal:activeAccountChanged",LOGIN_START:"msal:loginStart",LOGIN_SUCCESS:"msal:loginSuccess",LOGIN_FAILURE:"msal:loginFailure",ACQUIRE_TOKEN_START:"msal:acquireTokenStart",ACQUIRE_TOKEN_SUCCESS:"msal:acquireTokenSuccess",ACQUIRE_TOKEN_FAILURE:"msal:acquireTokenFailure",ACQUIRE_TOKEN_NETWORK_START:"msal:acquireTokenFromNetworkStart",SSO_SILENT_START:"msal:ssoSilentStart",SSO_SILENT_SUCCESS:"msal:ssoSilentSuccess",SSO_SILENT_FAILURE:"msal:ssoSilentFailure",ACQUIRE_TOKEN_BY_CODE_START:"msal:acquireTokenByCodeStart",ACQUIRE_TOKEN_BY_CODE_SUCCESS:"msal:acquireTokenByCodeSuccess",ACQUIRE_TOKEN_BY_CODE_FAILURE:"msal:acquireTokenByCodeFailure",HANDLE_REDIRECT_START:"msal:handleRedirectStart",HANDLE_REDIRECT_END:"msal:handleRedirectEnd",POPUP_OPENED:"msal:popupOpened",LOGOUT_START:"msal:logoutStart",LOGOUT_SUCCESS:"msal:logoutSuccess",LOGOUT_FAILURE:"msal:logoutFailure",LOGOUT_END:"msal:logoutEnd",RESTORE_FROM_BFCACHE:"msal:restoreFromBFCache",BROKER_CONNECTION_ESTABLISHED:"msal:brokerConnectionEstablished"};/*! @azure/msal-browser v4.19.0 2025-08-05 */function qI(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class mA extends oA{constructor(e,n,r,i,s,o,c){super(e,r,i,s,c),this.cacheConfig=n,this.logger=i,this.internalStorage=new L0,this.browserStorage=YI(e,n.cacheLocation,i,s),this.temporaryCacheStorage=YI(e,n.temporaryCacheLocation,i,s),this.cookieStorage=new UB,this.eventHandler=o}async initialize(e){this.performanceClient.addFields({cacheLocation:this.cacheConfig.cacheLocation,cacheRetentionDays:this.cacheConfig.cacheRetentionDays},e),await this.browserStorage.initialize(e),await this.migrateExistingCache(e),this.trackVersionChanges(e)}async migrateExistingCache(e){const n=fp(this.browserStorage,0),r=hp(this.clientId,this.browserStorage,0);this.performanceClient.addFields({oldAccountCount:n.length,oldAccessCount:r.accessToken.length,oldIdCount:r.idToken.length,oldRefreshCount:r.refreshToken.length},e);const i=fp(this.browserStorage,1),s=hp(this.clientId,this.browserStorage,1);this.performanceClient.addFields({currAccountCount:i.length,currAccessCount:s.accessToken.length,currIdCount:s.idToken.length,currRefreshCount:s.refreshToken.length},e),await Promise.all([this.updateV0ToCurrent(fA,n,i,e),this.updateV0ToCurrent(tc,r.idToken,s.idToken,e),this.updateV0ToCurrent(tc,r.accessToken,s.accessToken,e),this.updateV0ToCurrent(tc,r.refreshToken,s.refreshToken,e)]),n.length>0?this.browserStorage.setItem(Ao(0),JSON.stringify(n)):this.browserStorage.removeItem(Ao(0)),i.length>0?this.browserStorage.setItem(Ao(1),JSON.stringify(i)):this.browserStorage.removeItem(Ao(1)),this.setTokenKeys(r,e,0),this.setTokenKeys(s,e,1)}async updateV0ToCurrent(e,n,r,i){const s=[];for(const o of[...n]){const c=this.browserStorage.getItem(o),l=this.validateAndParseJson(c||"");if(!l){qI(n,o);continue}l.lastUpdatedAt||(l.lastUpdatedAt=Date.now().toString(),this.setItem(o,JSON.stringify(l),i));const u=pA(l)?await this.browserStorage.decryptData(o,l,i):l;let d;if(u&&(EI(u)||NI(u))&&(d=u.expiresOn),!u||Tne(l.lastUpdatedAt,this.cacheConfig.cacheRetentionDays)||d&&ax(d,B5)){this.browserStorage.removeItem(o),qI(n,o),this.performanceClient.incrementFields({expiredCacheRemovedCount:1},i);continue}if(this.cacheConfig.cacheLocation!==Nr.LocalStorage||pA(l)){const f=`${Or}.${e}${zS}${o}`,h=this.browserStorage.getItem(f);if(h){const p=this.validateAndParseJson(h);if(Number(l.lastUpdatedAt)>Number(p.lastUpdatedAt)){s.push(this.setUserData(f,JSON.stringify(u),i,l.lastUpdatedAt).then(()=>{this.performanceClient.incrementFields({updatedCacheFromV0Count:1},i)}));continue}}else{s.push(this.setUserData(f,JSON.stringify(u),i,l.lastUpdatedAt).then(()=>{r.push(f),this.performanceClient.incrementFields({upgradedCacheCount:1},i)}));continue}}}return Promise.all(s)}trackVersionChanges(e){const n=this.browserStorage.getItem(zI);n&&(this.logger.info(`MSAL.js was last initialized by version: ${n}`),this.performanceClient.addFields({previousLibraryVersion:n},e)),n!==vu&&this.setItem(zI,vu,e)}validateAndParseJson(e){if(!e)return null;try{const n=JSON.parse(e);return n&&typeof n=="object"?n:null}catch{return null}}setItem(e,n,r){let i=0,s=[];const o=20;for(let c=0;c<=o;c++)try{this.browserStorage.setItem(e,n),c>0&&(c<=i?this.removeAccessTokenKeys(s.slice(0,c),r,0):(this.removeAccessTokenKeys(s.slice(0,i),r,0),this.removeAccessTokenKeys(s.slice(i,c),r)));break}catch(l){const u=sA(l);if(u.errorCode===nx&&c0&&(l<=s?this.removeAccessTokenKeys(o.slice(0,l),r,0):(this.removeAccessTokenKeys(o.slice(0,s),r,0),this.removeAccessTokenKeys(o.slice(s,l),r)));break}catch(u){const d=sA(u);if(d.errorCode===nx&&l-1){if(r.splice(i,1),r.length===0){this.removeItem(Ao());return}else this.setItem(Ao(),JSON.stringify(r),n);this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")}else this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}removeAccount(e,n){const r=this.getActiveAccount(n);(r==null?void 0:r.homeAccountId)===e.homeAccountId&&(r==null?void 0:r.environment)===e.environment&&this.setActiveAccount(null,n),super.removeAccount(e,n),this.removeAccountKeyFromMap(this.generateAccountKey(e),n),this.browserStorage.getKeys().forEach(i=>{i.includes(e.homeAccountId)&&i.includes(e.environment)&&this.browserStorage.removeItem(i)}),this.cacheConfig.cacheLocation===Nr.LocalStorage&&this.eventHandler.emitEvent(qe.ACCOUNT_REMOVED,void 0,e)}removeIdToken(e,n){super.removeIdToken(e,n);const r=this.getTokenKeys(),i=r.idToken.indexOf(e);i>-1&&(this.logger.info("idToken removed from tokenKeys map"),r.idToken.splice(i,1),this.setTokenKeys(r,n))}removeAccessToken(e,n,r=!0){super.removeAccessToken(e,n),r&&this.removeAccessTokenKeys([e],n)}removeAccessTokenKeys(e,n,r=tc){this.logger.trace("removeAccessTokenKey called");const i=this.getTokenKeys(r);let s=0;if(e.forEach(o=>{const c=i.accessToken.indexOf(o);c>-1&&(i.accessToken.splice(c,1),s++)}),s>0){this.logger.info(`removed ${s} accessToken keys from tokenKeys map`),this.setTokenKeys(i,n,r);return}}removeRefreshToken(e,n){super.removeRefreshToken(e,n);const r=this.getTokenKeys(),i=r.refreshToken.indexOf(e);i>-1&&(this.logger.info("refreshToken removed from tokenKeys map"),r.refreshToken.splice(i,1),this.setTokenKeys(r,n))}getTokenKeys(e=tc){return hp(this.clientId,this.browserStorage,e)}setTokenKeys(e,n,r=tc){if(e.idToken.length===0&&e.accessToken.length===0&&e.refreshToken.length===0){this.removeItem(Dl(this.clientId,r));return}else this.setItem(Dl(this.clientId,r),JSON.stringify(e),n)}getIdTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeIdToken(e,n),null;const i=this.validateAndParseJson(r);return!i||!kne(i)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),i)}async setIdTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const s=this.getTokenKeys();s.idToken.indexOf(r)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),s.idToken.push(r),this.setTokenKeys(s,n))}getAccessTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeAccessTokenKeys([e],n),null;const i=this.validateAndParseJson(r);return!i||!EI(i)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),i)}async setAccessTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const s=this.getTokenKeys(),o=s.accessToken.indexOf(r);o!==-1&&s.accessToken.splice(o,1),this.logger.trace(`access token ${o===-1?"added to":"updated in"} map`),s.accessToken.push(r),this.setTokenKeys(s,n)}getRefreshTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeRefreshToken(e,n),null;const i=this.validateAndParseJson(r);return!i||!NI(i)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),i)}async setRefreshTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const s=this.getTokenKeys();s.refreshToken.indexOf(r)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),s.refreshToken.push(r),this.setTokenKeys(s,n))}getAppMetadata(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!Mne(e,r)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),r)}setAppMetadata(e,n){this.logger.trace("BrowserCacheManager.setAppMetadata called");const r=Rne(e);this.setItem(r,JSON.stringify(e),n)}getServerTelemetry(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!One(e,r)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),r)}setServerTelemetry(e,n,r){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(n),r)}getAuthorityMetadata(e){const n=this.internalStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(n);return r&&Dne(e,r)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),r):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(n=>this.isAuthorityMetadata(n))}setWrapperMetadata(e,n){this.internalStorage.setItem(mv.WRAPPER_SKU,e),this.internalStorage.setItem(mv.WRAPPER_VER,n)}getWrapperMetadata(){const e=this.internalStorage.getItem(mv.WRAPPER_SKU)||pe.EMPTY_STRING,n=this.internalStorage.getItem(mv.WRAPPER_VER)||pe.EMPTY_STRING;return[e,n]}setAuthorityMetadata(e,n){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(n))}getActiveAccount(e){const n=this.generateCacheKey(gI.ACTIVE_ACCOUNT_FILTERS),r=this.browserStorage.getItem(n);if(!r)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters found"),null;const i=this.validateAndParseJson(r);return i?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:i.homeAccountId,localAccountId:i.localAccountId,tenantId:i.tenantId},e)):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e,n){const r=this.generateCacheKey(gI.ACTIVE_ACCOUNT_FILTERS);if(e){this.logger.verbose("setActiveAccount: Active account set");const i={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId,lastUpdatedAt:Fi().toString()};this.setItem(r,JSON.stringify(i),n)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(r);this.eventHandler.emitEvent(qe.ACTIVE_ACCOUNT_CHANGED)}getThrottlingCache(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!Ine(e,r)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),r)}setThrottlingCache(e,n,r){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(n),r)}getTemporaryCache(e,n){const r=n?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const s=this.cookieStorage.getItem(r);if(s)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),s}const i=this.temporaryCacheStorage.getItem(r);if(!i){if(this.cacheConfig.cacheLocation===Nr.LocalStorage){const s=this.browserStorage.getItem(r);if(s)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),s}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),i}setTemporaryCache(e,n,r){const i=r?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(i,n),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(i,n,void 0,this.cacheConfig.secureCookies))}removeItem(e){this.browserStorage.removeItem(e)}removeTemporaryItem(e){this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.cookieStorage.removeItem(e))}getKeys(){return this.browserStorage.getKeys()}clear(e){this.removeAllAccounts(e),this.removeAppMetadata(e),this.temporaryCacheStorage.getKeys().forEach(n=>{(n.indexOf(Or)!==-1||n.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(n)}),this.browserStorage.getKeys().forEach(n=>{(n.indexOf(Or)!==-1||n.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(n)}),this.internalStorage.clear()}clearTokensAndKeysWithClaims(e){this.performanceClient.addQueueMeasurement(K.ClearTokensAndKeysWithClaims,e);const n=this.getTokenKeys();let r=0;n.accessToken.forEach(i=>{const s=this.getAccessTokenCredential(i,e);s!=null&&s.requestedClaimsHash&&i.includes(s.requestedClaimsHash.toLowerCase())&&(this.removeAccessToken(i,e),r++)}),r>0&&this.logger.warning(`${r} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return Uo.startsWith(e,Or)?e:`${Or}.${this.clientId}.${e}`}generateCredentialKey(e){const n=e.credentialType===Gr.REFRESH_TOKEN&&e.familyId||e.clientId,r=e.tokenType&&e.tokenType.toLowerCase()!==yn.BEARER.toLowerCase()?e.tokenType.toLowerCase():"";return[`${Or}.${tc}`,e.homeAccountId,e.environment,e.credentialType,n,e.realm||"",e.target||"",e.requestedClaimsHash||"",r].join(zS).toLowerCase()}generateAccountKey(e){const n=e.homeAccountId.split(".")[1];return[`${Or}.${fA}`,e.homeAccountId,e.environment,n||e.tenantId||""].join(zS).toLowerCase()}resetRequestCache(){this.logger.trace("BrowserCacheManager.resetRequestCache called"),this.removeTemporaryItem(this.generateCacheKey(hr.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey(hr.VERIFIER)),this.removeTemporaryItem(this.generateCacheKey(hr.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey(hr.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey(hr.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cacheAuthorizeRequest(e,n){this.logger.trace("BrowserCacheManager.cacheAuthorizeRequest called");const r=nm(JSON.stringify(e));if(this.setTemporaryCache(hr.REQUEST_PARAMS,r,!0),n){const i=nm(n);this.setTemporaryCache(hr.VERIFIER,i,!0)}}getCachedRequest(){this.logger.trace("BrowserCacheManager.getCachedRequest called");const e=this.getTemporaryCache(hr.REQUEST_PARAMS,!0);if(!e)throw ze(dB);const n=this.getTemporaryCache(hr.VERIFIER,!0);let r,i="";try{r=JSON.parse(to(e)),n&&(i=to(n))}catch(s){throw this.logger.errorPii(`Attempted to parse: ${e}`),this.logger.error(`Parsing cached token request threw with error: ${s}`),ze(fB)}return[r,i]}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(hr.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const n=this.validateAndParseJson(e);return n||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){var r;const n=(r=this.getInteractionInProgress())==null?void 0:r.clientId;return e?n===this.clientId:!!n}getInteractionInProgress(){const e=`${Or}.${hr.INTERACTION_STATUS_KEY}`,n=this.getTemporaryCache(e,!1);try{return n?JSON.parse(n):null}catch{return this.logger.error("Cannot parse interaction status. Removing temporary cache items and clearing url hash. Retrying interaction should fix the error"),this.removeTemporaryItem(e),this.resetRequestCache(),MB(window),null}}setInteractionInProgress(e,n=uc.SIGNIN){var i;const r=`${Or}.${hr.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw ze(rB);this.setTemporaryCache(r,JSON.stringify({clientId:this.clientId,type:n}),!1)}else!e&&((i=this.getInteractionInProgress())==null?void 0:i.clientId)===this.clientId&&this.removeTemporaryItem(r)}async hydrateCache(e,n){var c,l,u;const r=P0((c=e.account)==null?void 0:c.homeAccountId,(l=e.account)==null?void 0:l.environment,e.idToken,this.clientId,e.tenantId);let i;n.claims&&(i=await this.cryptoImpl.hashString(n.claims));const s=k0((u=e.account)==null?void 0:u.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?jI(e.expiresOn):0,e.extExpiresOn?jI(e.extExpiresOn):0,to,void 0,e.tokenType,void 0,n.sshKid,n.claims,i),o={idToken:r,accessToken:s};return this.saveCacheRecord(o,e.correlationId)}async saveCacheRecord(e,n,r){try{await super.saveCacheRecord(e,n,r)}catch(i){if(i instanceof Cd&&this.performanceClient&&n)try{const s=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:s.refreshToken.length,cacheIdCount:s.idToken.length,cacheAtCount:s.accessToken.length},n)}catch{}throw i}}}function YI(t,e,n,r){try{switch(e){case Nr.LocalStorage:return new Wre(t,n,r);case Nr.SessionStorage:return new qre;case Nr.MemoryStorage:default:break}}catch(i){n.error(i)}return new L0}const Yre=(t,e,n,r)=>{const i={cacheLocation:Nr.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:Nr.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new mA(t,i,Zy,e,n,r)};/*! @azure/msal-browser v4.19.0 2025-08-05 */function Qre(t,e,n,r,i){return t.verbose("getAllAccounts called"),n?e.getAllAccounts(i||{},r):[]}function Xre(t,e,n,r){if(e.trace("getAccount called"),Object.keys(t).length===0)return e.warning("getAccount: No accountFilter provided"),null;const i=n.getAccountInfoFilteredBy(t,r);return i?(e.verbose("getAccount: Account matching provided filter found, returning"),i):(e.verbose("getAccount: No matching account found, returning null"),null)}function Jre(t,e,n,r){if(e.trace("getAccountByUsername called"),!t)return e.warning("getAccountByUsername: No username provided"),null;const i=n.getAccountInfoFilteredBy({username:t},r);return i?(e.verbose("getAccountByUsername: Account matching username found, returning"),e.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${t}`),i):(e.verbose("getAccountByUsername: No matching account found, returning null"),null)}function Zre(t,e,n,r){if(e.trace("getAccountByHomeId called"),!t)return e.warning("getAccountByHomeId: No homeAccountId provided"),null;const i=n.getAccountInfoFilteredBy({homeAccountId:t},r);return i?(e.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),e.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${t}`),i):(e.verbose("getAccountByHomeId: No matching account found, returning null"),null)}function eie(t,e,n,r){if(e.trace("getAccountByLocalId called"),!t)return e.warning("getAccountByLocalId: No localAccountId provided"),null;const i=n.getAccountInfoFilteredBy({localAccountId:t},r);return i?(e.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),e.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${t}`),i):(e.verbose("getAccountByLocalId: No matching account found, returning null"),null)}function tie(t,e,n){e.setActiveAccount(t,n)}function nie(t,e){return t.getActiveAccount(e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const rie="msal.broadcast.event";class iie{constructor(e){this.eventCallbacks=new Map,this.logger=e||new $a({}),typeof BroadcastChannel<"u"&&(this.broadcastChannel=new BroadcastChannel(rie)),this.invokeCrossTabCallbacks=this.invokeCrossTabCallbacks.bind(this)}addEventCallback(e,n,r){if(typeof window<"u"){const i=r||Ire();return this.eventCallbacks.has(i)?(this.logger.error(`Event callback with id: ${i} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(i,[e,n||[]]),this.logger.verbose(`Event callback registered with id: ${i}`),i)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,n,r,i){var o;const s={eventType:e,interactionType:n||null,payload:r||null,error:i||null,timestamp:Date.now()};switch(e){case qe.ACCOUNT_ADDED:case qe.ACCOUNT_REMOVED:case qe.ACTIVE_ACCOUNT_CHANGED:(o=this.broadcastChannel)==null||o.postMessage(s);break;default:this.invokeCallbacks(s);break}}invokeCallbacks(e){this.eventCallbacks.forEach(([n,r],i)=>{(r.length===0||r.includes(e.eventType))&&(this.logger.verbose(`Emitting event to callback ${i}: ${e.eventType}`),n.apply(null,[e]))})}invokeCrossTabCallbacks(e){const n=e.data;this.invokeCallbacks(n)}subscribeCrossTab(){var e;(e=this.broadcastChannel)==null||e.addEventListener("message",this.invokeCrossTabCallbacks)}unsubscribeCrossTab(){var e;(e=this.broadcastChannel)==null||e.removeEventListener("message",this.invokeCrossTabCallbacks)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class BB{constructor(e,n,r,i,s,o,c,l,u){this.config=e,this.browserStorage=n,this.browserCrypto=r,this.networkClient=this.config.system.networkClient,this.eventHandler=s,this.navigationClient=o,this.platformAuthProvider=l,this.correlationId=u||po(),this.logger=i.clone(Ti.MSAL_SKU,vu,this.correlationId),this.performanceClient=c}async clearCacheOnLogout(e,n){if(n)try{this.browserStorage.removeAccount(n,e),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch{this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),this.browserStorage.clear(e),await this.browserCrypto.clearKeystore()}catch{this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const n=e||this.config.auth.redirectUri;return en.getAbsoluteUrl(n,ba())}initializeServerTelemetryManager(e,n){this.logger.verbose("initializeServerTelemetryManager called");const r={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:n||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new em(r,this.browserStorage)}async getDiscoveredAuthority(e){const{account:n}=e,r=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(K.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const i={protocolMode:this.config.auth.protocolMode,OIDCOptions:this.config.auth.OIDCOptions,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},s=e.requestAuthority||this.config.auth.authority,o=r!=null&&r.length?r==="true":this.config.auth.instanceAware,c=n&&o?this.config.auth.authority.replace(en.getDomainFromUrl(s),n.environment):s,l=ti.generateAuthority(c,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),u=await fe(HU,K.AuthorityFactoryCreateDiscoveredInstance,this.logger,this.performanceClient,this.correlationId)(l,this.config.system.networkClient,this.browserStorage,i,this.logger,this.correlationId,this.performanceClient);if(n&&!u.isAlias(n.environment))throw An(vU);return u}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function VN(t,e,n,r){n.addQueueMeasurement(K.InitializeBaseRequest,t.correlationId);const i=t.authority||e.auth.authority,s=[...t&&t.scopes||[]],o={...t,correlationId:t.correlationId,authority:i,scopes:s};if(!o.authenticationScheme)o.authenticationScheme=yn.BEARER,r.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(o.authenticationScheme===yn.SSH){if(!t.sshJwk)throw An(j0);if(!t.sshKid)throw An(pU)}r.verbose(`Authentication Scheme set to "${o.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&t.claims&&!Uo.isEmptyObj(t.claims)&&(o.requestedClaimsHash=await RB(t.claims)),o}async function sie(t,e,n,r,i){r.addQueueMeasurement(K.InitializeSilentRequest,t.correlationId);const s=await fe(VN,K.InitializeBaseRequest,i,r,t.correlationId)(t,n,r,i);return{...t,...s,account:e,forceRefresh:t.forceRefresh||!1}}function HB(t,e){let n;const r=t.httpMethod;if(e===Li.EAR){if(n=r||Ml.POST,n!==Ml.POST)throw An(yU)}else n=r||Ml.GET;if(t.authorizePostBodyParameters&&n!==Ml.POST)throw An(xU);return n}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Kf extends BB{initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e==null?void 0:e.correlationId);const n={correlationId:this.correlationId||po(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const r=this.getLogoutHintFromIdTokenClaims(e.account);r&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),n.logoutHint=r)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return!e||e.postLogoutRedirectUri!==null?e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",n.correlationId),n.postLogoutRedirectUri=en.getAbsoluteUrl(e.postLogoutRedirectUri,ba())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",n.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",n.correlationId),n.postLogoutRedirectUri=en.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,ba())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",n.correlationId),n.postLogoutRedirectUri=en.getAbsoluteUrl(ba(),ba())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",n.correlationId),n}getLogoutHintFromIdTokenClaims(e){const n=e.idTokenClaims;if(n){if(n.login_hint)return n.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(e){this.performanceClient.addQueueMeasurement(K.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const n=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new WU(n,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:n,requestAuthority:r,requestAzureCloudOptions:i,requestExtraQueryParameters:s,account:o}=e;this.performanceClient.addQueueMeasurement(K.StandardInteractionClientGetClientConfiguration,this.correlationId);const c=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,this.correlationId)({requestAuthority:r,requestAzureCloudOptions:i,requestExtraQueryParameters:s,account:o}),l=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:c,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:l.loggerCallback,piiLoggingEnabled:l.piiLoggingEnabled,logLevel:l.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:n,libraryInfo:{sku:Ti.MSAL_SKU,version:vu,cpu:pe.EMPTY_STRING,os:pe.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,n){this.performanceClient.addQueueMeasurement(K.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const r=this.getRedirectUri(e.redirectUri),i={interactionType:n},s=Vf.setRequestState(this.browserCrypto,e&&e.state||pe.EMPTY_STRING,i),c={...await fe(VN,K.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:r,state:s,nonce:e.nonce||po(),responseMode:this.config.auth.OIDCOptions.serverResponseType},l={...c,httpMethod:HB(c,this.config.auth.protocolMode)};if(e.loginHint||e.sid)return l;const u=e.account||this.browserStorage.getActiveAccount(this.correlationId);return u&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${u.homeAccountId}`,this.correlationId),l.account=u),l}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function oie(t,e){if(!e)return null;try{return Vf.parseRequestState(t,e).libraryState.meta}catch{throw Se(Jd)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function pp(t,e,n){const r=ex(t);if(!r)throw wU(t)?(n.error(`A ${e} is present in the iframe but it does not contain known properties. It's likely that the ${e} has been replaced by code running on the redirectUri page.`),n.errorPii(`The ${e} detected is: ${t}`),ze(eB)):(n.error(`The request has returned to the redirectUri but a ${e} is not present. It's likely that the ${e} has been removed or the page has been redirected by code running on the redirectUri page.`),ze(ZU));return r}function aie(t,e,n){if(!t.state)throw ze(PN);const r=oie(e,t.state);if(!r)throw ze(tB);if(r.interactionType!==n)throw ze(nB)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class zB{constructor(e,n,r,i,s){this.authModule=e,this.browserStorage=n,this.authCodeRequest=r,this.logger=i,this.performanceClient=s}async handleCodeResponse(e,n){this.performanceClient.addQueueMeasurement(K.HandleCodeResponse,n.correlationId);let r;try{r=Xne(e,n.state)}catch(i){throw i instanceof ku&&i.subError===tm?ze(tm):i}return fe(this.handleCodeResponseFromServer.bind(this),K.HandleCodeResponseFromServer,this.logger,this.performanceClient,n.correlationId)(r,n)}async handleCodeResponseFromServer(e,n,r=!0){if(this.performanceClient.addQueueMeasurement(K.HandleCodeResponseFromServer,n.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await fe(this.authModule.updateAuthority.bind(this.authModule),K.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,n.correlationId)(e.cloud_instance_host_name,n.correlationId),r&&(e.nonce=n.nonce||void 0),e.state=n.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const s=this.createCcsCredentials(n);s&&(this.authCodeRequest.ccsCredential=s)}return await fe(this.authModule.acquireToken.bind(this.authModule),K.AuthClientAcquireToken,this.logger,this.performanceClient,n.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:Ys.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:Ys.UPN}:null}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const cie="ContentError",VB="user_switch";/*! @azure/msal-browser v4.19.0 2025-08-05 */const lie="USER_INTERACTION_REQUIRED",uie="USER_CANCEL",die="NO_NETWORK",fie="PERSISTENT_ERROR",hie="DISABLED",pie="ACCOUNT_UNAVAILABLE",mie="UX_NOT_ALLOWED";/*! @azure/msal-browser v4.19.0 2025-08-05 */const gie=-2147186943,vie={[VB]:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."};class Io extends Cn{constructor(e,n,r){super(e,n),Object.setPrototypeOf(this,Io.prototype),this.name="NativeAuthError",this.ext=r}}function Qu(t){if(t.ext&&t.ext.status&&(t.ext.status===fie||t.ext.status===hie)||t.ext&&t.ext.error&&t.ext.error===gie)return!0;switch(t.errorCode){case cie:return!0;default:return!1}}function px(t,e,n){if(n&&n.status)switch(n.status){case pie:return lx(VU);case lie:return new ho(t,e);case uie:return ze(tm);case die:return ze(ux);case mie:return lx(CN)}return new Io(t,vie[t]||e,n)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class GB extends Kf{async acquireToken(e){this.performanceClient.addQueueMeasurement(K.SilentCacheClientAcquireToken,e.correlationId);const n=this.initializeServerTelemetryManager(Sn.acquireTokenSilent_silentFlow),r=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),i=new qne(r,this.performanceClient);this.logger.verbose("Silent auth client created");try{const o=(await fe(i.acquireCachedToken.bind(i),K.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),o}catch(s){throw s instanceof bg&&s.errorCode===kN&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),s}}logout(e){this.logger.verbose("logoutRedirect called");const n=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(n.correlationId,n==null?void 0:n.account)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class iy extends BB{constructor(e,n,r,i,s,o,c,l,u,d,f,h){super(e,n,r,i,s,o,l,u,h),this.apiId=c,this.accountId=d,this.platformAuthProvider=u,this.nativeStorageManager=f,this.silentCacheClient=new GB(e,this.nativeStorageManager,r,i,s,o,l,u,h);const p=this.platformAuthProvider.getExtensionName();this.skus=em.makeExtraSkuString({libraryName:Ti.MSAL_SKU,libraryVersion:vu,extensionName:p,extensionVersion:this.platformAuthProvider.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[lne]:this.skus}}async acquireToken(e,n){this.performanceClient.addQueueMeasurement(K.NativeInteractionClientAcquireToken,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const r=this.performanceClient.startMeasurement(K.NativeInteractionClientAcquireToken,e.correlationId),i=Fi(),s=this.initializeServerTelemetryManager(this.apiId);try{const o=await this.initializeNativeRequest(e);try{const l=await this.acquireTokensFromCache(this.accountId,o);return r.end({success:!0,isNativeBroker:!1,fromCache:!0}),l}catch(l){if(n===ui.AccessToken)throw this.logger.info("MSAL internal Cache does not contain tokens, return error as per cache policy"),l;this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const c=await this.platformAuthProvider.sendMessage(o);return await this.handleNativeResponse(c,o,i).then(l=>(r.end({success:!0,isNativeBroker:!0,requestId:l.requestId}),s.clearNativeBrokerErrorCode(),l)).catch(l=>{throw r.end({success:!1,errorCode:l.errorCode,subErrorCode:l.subError,isNativeBroker:!0}),l})}catch(o){throw o instanceof Io&&s.setNativeBrokerErrorCode(o.errorCode),o}}createSilentCacheRequest(e,n){return{authority:e.authority,correlationId:this.correlationId,scopes:Er.fromString(e.scope).asArray(),account:n,forceRefresh:!1}}async acquireTokensFromCache(e,n){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),Se(rA);const r=this.browserStorage.getBaseAccountInfo({nativeAccountId:e},this.correlationId);if(!r)throw Se(rA);try{const i=this.createSilentCacheRequest(n,r),s=await this.silentCacheClient.acquireToken(i),o={...r,idTokenClaims:s==null?void 0:s.idTokenClaims,idToken:s==null?void 0:s.idToken};return{...s,account:o}}catch(i){throw i}}async acquireTokenRedirect(e,n){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...r}=e;delete r.onRedirectNavigate;const i=await this.initializeNativeRequest(r);try{await this.platformAuthProvider.sendMessage(i)}catch(c){if(c instanceof Io&&(this.initializeServerTelemetryManager(this.apiId).setNativeBrokerErrorCode(c.errorCode),Qu(c)))throw c}this.browserStorage.setTemporaryCache(hr.NATIVE_REQUEST,JSON.stringify(i),!0);const s={apiId:Sn.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},o=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);n.end({success:!0}),await this.navigationClient.navigateExternal(o,s)}async handleRedirectPromise(e,n){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const r=this.browserStorage.getCachedNativeRequest();if(!r)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),e&&n&&(e==null||e.addFields({errorCode:"no_cached_request"},n)),null;const{prompt:i,...s}=r;i&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(hr.NATIVE_REQUEST));const o=Fi();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const c=await this.platformAuthProvider.sendMessage(s),l=await this.handleNativeResponse(c,s,o);return this.initializeServerTelemetryManager(this.apiId).clearNativeBrokerErrorCode(),l}catch(c){throw c}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,n,r){var d,f;this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const i=zf(e.id_token,to),s=this.createHomeAccountIdentifier(e,i),o=(d=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:n.accountId},this.correlationId))==null?void 0:d.homeAccountId;if((f=n.extraParameters)!=null&&f.child_client_id&&e.account.id!==n.accountId)this.logger.info("handleNativeServerResponse: Double broker flow detected, ignoring accountId mismatch");else if(s!==o&&e.account.id!==n.accountId)throw px(VB);const c=await this.getDiscoveredAuthority({requestAuthority:n.authority}),l=_N(this.browserStorage,c,s,to,this.correlationId,i,e.client_info,void 0,i.tid,void 0,e.account.id,this.logger);e.expires_in=Number(e.expires_in);const u=await this.generateAuthenticationResult(e,n,i,l,c.canonicalAuthority,r);return await this.cacheAccount(l,this.correlationId),await this.cacheNativeTokens(e,n,s,i,e.access_token,u.tenantId,r),u}createHomeAccountIdentifier(e,n){return fo.generateHomeAccountId(e.client_info||pe.EMPTY_STRING,zs.Default,this.logger,this.browserCrypto,n)}generateScopes(e,n){return n?Er.fromString(n):Er.fromString(e)}async generatePopAccessToken(e,n){if(n.tokenType===yn.POP&&n.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const r=new Zd(this.browserCrypto),i={resourceRequestMethod:n.resourceRequestMethod,resourceRequestUri:n.resourceRequestUri,shrClaims:n.shrClaims,shrNonce:n.shrNonce};if(!n.keyId)throw Se(JE);return r.signPopToken(e.access_token,n.keyId,i)}else return e.access_token}async generateAuthenticationResult(e,n,r,i,s,o){const c=this.addTelemetryFromNativeResponse(e.properties.MATS),l=this.generateScopes(n.scope,e.scope),u=e.account.properties||{},d=u.UID||r.oid||r.sub||pe.EMPTY_STRING,f=u.TenantId||r.tid||pe.EMPTY_STRING,h=aN(i.getAccountInfo(),void 0,r,e.id_token);h.nativeAccountId!==e.account.id&&(h.nativeAccountId=e.account.id);const p=await this.generatePopAccessToken(e,n),g=n.tokenType===yn.POP?yn.POP:yn.BEARER;return{authority:s,uniqueId:d,tenantId:f,scopes:l.asArray(),account:h,idToken:e.id_token,idTokenClaims:r,accessToken:p,fromCache:c?this.isResponseFromCache(c):!1,expiresOn:Ad(o+e.expires_in),tokenType:g,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}async cacheAccount(e,n){await this.browserStorage.setAccount(e,this.correlationId),this.browserStorage.removeAccountContext(e.getAccountInfo(),n)}cacheNativeTokens(e,n,r,i,s,o,c){const l=P0(r,n.authority,e.id_token||"",n.clientId,i.tid||""),u=n.tokenType===yn.POP?pe.SHR_NONCE_VALIDITY:(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,d=c+u,f=this.generateScopes(e.scope,n.scope),h=k0(r,n.authority,s,n.clientId,i.tid||o,f.printScopes(),d,0,to,void 0,n.tokenType,void 0,n.keyId),p={idToken:l,accessToken:h};return this.nativeStorageManager.saveCacheRecord(p,this.correlationId,n.storeInCache)}getExpiresInValue(e,n){return e===yn.POP?pe.SHR_NONCE_VALIDITY:(typeof n=="string"?parseInt(n,10):n)||0}addTelemetryFromNativeResponse(e){const n=this.getMATSFromResponse(e);return n?(this.performanceClient.addFields({extensionId:this.platformAuthProvider.getExtensionId(),extensionVersion:this.platformAuthProvider.getExtensionVersion(),matsBrokerVersion:n.broker_version,matsAccountJoinOnStart:n.account_join_on_start,matsAccountJoinOnEnd:n.account_join_on_end,matsDeviceJoin:n.device_join,matsPromptBehavior:n.prompt_behavior,matsApiErrorCode:n.api_error_code,matsUiVisible:n.ui_visible,matsSilentCode:n.silent_code,matsSilentBiSubCode:n.silent_bi_sub_code,matsSilentMessage:n.silent_message,matsSilentStatus:n.silent_status,matsHttpStatus:n.http_status,matsHttpEventCount:n.http_event_count},this.correlationId),n):null}getMATSFromResponse(e){if(e)try{return JSON.parse(e)}catch{this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return typeof e.is_cached>"u"?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(e){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const n=await this.getCanonicalAuthority(e),{scopes:r,...i}=e,s=new Er(r||[]);s.appendScopes(xg);const o={...i,accountId:this.accountId,clientId:this.config.auth.clientId,authority:n.urlString,scope:s.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:this.getPrompt(e.prompt),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(o.signPopToken&&e.popKid)throw ze(_B);if(this.handleExtraBrokerParams(o),o.extraParameters=o.extraParameters||{},o.extraParameters.telemetry=ys.MATS_TELEMETRY,e.authenticationScheme===yn.POP){const c={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},l=new Zd(this.browserCrypto);let u;if(o.keyId)u=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:o.keyId})),o.signPopToken=!1;else{const d=await fe(l.generateCnf.bind(l),K.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(c,this.logger);u=d.reqCnfString,o.keyId=d.kid,o.signPopToken=!0}o.reqCnf=u}return this.addRequestSKUs(o),o}async getCanonicalAuthority(e){const n=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:n,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const r=new en(n);return r.validateAsUri(),r}getPrompt(e){switch(this.apiId){case Sn.ssoSilent:case Sn.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),gi.NONE}if(!e){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e){case gi.NONE:case gi.CONSENT:case gi.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e} is not compatible with native flow`),ze(SB)}}handleExtraBrokerParams(e){var s;const n=e.extraParameters&&e.extraParameters.hasOwnProperty(ix)&&e.extraParameters.hasOwnProperty(sx)&&e.extraParameters.hasOwnProperty(mu);if(!e.embeddedClientId&&!n)return;let r="";const i=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,r=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[sx],r=e.extraParameters[mu]),e.extraParameters={child_client_id:r,child_redirect_uri:i},(s=this.performanceClient)==null||s.addFields({embeddedClientId:r,embeddedRedirectUri:i},e.correlationId)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function GN(t,e,n,r,i){const s=Qne({...t.auth,authority:e},n,r,i);if(gN(s,{sku:Ti.MSAL_SKU,version:vu,os:"",cpu:""}),t.auth.protocolMode!==Li.OIDC&&vN(s,t.telemetry.application),n.platformBroker&&(hne(s),n.authenticationScheme===yn.POP)){const o=new La(r,i),c=new Zd(o);let l;n.popKid?l=o.encodeKid(n.popKid):l=(await fe(c.generateCnf.bind(c),K.PopTokenGenerateCnf,r,i,n.correlationId)(n,r)).reqCnfString,xN(s,l)}return E0(s,n.correlationId,i),s}async function KN(t,e,n,r,i){if(!n.codeChallenge)throw An(rN);const s=await fe(GN,K.GetStandardParams,r,i,n.correlationId)(t,e,n,r,i);return uN(s,GE.CODE),kU(s,n.codeChallenge,pe.S256_CODE_CHALLENGE_METHOD),Dc(s,n.extraQueryParameters||{}),AN(e,s,t.auth.encodeExtraQueryParams,n.extraQueryParameters)}async function WN(t,e,n,r,i,s){if(!r.earJwk)throw ze(TN);const o=await GN(e,n,r,i,s);uN(o,GE.IDTOKEN_TOKEN_REFRESHTOKEN),_ne(o,r.earJwk);const c=new Map;Dc(c,r.extraQueryParameters||{});const l=AN(n,c,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return KB(t,l,o)}async function qN(t,e,n,r,i,s){const o=await GN(e,n,r,i,s);uN(o,GE.CODE),kU(o,r.codeChallenge,r.codeChallengeMethod||pe.S256_CODE_CHALLENGE_METHOD),Ane(o,r.authorizePostBodyParameters||{});const c=new Map;Dc(c,r.extraQueryParameters||{});const l=AN(n,c,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return KB(t,l,o)}function KB(t,e,n){const r=t.createElement("form");return r.method="post",r.action=e,n.forEach((i,s)=>{const o=t.createElement("input");o.hidden=!0,o.name=s,o.value=i,r.appendChild(o)}),t.body.appendChild(r),r}async function WB(t,e,n,r,i,s,o,c,l,u){if(c.verbose("Account id found, calling WAM for token"),!u)throw ze(IN);const d=new La(c,l),f=new iy(r,i,d,c,o,r.system.navigationClient,n,l,u,e,s,t.correlationId),{userRequestState:h}=Vf.parseRequestState(d,t.state);return fe(f.acquireToken.bind(f),K.NativeInteractionClientAcquireToken,c,l,t.correlationId)({...t,state:h,prompt:void 0})}async function mx(t,e,n,r,i,s,o,c,l,u,d,f){if(Oo.removeThrottle(o,i.auth.clientId,t),e.accountId)return fe(WB,K.HandleResponsePlatformBroker,u,d,t.correlationId)(t,e.accountId,r,i,o,c,l,u,d,f);const h={...t,code:e.code||"",codeVerifier:n},p=new zB(s,o,h,u,d);return await fe(p.handleCodeResponse.bind(p),K.HandleCodeResponse,u,d,t.correlationId)(e,t)}async function YN(t,e,n,r,i,s,o,c,l,u,d){if(Oo.removeThrottle(s,r.auth.clientId,t),qU(e,t.state),!e.ear_jwe)throw ze(JU);if(!t.earJwk)throw ze(TN);const f=JSON.parse(await fe(Are,K.DecryptEarResponse,l,u,t.correlationId)(t.earJwk,e.ear_jwe));if(f.accountId)return fe(WB,K.HandleResponsePlatformBroker,l,u,t.correlationId)(t,f.accountId,n,r,s,o,c,l,u,d);const h=new gu(r.auth.clientId,s,new La(l,u),l,null,null,u);h.validateTokenResponse(f);const p={code:"",state:t.state,nonce:t.nonce,client_info:f.client_info,cloud_graph_host_name:f.cloud_graph_host_name,cloud_instance_host_name:f.cloud_instance_host_name,cloud_instance_name:f.cloud_instance_name,msgraph_host:f.msgraph_host};return await fe(h.handleServerTokenResponse.bind(h),K.HandleServerTokenResponse,l,u,t.correlationId)(f,i,Fi(),t,p,void 0,void 0,void 0,void 0)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const yie=32;async function F0(t,e,n){t.addQueueMeasurement(K.GeneratePkceCodes,n);const r=ts(xie,K.GenerateCodeVerifier,e,t,n)(t,e,n),i=await fe(bie,K.GenerateCodeChallengeFromVerifier,e,t,n)(r,t,e,n);return{verifier:r,challenge:i}}function xie(t,e,n){try{const r=new Uint8Array(yie);return ts(bre,K.GetRandomValues,e,t,n)(r),Zc(r)}catch{throw ze(NN)}}async function bie(t,e,n,r){e.addQueueMeasurement(K.GenerateCodeChallengeFromVerifier,r);try{const i=await fe(kB,K.Sha256Digest,n,e,r)(t,e,r);return Zc(new Uint8Array(i))}catch{throw ze(NN)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class gx{constructor(e,n,r,i){this.logger=e,this.handshakeTimeoutMs=n,this.extensionId=i,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=r,this.handshakeEvent=r.startMeasurement(K.NativeMessageHandlerHandshake),this.platformAuthType=ys.PLATFORM_EXTENSION_PROVIDER}async sendMessage(e){this.logger.trace(this.platformAuthType+" - sendMessage called.");const n={method:Ah.GetToken,request:e},r={channel:ys.CHANNEL_ID,extensionId:this.extensionId,responseId:po(),body:n};this.logger.trace(this.platformAuthType+" - Sending request to browser extension"),this.logger.tracePii(this.platformAuthType+` - Sending request to browser extension: ${JSON.stringify(r)}`),this.messageChannel.port1.postMessage(r);const i=await new Promise((o,c)=>{this.resolvers.set(r.responseId,{resolve:o,reject:c})});return this.validatePlatformBrokerResponse(i)}static async createProvider(e,n,r){e.trace("PlatformAuthExtensionHandler - createProvider called.");try{const i=new gx(e,n,r,ys.PREFERRED_EXTENSION_ID);return await i.sendHandshakeRequest(),i}catch{const s=new gx(e,n,r);return await s.sendHandshakeRequest(),s}}async sendHandshakeRequest(){this.logger.trace(this.platformAuthType+" - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:ys.CHANNEL_ID,extensionId:this.extensionId,responseId:po(),body:{method:Ah.HandshakeRequest}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=n=>{this.onChannelMessage(n)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((n,r)=>{this.handshakeResolvers.set(e.responseId,{resolve:n,reject:r}),this.timeoutId=window.setTimeout(()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.end({extensionHandshakeTimedOut:!0,success:!1}),r(ze(bB)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace(this.platformAuthType+" - onWindowMessage called"),e.source!==window)return;const n=e.data;if(!(!n.channel||n.channel!==ys.CHANNEL_ID)&&!(n.extensionId&&n.extensionId!==this.extensionId)&&n.body.method===Ah.HandshakeRequest){const r=this.handshakeResolvers.get(n.responseId);if(!r){this.logger.trace(this.platformAuthType+`.onWindowMessage - resolver can't be found for request ${n.responseId}`);return}this.logger.verbose(n.extensionId?`Extension with id: ${n.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.end({success:!1,extensionInstalled:!1}),r.reject(ze(wB))}}onChannelMessage(e){this.logger.trace(this.platformAuthType+" - onChannelMessage called.");const n=e.data,r=this.resolvers.get(n.responseId),i=this.handshakeResolvers.get(n.responseId);try{const s=n.body.method;if(s===Ah.Response){if(!r)return;const o=n.body.response;if(this.logger.trace(this.platformAuthType+" - Received response from browser extension"),this.logger.tracePii(this.platformAuthType+` - Received response from browser extension: ${JSON.stringify(o)}`),o.status!=="Success")r.reject(px(o.code,o.description,o.ext));else if(o.result)o.result.code&&o.result.description?r.reject(px(o.result.code,o.result.description,o.result.ext)):r.resolve(o.result);else throw eA(Jy,"Event does not contain result.");this.resolvers.delete(n.responseId)}else if(s===Ah.HandshakeResponse){if(!i){this.logger.trace(this.platformAuthType+`.onChannelMessage - resolver can't be found for request ${n.responseId}`);return}clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=n.extensionId,this.extensionVersion=n.body.version,this.logger.verbose(this.platformAuthType+` - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),i.resolve(),this.handshakeResolvers.delete(n.responseId)}}catch(s){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${s}`),this.logger.errorPii(`Unable to parse ${e}`),r?r.reject(s):i&&i.reject(s)}}validatePlatformBrokerResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw eA(Jy,"Response missing expected properties.")}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}getExtensionName(){var e;return this.getExtensionId()===ys.PREFERRED_EXTENSION_ID?"chrome":(e=this.getExtensionId())!=null&&e.length?"unknown":void 0}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class QN{constructor(e,n,r){this.logger=e,this.performanceClient=n,this.correlationId=r,this.platformAuthType=ys.PLATFORM_DOM_PROVIDER}static async createProvider(e,n,r){var i;if(e.trace("PlatformAuthDOMHandler: createProvider called"),(i=window.navigator)!=null&&i.platformAuthentication){const s=await window.navigator.platformAuthentication.getSupportedContracts(ys.MICROSOFT_ENTRA_BROKERID);if(s!=null&&s.includes(ys.PLATFORM_DOM_APIS))return e.trace("Platform auth api available in DOM"),new QN(e,n,r)}}getExtensionId(){return ys.MICROSOFT_ENTRA_BROKERID}getExtensionVersion(){return""}getExtensionName(){return ys.DOM_API_NAME}async sendMessage(e){this.logger.trace(this.platformAuthType+" - Sending request to browser DOM API");try{const n=this.initializePlatformDOMRequest(e),r=await window.navigator.platformAuthentication.executeGetToken(n);return this.validatePlatformBrokerResponse(r)}catch(n){throw this.logger.error(this.platformAuthType+" - executeGetToken DOM API error"),n}}initializePlatformDOMRequest(e){this.logger.trace(this.platformAuthType+" - initializeNativeDOMRequest called");const{accountId:n,clientId:r,authority:i,scope:s,redirectUri:o,correlationId:c,state:l,storeInCache:u,embeddedClientId:d,extraParameters:f,...h}=e,p=this.getDOMExtraParams(h);return{accountId:n,brokerId:this.getExtensionId(),authority:i,clientId:r,correlationId:c||this.correlationId,extraParameters:{...f,...p},isSecurityTokenService:!1,redirectUri:o,scope:s,state:l,storeInCache:u,embeddedClientId:d}}validatePlatformBrokerResponse(e){if(e.hasOwnProperty("isSuccess")){if(e.hasOwnProperty("accessToken")&&e.hasOwnProperty("idToken")&&e.hasOwnProperty("clientInfo")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scopes")&&e.hasOwnProperty("expiresIn"))return this.logger.trace(this.platformAuthType+" - platform broker returned successful and valid response"),this.convertToPlatformBrokerResponse(e);if(e.hasOwnProperty("error")){const n=e;if(n.isSuccess===!1&&n.error&&n.error.code)throw this.logger.trace(this.platformAuthType+" - platform broker returned error response"),px(n.error.code,n.error.description,{error:parseInt(n.error.errorCode),protocol_error:n.error.protocolError,status:n.error.status,properties:n.error.properties})}}throw eA(Jy,"Response missing expected properties.")}convertToPlatformBrokerResponse(e){return this.logger.trace(this.platformAuthType+" - convertToNativeResponse called"),{access_token:e.accessToken,id_token:e.idToken,client_info:e.clientInfo,account:e.account,expires_in:e.expiresIn,scope:e.scopes,state:e.state||"",properties:e.properties||{},extendedLifetimeToken:e.extendedLifetimeToken??!1,shr:e.proofOfPossessionPayload}}getDOMExtraParams(e){return{...Object.entries(e).reduce((i,[s,o])=>(i[s]=String(o),i),{})}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function wie(t,e,n,r){t.trace("getPlatformAuthProvider called",n);const i=Sie();t.trace("Has client allowed platform auth via DOM API: "+i);let s;try{i&&(s=await QN.createProvider(t,e,n)),s||(t.trace("Platform auth via DOM API not available, checking for extension"),s=await gx.createProvider(t,r||FB,e))}catch(o){t.trace("Platform auth not available",o)}return s}function Sie(){let t;try{return t=window[Nr.SessionStorage],(t==null?void 0:t.getItem(Bre))==="true"}catch{return!1}}function im(t,e,n,r){if(e.trace("isPlatformAuthAllowed called"),!t.system.allowPlatformBroker)return e.trace("isPlatformAuthAllowed: allowPlatformBroker is not enabled, returning false"),!1;if(!n)return e.trace("isPlatformAuthAllowed: Platform auth provider is not initialized, returning false"),!1;if(r)switch(r){case yn.BEARER:case yn.POP:return e.trace("isPlatformAuthAllowed: authenticationScheme is supported, returning true"),!0;default:return e.trace("isPlatformAuthAllowed: authenticationScheme is not supported, returning false"),!1}return!0}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Cie extends Kf{constructor(e,n,r,i,s,o,c,l,u,d){super(e,n,r,i,s,o,c,u,d),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=l,this.eventHandler=s}acquireToken(e,n){let r;try{if(r={popupName:this.generatePopupName(e.scopes||xg,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window},this.performanceClient.addFields({isAsyncPopup:this.config.system.asyncPopups},this.correlationId),this.config.system.asyncPopups)return this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,r,n);{const s={...e,httpMethod:HB(e,this.config.auth.protocolMode)};return this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),r.popup=this.openSizedPopup("about:blank",r),this.acquireTokenPopupAsync(s,r,n)}}catch(i){return Promise.reject(i)}}logout(e){try{this.logger.verbose("logoutPopup called");const n=this.initializeLogoutRequest(e),r={popupName:this.generateLogoutPopupName(n),popupWindowAttributes:(e==null?void 0:e.popupWindowAttributes)||{},popupWindowParent:(e==null?void 0:e.popupWindowParent)??window},i=e&&e.authority,s=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(n,r,i,s)):(this.logger.verbose("asyncPopup set to false, opening popup"),r.popup=this.openSizedPopup("about:blank",r),this.logoutPopupAsync(n,r,i,s))}catch(n){return Promise.reject(n)}}async acquireTokenPopupAsync(e,n,r){this.logger.verbose("acquireTokenPopupAsync called");const i=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,xt.Popup);n.popup&&LB(i.authority);const s=im(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme);return i.platformBroker=s,this.config.auth.protocolMode===Li.EAR?this.executeEarFlow(i,n):this.executeCodeFlow(i,n,r)}async executeCodeFlow(e,n,r){var l;const i=e.correlationId,s=this.initializeServerTelemetryManager(Sn.acquireTokenPopup),o=r||await fe(F0,K.GeneratePkceCodes,this.logger,this.performanceClient,i)(this.performanceClient,this.logger,i),c={...e,codeChallenge:o.challenge};try{const u=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,i)({serverTelemetryManager:s,requestAuthority:c.authority,requestAzureCloudOptions:c.azureCloudOptions,requestExtraQueryParameters:c.extraQueryParameters,account:c.account});if(c.httpMethod===Ml.POST)return await this.executeCodeFlowWithPost(c,n,u,o.verifier);{const d=await fe(KN,K.GetAuthCodeUrl,this.logger,this.performanceClient,i)(this.config,u.authority,c,this.logger,this.performanceClient),f=this.initiateAuthRequest(d,n);this.eventHandler.emitEvent(qe.POPUP_OPENED,xt.Popup,{popupWindow:f},null);const h=await this.monitorPopupForHash(f,n.popupWindowParent),p=ts(pp,K.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(h,this.config.auth.OIDCOptions.serverResponseType,this.logger);return await fe(mx,K.HandleResponseCode,this.logger,this.performanceClient,i)(e,p,o.verifier,Sn.acquireTokenPopup,this.config,u,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}}catch(u){throw(l=n.popup)==null||l.close(),u instanceof Cn&&(u.setCorrelationId(this.correlationId),s.cacheFailedRequest(u)),u}}async executeEarFlow(e,n){const r=e.correlationId,i=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,r)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),s=await fe(LN,K.GenerateEarKey,this.logger,this.performanceClient,r)(),o={...e,earJwk:s},c=n.popup||this.openPopup("about:blank",n);(await WN(c.document,this.config,i,o,this.logger,this.performanceClient)).submit();const u=await fe(this.monitorPopupForHash.bind(this),K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(c,n.popupWindowParent),d=ts(pp,K.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);return fe(YN,K.HandleResponseEar,this.logger,this.performanceClient,r)(o,d,Sn.acquireTokenPopup,this.config,i,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async executeCodeFlowWithPost(e,n,r,i){const s=e.correlationId,o=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,s)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),c=n.popup||this.openPopup("about:blank",n);(await qN(c.document,this.config,o,e,this.logger,this.performanceClient)).submit();const u=await fe(this.monitorPopupForHash.bind(this),K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,s)(c,n.popupWindowParent),d=ts(pp,K.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);return fe(mx,K.HandleResponseCode,this.logger,this.performanceClient,s)(e,d,i,Sn.acquireTokenPopup,this.config,r,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async logoutPopupAsync(e,n,r,i){var o,c,l;this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(qe.LOGOUT_START,xt.Popup,e);const s=this.initializeServerTelemetryManager(Sn.logoutPopup);try{await this.clearCacheOnLogout(this.correlationId,e.account);const u=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:s,requestAuthority:r,account:e.account||void 0});try{u.authority.endSessionEndpoint}catch{if((o=e.account)!=null&&o.homeAccountId&&e.postLogoutRedirectUri&&u.authority.protocolMode===Li.OIDC){if(this.eventHandler.emitEvent(qe.LOGOUT_SUCCESS,xt.Popup,e),i){const h={apiId:Sn.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},p=en.getAbsoluteUrl(i,ba());await this.navigationClient.navigateInternal(p,h)}(c=n.popup)==null||c.close();return}}const d=u.getLogoutUri(e);this.eventHandler.emitEvent(qe.LOGOUT_SUCCESS,xt.Popup,e);const f=this.openPopup(d,n);if(this.eventHandler.emitEvent(qe.POPUP_OPENED,xt.Popup,{popupWindow:f},null),await this.monitorPopupForHash(f,n.popupWindowParent).catch(()=>{}),i){const h={apiId:Sn.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},p=en.getAbsoluteUrl(i,ba());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${p}`),await this.navigationClient.navigateInternal(p,h)}else this.logger.verbose("No main window navigation requested")}catch(u){throw(l=n.popup)==null||l.close(),u instanceof Cn&&(u.setCorrelationId(this.correlationId),s.cacheFailedRequest(u)),this.eventHandler.emitEvent(qe.LOGOUT_FAILURE,xt.Popup,null,u),this.eventHandler.emitEvent(qe.LOGOUT_END,xt.Popup),u}this.eventHandler.emitEvent(qe.LOGOUT_END,xt.Popup)}initiateAuthRequest(e,n){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,n);throw this.logger.error("Navigate url is empty"),ze(M0)}monitorPopupForHash(e,n){return new Promise((r,i)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const s=setInterval(()=>{if(e.closed){this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(s),i(ze(tm));return}let o="";try{o=e.location.href}catch{}if(!o||o==="about:blank")return;clearInterval(s);let c="";const l=this.config.auth.OIDCOptions.serverResponseType;e&&(l===A0.QUERY?c=e.location.search:c=e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),r(c)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,n)})}openPopup(e,n){try{let r;if(n.popup?(r=n.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),r.location.assign(e)):typeof n.popup>"u"&&(this.logger.verbosePii(`Opening popup window to: ${e}`),r=this.openSizedPopup(e,n)),!r)throw ze(sB);return r.focus&&r.focus(),this.currentWindow=r,n.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),r}catch(r){throw this.logger.error("error opening popup "+r.message),ze(iB)}}openSizedPopup(e,{popupName:n,popupWindowAttributes:r,popupWindowParent:i}){var p,g,m,v;const s=i.screenLeft?i.screenLeft:i.screenX,o=i.screenTop?i.screenTop:i.screenY,c=i.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,l=i.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let u=(p=r.popupSize)==null?void 0:p.width,d=(g=r.popupSize)==null?void 0:g.height,f=(m=r.popupPosition)==null?void 0:m.top,h=(v=r.popupPosition)==null?void 0:v.left;return(!u||u<0||u>c)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),u=Ti.POPUP_WIDTH),(!d||d<0||d>l)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),d=Ti.POPUP_HEIGHT),(!f||f<0||f>l)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),f=Math.max(0,l/2-Ti.POPUP_HEIGHT/2+o)),(!h||h<0||h>c)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),h=Math.max(0,c/2-Ti.POPUP_WIDTH/2+s)),i.open(e,n,`width=${u}, height=${d}, top=${f}, left=${h}, scrollbars=yes`)}unloadWindow(e){this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,n){e.close(),n.removeEventListener("beforeunload",this.unloadWindow)}generatePopupName(e,n){return`${Ti.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${n}.${this.correlationId}`}generateLogoutPopupName(e){const n=e.account&&e.account.homeAccountId;return`${Ti.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${n}.${this.correlationId}`}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function _ie(){if(typeof window>"u"||typeof window.performance>"u"||typeof window.performance.getEntriesByType!="function")return;const t=window.performance.getEntriesByType("navigation"),e=t.length?t[0]:void 0;return e==null?void 0:e.type}class Aie extends Kf{constructor(e,n,r,i,s,o,c,l,u,d){super(e,n,r,i,s,o,c,u,d),this.nativeStorage=l}async acquireToken(e){const n=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,xt.Redirect);n.platformBroker=im(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme);const r=s=>{s.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.resetRequestCache(),this.eventHandler.emitEvent(qe.RESTORE_FROM_BFCACHE,xt.Redirect))},i=this.getRedirectStartPage(e.redirectStartPage);this.logger.verbosePii(`Redirect start page: ${i}`),this.browserStorage.setTemporaryCache(hr.ORIGIN_URI,i,!0),window.addEventListener("pageshow",r);try{this.config.auth.protocolMode===Li.EAR?await this.executeEarFlow(n):await this.executeCodeFlow(n,e.onRedirectNavigate)}catch(s){throw s instanceof Cn&&s.setCorrelationId(this.correlationId),window.removeEventListener("pageshow",r),s}}async executeCodeFlow(e,n){const r=e.correlationId,i=this.initializeServerTelemetryManager(Sn.acquireTokenRedirect),s=await fe(F0,K.GeneratePkceCodes,this.logger,this.performanceClient,r)(this.performanceClient,this.logger,r),o={...e,codeChallenge:s.challenge};this.browserStorage.cacheAuthorizeRequest(o,s.verifier);try{if(o.httpMethod===Ml.POST)return await this.executeCodeFlowWithPost(o);{const c=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:o.authority,requestAzureCloudOptions:o.azureCloudOptions,requestExtraQueryParameters:o.extraQueryParameters,account:o.account}),l=await fe(KN,K.GetAuthCodeUrl,this.logger,this.performanceClient,e.correlationId)(this.config,c.authority,o,this.logger,this.performanceClient);return await this.initiateAuthRequest(l,n)}}catch(c){throw c instanceof Cn&&(c.setCorrelationId(this.correlationId),i.cacheFailedRequest(c)),c}}async executeEarFlow(e){const n=e.correlationId,r=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await fe(LN,K.GenerateEarKey,this.logger,this.performanceClient,n)(),s={...e,earJwk:i};return this.browserStorage.cacheAuthorizeRequest(s),(await WN(document,this.config,r,s,this.logger,this.performanceClient)).submit(),new Promise((c,l)=>{setTimeout(()=>{l(ze(dx,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async executeCodeFlowWithPost(e){const n=e.correlationId,r=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return this.browserStorage.cacheAuthorizeRequest(e),(await qN(document,this.config,r,e,this.logger,this.performanceClient)).submit(),new Promise((s,o)=>{setTimeout(()=>{o(ze(dx,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async handleRedirectPromise(e="",n,r,i){const s=this.initializeServerTelemetryManager(Sn.handleRedirectPromise);try{const[o,c]=this.getRedirectResponse(e||"");if(!o)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.resetRequestCache(),_ie()!=="back_forward"?i.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const l=this.browserStorage.getTemporaryCache(hr.ORIGIN_URI,!0)||pe.EMPTY_STRING,u=en.removeHashFromUrl(l),d=en.removeHashFromUrl(window.location.href);if(u===d&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),l.indexOf("#")>-1&&Ere(l),await this.handleResponse(o,n,r,s);if(this.config.auth.navigateToLoginRequestUrl){if(!UN()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(hr.URL_HASH,c,!0);const f={apiId:Sn.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let h=!0;if(!l||l==="null"){const p=Tre();this.browserStorage.setTemporaryCache(hr.ORIGIN_URI,p,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),h=await this.navigationClient.navigateInternal(p,f)}else this.logger.verbose(`Navigating to loginRequestUrl: ${l}`),h=await this.navigationClient.navigateInternal(l,f);if(!h)return await this.handleResponse(o,n,r,s)}}else return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(o,n,r,s);return null}catch(o){throw o instanceof Cn&&(o.setCorrelationId(this.correlationId),s.cacheFailedRequest(o)),o}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let n=e;n||(this.config.auth.OIDCOptions.serverResponseType===A0.QUERY?n=window.location.search:n=window.location.hash);let r=ex(n);if(r){try{aie(r,this.browserCrypto,xt.Redirect)}catch(s){return s instanceof Cn&&this.logger.error(`Interaction type validation failed due to ${s.errorCode}: ${s.errorMessage}`),[null,""]}return MB(window),this.logger.verbose("Hash contains known properties, returning response hash"),[r,n]}const i=this.browserStorage.getTemporaryCache(hr.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(hr.URL_HASH)),i&&(r=ex(i),r)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[r,i]):[null,""]}async handleResponse(e,n,r,i){if(!e.state)throw ze(PN);if(e.ear_jwe){const c=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n.correlationId)({requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account});return fe(YN,K.HandleResponseEar,this.logger,this.performanceClient,n.correlationId)(n,e,Sn.acquireTokenRedirect,this.config,c,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}const o=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:n.authority});return fe(mx,K.HandleResponseCode,this.logger,this.performanceClient,n.correlationId)(n,e,r,Sn.acquireTokenRedirect,this.config,o,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async initiateAuthRequest(e,n){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const r={apiId:Sn.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},i=n||this.config.auth.onRedirectNavigate;if(typeof i=="function")if(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),i(e)!==!1){this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),await this.navigationClient.navigateExternal(e,r);return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation");return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),await this.navigationClient.navigateExternal(e,r);return}}else throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),ze(M0)}async logout(e){var i;this.logger.verbose("logoutRedirect called");const n=this.initializeLogoutRequest(e),r=this.initializeServerTelemetryManager(Sn.logout);try{this.eventHandler.emitEvent(qe.LOGOUT_START,xt.Redirect,e),await this.clearCacheOnLogout(this.correlationId,n.account);const s={apiId:Sn.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},o=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:e&&e.authority,requestExtraQueryParameters:e==null?void 0:e.extraQueryParameters,account:e&&e.account||void 0});if(o.authority.protocolMode===Li.OIDC)try{o.authority.endSessionEndpoint}catch{if((i=n.account)!=null&&i.homeAccountId){this.eventHandler.emitEvent(qe.LOGOUT_SUCCESS,xt.Redirect,n);return}}const c=o.getLogoutUri(n);if(this.eventHandler.emitEvent(qe.LOGOUT_SUCCESS,xt.Redirect,n),e&&typeof e.onRedirectNavigate=="function")if(e.onRedirectNavigate(c)!==!1){this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0,uc.SIGNOUT),await this.navigationClient.navigateExternal(c,s);return}else this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");else{this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0,uc.SIGNOUT),await this.navigationClient.navigateExternal(c,s);return}}catch(s){throw s instanceof Cn&&(s.setCorrelationId(this.correlationId),r.cacheFailedRequest(s)),this.eventHandler.emitEvent(qe.LOGOUT_FAILURE,xt.Redirect,null,s),this.eventHandler.emitEvent(qe.LOGOUT_END,xt.Redirect),s}this.eventHandler.emitEvent(qe.LOGOUT_END,xt.Redirect)}getRedirectStartPage(e){const n=e||window.location.href;return en.getAbsoluteUrl(n,ba())}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function jie(t,e,n,r,i){if(e.addQueueMeasurement(K.SilentHandlerInitiateAuthRequest,r),!t)throw n.info("Navigate url is empty"),ze(M0);return i?fe(Tie,K.SilentHandlerLoadFrame,n,e,r)(t,i,e,r):ts(Pie,K.SilentHandlerLoadFrameSync,n,e,r)(t)}async function Eie(t,e,n,r,i){const s=U0();if(!s.contentDocument)throw"No document associated with iframe!";return(await qN(s.contentDocument,t,e,n,r,i)).submit(),s}async function Nie(t,e,n,r,i){const s=U0();if(!s.contentDocument)throw"No document associated with iframe!";return(await WN(s.contentDocument,t,e,n,r,i)).submit(),s}async function QI(t,e,n,r,i,s,o){return r.addQueueMeasurement(K.SilentHandlerMonitorIframeForHash,s),new Promise((c,l)=>{e{window.clearInterval(d),l(ze(oB))},e),d=window.setInterval(()=>{let f="";const h=t.contentWindow;try{f=h?h.location.href:""}catch{}if(!f||f==="about:blank")return;let p="";h&&(o===A0.QUERY?p=h.location.search:p=h.location.hash),window.clearTimeout(u),window.clearInterval(d),c(p)},n)}).finally(()=>{ts(kie,K.RemoveHiddenIframe,i,r,s)(t)})}function Tie(t,e,n,r){return n.addQueueMeasurement(K.SilentHandlerLoadFrame,r),new Promise((i,s)=>{const o=U0();window.setTimeout(()=>{if(!o){s("Unable to load iframe");return}o.src=t,i(o)},e)})}function Pie(t){const e=U0();return e.src=t,e}function U0(){const t=document.createElement("iframe");return t.className="msalSilentIframe",t.style.visibility="hidden",t.style.position="absolute",t.style.width=t.style.height="0",t.style.border="0",t.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(t),t}function kie(t){document.body===t.parentNode&&document.body.removeChild(t)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Oie extends Kf{constructor(e,n,r,i,s,o,c,l,u,d,f){super(e,n,r,i,s,o,l,d,f),this.apiId=c,this.nativeStorage=u}async acquireToken(e){this.performanceClient.addQueueMeasurement(K.SilentIframeClientAcquireToken,e.correlationId),!e.loginHint&&!e.sid&&(!e.account||!e.account.username)&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");const n={...e};n.prompt?n.prompt!==gi.NONE&&n.prompt!==gi.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${n.prompt} with ${gi.NONE}`),n.prompt=gi.NONE):n.prompt=gi.NONE;const r=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(n,xt.Silent);return r.platformBroker=im(this.config,this.logger,this.platformAuthProvider,r.authenticationScheme),LB(r.authority),this.config.auth.protocolMode===Li.EAR?this.executeEarFlow(r):this.executeCodeFlow(r)}async executeCodeFlow(e){let n;const r=this.initializeServerTelemetryManager(this.apiId);try{return n=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),await fe(this.silentTokenHelper.bind(this),K.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(n,e)}catch(i){if(i instanceof Cn&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),!n||!(i instanceof Cn)||i.errorCode!==Ti.INVALID_GRANT_ERROR)throw i;return this.performanceClient.addFields({retryError:i.errorCode},this.correlationId),await fe(this.silentTokenHelper.bind(this),K.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(n,e)}}async executeEarFlow(e){const n=e.correlationId,r=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await fe(LN,K.GenerateEarKey,this.logger,this.performanceClient,n)(),s={...e,earJwk:i},o=await fe(Nie,K.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,n)(this.config,r,s,this.logger,this.performanceClient),c=this.config.auth.OIDCOptions.serverResponseType,l=await fe(QI,K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,n)(o,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,n,c),u=ts(pp,K.DeserializeResponse,this.logger,this.performanceClient,n)(l,c,this.logger);return fe(YN,K.HandleResponseEar,this.logger,this.performanceClient,n)(s,u,this.apiId,this.config,r,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}logout(){return Promise.reject(ze(D0))}async silentTokenHelper(e,n){const r=n.correlationId;this.performanceClient.addQueueMeasurement(K.SilentIframeClientTokenHelper,r);const i=await fe(F0,K.GeneratePkceCodes,this.logger,this.performanceClient,r)(this.performanceClient,this.logger,r),s={...n,codeChallenge:i.challenge};let o;if(n.httpMethod===Ml.POST)o=await fe(Eie,K.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(this.config,e.authority,s,this.logger,this.performanceClient);else{const d=await fe(KN,K.GetAuthCodeUrl,this.logger,this.performanceClient,r)(this.config,e.authority,s,this.logger,this.performanceClient);o=await fe(jie,K.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(d,this.performanceClient,this.logger,r,this.config.system.navigateFrameWait)}const c=this.config.auth.OIDCOptions.serverResponseType,l=await fe(QI,K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(o,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,r,c),u=ts(pp,K.DeserializeResponse,this.logger,this.performanceClient,r)(l,c,this.logger);return fe(mx,K.HandleResponseCode,this.logger,this.performanceClient,r)(n,u,i.verifier,this.apiId,this.config,e,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Iie extends Kf{async acquireToken(e){this.performanceClient.addQueueMeasurement(K.SilentRefreshClientAcquireToken,e.correlationId);const n=await fe(VN,K.InitializeBaseRequest,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),r={...e,...n};e.redirectUri&&(r.redirectUri=this.getRedirectUri(e.redirectUri));const i=this.initializeServerTelemetryManager(Sn.acquireTokenSilent_silentFlow),s=await this.createRefreshTokenClient({serverTelemetryManager:i,authorityUrl:r.authority,azureCloudOptions:r.azureCloudOptions,account:r.account});return fe(s.acquireTokenByRefreshToken.bind(s),K.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(r).catch(o=>{throw o.setCorrelationId(this.correlationId),i.cacheFailedRequest(o),o})}logout(){return Promise.reject(ze(D0))}async createRefreshTokenClient(e){const n=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new Wne(n,this.performanceClient)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Rie{constructor(e,n,r,i){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=n,this.logger=r,this.cryptoObj=i}async loadExternalTokens(e,n,r){if(!this.isBrowserEnvironment)throw ze($0);const i=e.correlationId||po(),s=n.id_token?zf(n.id_token,to):void 0,o={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},c=e.authority?new ti(ti.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,o,this.logger,e.correlationId||po()):void 0,l=await this.loadAccount(e,r.clientInfo||n.client_info||"",i,s,c),u=await this.loadIdToken(n,l.homeAccountId,l.environment,l.realm,i),d=await this.loadAccessToken(e,n,l.homeAccountId,l.environment,l.realm,r,i),f=await this.loadRefreshToken(n,l.homeAccountId,l.environment,i);return this.generateAuthenticationResult(e,{account:l,idToken:u,accessToken:d,refreshToken:f},s,c)}async loadAccount(e,n,r,i,s){if(this.logger.verbose("TokenCache - loading account"),e.account){const u=fo.createFromAccountInfo(e.account);return await this.storage.setAccount(u,r),u}else if(!s||!n&&!i)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),ze(mB);const o=fo.generateHomeAccountId(n,s.authorityType,this.logger,this.cryptoObj,i),c=i==null?void 0:i.tid,l=_N(this.storage,s,o,to,r,i,n,s.hostnameAndPort,c,void 0,void 0,this.logger);return await this.storage.setAccount(l,r),l}async loadIdToken(e,n,r,i,s){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const o=P0(n,r,e.id_token,this.config.auth.clientId,i);return await this.storage.setIdTokenCredential(o,s),o}async loadAccessToken(e,n,r,i,s,o,c){if(n.access_token)if(n.expires_in){if(!n.scope&&(!e.scopes||!e.scopes.length))return this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache."),null}else return this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache."),null;else return this.logger.verbose("TokenCache - no access token found in response"),null;this.logger.verbose("TokenCache - loading access token");const l=n.scope?Er.fromString(n.scope):new Er(e.scopes),u=o.expiresOn||n.expires_in+Fi(),d=o.extendedExpiresOn||(n.ext_expires_in||n.expires_in)+Fi(),f=k0(r,i,n.access_token,this.config.auth.clientId,s,l.printScopes(),u,d,to);return await this.storage.setAccessTokenCredential(f,c),f}async loadRefreshToken(e,n,r,i){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const s=UU(n,r,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return await this.storage.setRefreshTokenCredential(s,i),s}generateAuthenticationResult(e,n,r,i){var d,f,h;let s="",o=[],c=null,l;n!=null&&n.accessToken&&(s=n.accessToken.secret,o=Er.fromString(n.accessToken.target).asArray(),c=Ad(n.accessToken.expiresOn),l=Ad(n.accessToken.extendedExpiresOn));const u=n.account;return{authority:i?i.canonicalAuthority:"",uniqueId:n.account.localAccountId,tenantId:n.account.realm,scopes:o,account:u.getAccountInfo(),idToken:((d=n.idToken)==null?void 0:d.secret)||"",idTokenClaims:r||{},accessToken:s,fromCache:!0,expiresOn:c,correlationId:e.correlationId||"",requestId:"",extExpiresOn:l,familyId:((f=n.refreshToken)==null?void 0:f.familyId)||"",tokenType:((h=n==null?void 0:n.accessToken)==null?void 0:h.tokenType)||"",state:e.state||"",cloudGraphHostName:u.cloudGraphHostName||"",msGraphHost:u.msGraphHost||"",fromNativeBroker:!1}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Mie extends WU{constructor(e){super(e),this.includeRedirectUri=!1}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Die extends Kf{constructor(e,n,r,i,s,o,c,l,u,d){super(e,n,r,i,s,o,l,u,d),this.apiId=c}async acquireToken(e){if(!e.code)throw ze(gB);const n=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,xt.Silent),r=this.initializeServerTelemetryManager(this.apiId);try{const i={...n,code:e.code},s=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account}),o=new Mie(s);this.logger.verbose("Auth code client created");const c=new zB(o,this.browserStorage,i,this.logger,this.performanceClient);return await fe(c.handleCodeResponseFromServer.bind(c),K.HandleCodeResponseFromServer,this.logger,this.performanceClient,e.correlationId)({code:e.code,msgraph_host:e.msGraphHost,cloud_graph_host_name:e.cloudGraphHostName,cloud_instance_host_name:e.cloudInstanceHostName},n,!1)}catch(i){throw i instanceof Cn&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),i}}logout(){return Promise.reject(ze(D0))}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function $ie(t,e,n){var o;const r=((o=window.msal)==null?void 0:o.clientIds)||[],i=r.length,s=r.filter(c=>c===t).length;s>1&&n.warning("There is already an instance of MSAL.js in the window with the same client id."),e.add({msalInstanceCount:i,sameClientIdInstanceCount:s})}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Co(t){const e=t==null?void 0:t.idTokenClaims;if(e!=null&&e.tfp||e!=null&&e.acr)return"B2C";if(e!=null&&e.tid){if((e==null?void 0:e.tid)==="9188040d-6c67-4c5b-b112-36a304b66dad")return"MSA"}else return;return"AAD"}function vv(t,e){try{BN(t)}catch(n){throw e.end({success:!1},n),n}}class B0{constructor(e){this.operatingContext=e,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=e.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.config.telemetry.client,this.browserCrypto=this.isBrowserEnvironment?new La(this.logger,this.performanceClient):Zy,this.eventHandler=new iie(this.logger),this.browserStorage=this.isBrowserEnvironment?new mA(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler,Lne(this.config.auth)):Yre(this.config.auth.clientId,this.logger,this.performanceClient,this.eventHandler);const n={cacheLocation:Nr.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:Nr.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new mA(this.config.auth.clientId,n,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler),this.tokenCache=new Rie(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this)}static async createController(e,n){const r=new B0(e);return await r.initialize(n),r}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e,n){if(this.logger.trace("initialize called"),this.initialized){this.logger.info("initialize has already been called, exiting early.");return}if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, exiting early."),this.initialized=!0,this.eventHandler.emitEvent(qe.INITIALIZE_END);return}const r=(e==null?void 0:e.correlationId)||this.getRequestCorrelationId(),i=this.config.system.allowPlatformBroker,s=this.performanceClient.startMeasurement(K.InitializeClientApplication,r);if(this.eventHandler.emitEvent(qe.INITIALIZE_START),!n)try{this.logMultipleInstances(s)}catch{}if(await fe(this.browserStorage.initialize.bind(this.browserStorage),K.InitializeCache,this.logger,this.performanceClient,r)(r),i)try{this.platformAuthProvider=await wie(this.logger,this.performanceClient,r,this.config.system.nativeBrokerHandshakeTimeout)}catch(o){this.logger.verbose(o)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),ts(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),K.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,r)(r)),this.config.system.asyncPopups&&await this.preGeneratePkceCodes(r),this.initialized=!0,this.eventHandler.emitEvent(qe.INITIALIZE_END),s.end({allowPlatformBroker:i,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),$B(this.initialized),this.isBrowserEnvironment){const n=e||"";let r=this.redirectResponse.get(n);return typeof r>"u"?(r=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(n,r),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise")):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),r}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async handleRedirectPromiseInternal(e){var l;if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;if(((l=this.browserStorage.getInteractionInProgress())==null?void 0:l.type)===uc.SIGNOUT)return this.logger.verbose("handleRedirectPromise removing interaction_in_progress flag and returning null after sign-out"),this.browserStorage.setInteractionInProgress(!1),Promise.resolve(null);const r=this.getAllAccounts(),i=this.browserStorage.getCachedNativeRequest(),s=i&&this.platformAuthProvider&&!e;let o;this.eventHandler.emitEvent(qe.HANDLE_REDIRECT_START,xt.Redirect);let c;try{if(s&&this.platformAuthProvider){o=this.performanceClient.startMeasurement(K.AcquireTokenRedirect,(i==null?void 0:i.correlationId)||""),this.logger.trace("handleRedirectPromise - acquiring token from native platform");const u=new iy(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Sn.handleRedirectPromise,this.performanceClient,this.platformAuthProvider,i.accountId,this.nativeInternalStorage,i.correlationId);c=fe(u.handleRedirectPromise.bind(u),K.HandleNativeRedirectPromiseMeasurement,this.logger,this.performanceClient,o.event.correlationId)(this.performanceClient,o.event.correlationId)}else{const[u,d]=this.browserStorage.getCachedRequest(),f=u.correlationId;o=this.performanceClient.startMeasurement(K.AcquireTokenRedirect,f),this.logger.trace("handleRedirectPromise - acquiring token from web flow");const h=this.createRedirectClient(f);c=fe(h.handleRedirectPromise.bind(h),K.HandleRedirectPromiseMeasurement,this.logger,this.performanceClient,o.event.correlationId)(e,u,d,o)}}catch(u){throw this.browserStorage.resetRequestCache(),u}return c.then(u=>(u?(this.browserStorage.resetRequestCache(),r.length{this.browserStorage.resetRequestCache();const d=u;throw r.length>0?this.eventHandler.emitEvent(qe.ACQUIRE_TOKEN_FAILURE,xt.Redirect,null,d):this.eventHandler.emitEvent(qe.LOGIN_FAILURE,xt.Redirect,null,d),this.eventHandler.emitEvent(qe.HANDLE_REDIRECT_END,xt.Redirect),o.end({success:!1},d),u})}async acquireTokenRedirect(e){const n=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",n);const r=this.performanceClient.startMeasurement(K.AcquireTokenPreRedirect,n);r.add({accountType:Co(e.account),scenarioId:e.scenarioId});const i=e.onRedirectNavigate;if(i)e.onRedirectNavigate=o=>{const c=typeof i=="function"?i(o):void 0;return c!==!1?r.end({success:!0}):r.discard(),c};else{const o=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=c=>{const l=typeof o=="function"?o(c):void 0;return l!==!1?r.end({success:!0}):r.discard(),l}}const s=this.getAllAccounts().length>0;try{UI(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,uc.SIGNIN),s?this.eventHandler.emitEvent(qe.ACQUIRE_TOKEN_START,xt.Redirect,e):this.eventHandler.emitEvent(qe.LOGIN_START,xt.Redirect,e);let o;return this.platformAuthProvider&&this.canUsePlatformBroker(e)?o=new iy(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Sn.acquireTokenRedirect,this.performanceClient,this.platformAuthProvider,this.getNativeAccountId(e),this.nativeInternalStorage,n).acquireTokenRedirect(e,r).catch(l=>{if(l instanceof Io&&Qu(l))return this.platformAuthProvider=void 0,this.createRedirectClient(n).acquireToken(e);if(l instanceof ho)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(n).acquireToken(e);throw l}):o=this.createRedirectClient(n).acquireToken(e),await o}catch(o){throw this.browserStorage.resetRequestCache(),r.end({success:!1},o),s?this.eventHandler.emitEvent(qe.ACQUIRE_TOKEN_FAILURE,xt.Redirect,null,o):this.eventHandler.emitEvent(qe.LOGIN_FAILURE,xt.Redirect,null,o),o}}acquireTokenPopup(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(K.AcquireTokenPopup,n);r.add({scenarioId:e.scenarioId,accountType:Co(e.account)});try{this.logger.verbose("acquireTokenPopup called",n),vv(this.initialized,r),this.browserStorage.setInteractionInProgress(!0,uc.SIGNIN)}catch(c){return Promise.reject(c)}const i=this.getAllAccounts();i.length>0?this.eventHandler.emitEvent(qe.ACQUIRE_TOKEN_START,xt.Popup,e):this.eventHandler.emitEvent(qe.LOGIN_START,xt.Popup,e);let s;const o=this.getPreGeneratedPkceCodes(n);return this.canUsePlatformBroker(e)?s=this.acquireTokenNative({...e,correlationId:n},Sn.acquireTokenPopup).then(c=>(r.end({success:!0,isNativeBroker:!0,accountType:Co(c.account)}),c)).catch(c=>{if(c instanceof Io&&Qu(c))return this.platformAuthProvider=void 0,this.createPopupClient(n).acquireToken(e,o);if(c instanceof ho)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(n).acquireToken(e,o);throw c}):s=this.createPopupClient(n).acquireToken(e,o),s.then(c=>(i.length(i.length>0?this.eventHandler.emitEvent(qe.ACQUIRE_TOKEN_FAILURE,xt.Popup,null,c):this.eventHandler.emitEvent(qe.LOGIN_FAILURE,xt.Popup,null,c),r.end({success:!1},c),Promise.reject(c))).finally(async()=>{this.browserStorage.setInteractionInProgress(!1),this.config.system.asyncPopups&&await this.preGeneratePkceCodes(n)})}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(e){var s,o;const n=this.getRequestCorrelationId(e),r={...e,prompt:e.prompt,correlationId:n};this.ssoSilentMeasurement=this.performanceClient.startMeasurement(K.SsoSilent,n),(s=this.ssoSilentMeasurement)==null||s.add({scenarioId:e.scenarioId,accountType:Co(e.account)}),vv(this.initialized,this.ssoSilentMeasurement),(o=this.ssoSilentMeasurement)==null||o.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",n),this.eventHandler.emitEvent(qe.SSO_SILENT_START,xt.Silent,r);let i;return this.canUsePlatformBroker(r)?i=this.acquireTokenNative(r,Sn.ssoSilent).catch(c=>{if(c instanceof Io&&Qu(c))return this.platformAuthProvider=void 0,this.createSilentIframeClient(r.correlationId).acquireToken(r);throw c}):i=this.createSilentIframeClient(r.correlationId).acquireToken(r),i.then(c=>{var l;return this.eventHandler.emitEvent(qe.SSO_SILENT_SUCCESS,xt.Silent,c),(l=this.ssoSilentMeasurement)==null||l.end({success:!0,isNativeBroker:c.fromNativeBroker,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:Co(c.account)}),c}).catch(c=>{var l;throw this.eventHandler.emitEvent(qe.SSO_SILENT_FAILURE,xt.Silent,null,c),(l=this.ssoSilentMeasurement)==null||l.end({success:!1},c),c}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const n=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",n);const r=this.performanceClient.startMeasurement(K.AcquireTokenByCode,n);vv(this.initialized,r),this.eventHandler.emitEvent(qe.ACQUIRE_TOKEN_BY_CODE_START,xt.Silent,e),r.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw ze(yB);if(e.code){const i=e.code;let s=this.hybridAuthCodeResponses.get(i);return s?(this.logger.verbose("Existing acquireTokenByCode request found",n),r.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",n),s=this.acquireTokenByCodeAsync({...e,correlationId:n}).then(o=>(this.eventHandler.emitEvent(qe.ACQUIRE_TOKEN_BY_CODE_SUCCESS,xt.Silent,o),this.hybridAuthCodeResponses.delete(i),r.end({success:!0,isNativeBroker:o.fromNativeBroker,accessTokenSize:o.accessToken.length,idTokenSize:o.idToken.length,accountType:Co(o.account)}),o)).catch(o=>{throw this.hybridAuthCodeResponses.delete(i),this.eventHandler.emitEvent(qe.ACQUIRE_TOKEN_BY_CODE_FAILURE,xt.Silent,null,o),r.end({success:!1},o),o}),this.hybridAuthCodeResponses.set(i,s)),await s}else if(e.nativeAccountId)if(this.canUsePlatformBroker(e,e.nativeAccountId)){const i=await this.acquireTokenNative({...e,correlationId:n},Sn.acquireTokenByCode,e.nativeAccountId).catch(s=>{throw s instanceof Io&&Qu(s)&&(this.platformAuthProvider=void 0),s});return r.end({accountType:Co(i.account),success:!0}),i}else throw ze(xB);else throw ze(vB)}catch(i){throw this.eventHandler.emitEvent(qe.ACQUIRE_TOKEN_BY_CODE_FAILURE,xt.Silent,null,i),r.end({success:!1},i),i}}async acquireTokenByCodeAsync(e){var i;return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(K.AcquireTokenByCodeAsync,e.correlationId),(i=this.acquireTokenByCodeAsyncMeasurement)==null||i.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),await this.createSilentAuthCodeClient(e.correlationId).acquireToken(e).then(s=>{var o;return(o=this.acquireTokenByCodeAsyncMeasurement)==null||o.end({success:!0,fromCache:s.fromCache,isNativeBroker:s.fromNativeBroker}),s}).catch(s=>{var o;throw(o=this.acquireTokenByCodeAsyncMeasurement)==null||o.end({success:!1},s),s}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,n){switch(this.performanceClient.addQueueMeasurement(K.AcquireTokenFromCache,e.correlationId),n){case ui.Default:case ui.AccessToken:case ui.AccessTokenAndRefreshToken:const r=this.createSilentCacheClient(e.correlationId);return fe(r.acquireToken.bind(r),K.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Se(Mc)}}async acquireTokenByRefreshToken(e,n){switch(this.performanceClient.addQueueMeasurement(K.AcquireTokenByRefreshToken,e.correlationId),n){case ui.Default:case ui.AccessTokenAndRefreshToken:case ui.RefreshToken:case ui.RefreshTokenAndNetwork:const r=this.createSilentRefreshClient(e.correlationId);return fe(r.acquireToken.bind(r),K.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Se(Mc)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(K.AcquireTokenBySilentIframe,e.correlationId);const n=this.createSilentIframeClient(e.correlationId);return fe(n.acquireToken.bind(n),K.SilentIframeClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const n=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",n),this.logoutRedirect({correlationId:n,...e})}async logoutRedirect(e){const n=this.getRequestCorrelationId(e);return UI(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,uc.SIGNOUT),this.createRedirectClient(n).logout(e)}logoutPopup(e){try{const n=this.getRequestCorrelationId(e);return BN(this.initialized),this.browserStorage.setInteractionInProgress(!0,uc.SIGNOUT),this.createPopupClient(n).logout(e).finally(()=>{this.browserStorage.setInteractionInProgress(!1)})}catch(n){return Promise.reject(n)}}async clearCache(e){if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, returning early.");return}const n=this.getRequestCorrelationId(e);return this.createSilentCacheClient(n).logout(e)}getAllAccounts(e){const n=this.getRequestCorrelationId();return Qre(this.logger,this.browserStorage,this.isBrowserEnvironment,n,e)}getAccount(e){const n=this.getRequestCorrelationId();return Xre(e,this.logger,this.browserStorage,n)}getAccountByUsername(e){const n=this.getRequestCorrelationId();return Jre(e,this.logger,this.browserStorage,n)}getAccountByHomeId(e){const n=this.getRequestCorrelationId();return Zre(e,this.logger,this.browserStorage,n)}getAccountByLocalId(e){const n=this.getRequestCorrelationId();return eie(e,this.logger,this.browserStorage,n)}setActiveAccount(e){const n=this.getRequestCorrelationId();tie(e,this.browserStorage,n)}getActiveAccount(){const e=this.getRequestCorrelationId();return nie(this.browserStorage,e)}async hydrateCache(e,n){this.logger.verbose("hydrateCache called");const r=fo.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return await this.browserStorage.setAccount(r,e.correlationId),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,n)):this.browserStorage.hydrateCache(e,n)}async acquireTokenNative(e,n,r,i){if(this.logger.trace("acquireTokenNative called"),!this.platformAuthProvider)throw ze(IN);return new iy(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,n,this.performanceClient,this.platformAuthProvider,r||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e,i)}canUsePlatformBroker(e,n){if(this.logger.trace("canUsePlatformBroker called"),!this.platformAuthProvider)return this.logger.trace("canUsePlatformBroker: platform broker unavilable, returning false"),!1;if(!im(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme))return this.logger.trace("canUsePlatformBroker: isBrokerAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case gi.NONE:case gi.CONSENT:case gi.LOGIN:this.logger.trace("canUsePlatformBroker: prompt is compatible with platform broker flow");break;default:return this.logger.trace(`canUsePlatformBroker: prompt = ${e.prompt} is not compatible with platform broker flow, returning false`),!1}return!n&&!this.getNativeAccountId(e)?(this.logger.trace("canUsePlatformBroker: nativeAccountId is not available, returning false"),!1):!0}getNativeAccountId(e){const n=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return n&&n.nativeAccountId||""}createPopupClient(e){return new Cie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createRedirectClient(e){return new Aie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentIframeClient(e){return new Oie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Sn.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentCacheClient(e){return new GB(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentRefreshClient(e){return new Iie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentAuthCodeClient(e){return new Die(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Sn.acquireTokenByCode,this.performanceClient,this.platformAuthProvider,e)}addEventCallback(e,n){return this.eventHandler.addEventCallback(e,n)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return DB(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){if(this.config.cache.cacheLocation!==Nr.LocalStorage){this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");return}this.eventHandler.subscribeCrossTab()}disableAccountStorageEvents(){if(this.config.cache.cacheLocation!==Nr.LocalStorage){this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");return}this.eventHandler.unsubscribeCrossTab()}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,n){this.browserStorage.setWrapperMetadata(e,n)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?po():pe.EMPTY_STRING}async loginRedirect(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",n),this.acquireTokenRedirect({correlationId:n,...e||MI})}loginPopup(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",n),this.acquireTokenPopup({correlationId:n,...e||MI})}async acquireTokenSilent(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(K.AcquireTokenSilent,n);r.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),vv(this.initialized,r),this.logger.verbose("acquireTokenSilent called",n);const i=e.account||this.getActiveAccount();if(!i)throw ze(uB);return r.add({accountType:Co(i)}),this.acquireTokenSilentDeduped(e,i,n).then(s=>(r.end({success:!0,fromCache:s.fromCache,isNativeBroker:s.fromNativeBroker,accessTokenSize:s.accessToken.length,idTokenSize:s.idToken.length}),{...s,state:e.state,correlationId:n})).catch(s=>{throw s instanceof Cn&&s.setCorrelationId(n),r.end({success:!1},s),s})}async acquireTokenSilentDeduped(e,n,r){const i=O0(this.config.auth.clientId,{...e,authority:e.authority||this.config.auth.authority,correlationId:r},n.homeAccountId),s=JSON.stringify(i),o=this.activeSilentTokenRequests.get(s);if(typeof o>"u"){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",r),this.performanceClient.addFields({deduped:!1},r);const c=fe(this.acquireTokenSilentAsync.bind(this),K.AcquireTokenSilentAsync,this.logger,this.performanceClient,r)({...e,correlationId:r},n);return this.activeSilentTokenRequests.set(s,c),c.finally(()=>{this.activeSilentTokenRequests.delete(s)})}else return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",r),this.performanceClient.addFields({deduped:!0},r),o}async acquireTokenSilentAsync(e,n){const r=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(K.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(qe.ACQUIRE_TOKEN_START,xt.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",r);const i=await fe(sie,K.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,n,this.config,this.performanceClient,this.logger),s=e.cacheLookupPolicy||ui.Default;return this.acquireTokenSilentNoIframe(i,s).catch(async c=>{if(Lie(c,s))if(this.activeIframeRequest)if(s!==ui.Skip){const[u,d]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${d}`,i.correlationId);const f=this.performanceClient.startMeasurement(K.AwaitConcurrentIframe,i.correlationId);f.add({awaitIframeCorrelationId:d});const h=await u;if(f.end({success:h}),h)return this.logger.verbose(`Parallel iframe request with correlationId: ${d} succeeded. Retrying cache and/or RT redemption`,i.correlationId),this.acquireTokenSilentNoIframe(i,s);throw this.logger.info(`Iframe request with correlationId: ${d} failed. Interaction is required.`),c}else return this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",i.correlationId),fe(this.acquireTokenBySilentIframe.bind(this),K.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i);else{let u;return this.activeIframeRequest=[new Promise(d=>{u=d}),i.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",i.correlationId),fe(this.acquireTokenBySilentIframe.bind(this),K.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i).then(d=>(u(!0),d)).catch(d=>{throw u(!1),d}).finally(()=>{this.activeIframeRequest=void 0})}else throw c}).then(c=>(this.eventHandler.emitEvent(qe.ACQUIRE_TOKEN_SUCCESS,xt.Silent,c),e.correlationId&&this.performanceClient.addFields({fromCache:c.fromCache,isNativeBroker:c.fromNativeBroker},e.correlationId),c)).catch(c=>{throw this.eventHandler.emitEvent(qe.ACQUIRE_TOKEN_FAILURE,xt.Silent,null,c),c}).finally(()=>{document.removeEventListener("visibilitychange",r)})}async acquireTokenSilentNoIframe(e,n){return im(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,Sn.acquireTokenSilent_silentFlow,e.account.nativeAccountId,n).catch(async r=>{throw r instanceof Io&&Qu(r)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.platformAuthProvider=void 0,Se(Mc)):r})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),n===ui.AccessToken&&this.logger.verbose("acquireTokenSilent - cache lookup policy set to AccessToken, attempting to acquire token from local cache"),fe(this.acquireTokenFromCache.bind(this),K.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,n).catch(r=>{if(n===ui.AccessToken)throw r;return this.eventHandler.emitEvent(qe.ACQUIRE_TOKEN_NETWORK_START,xt.Silent,e),fe(this.acquireTokenByRefreshToken.bind(this),K.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,n)}))}async preGeneratePkceCodes(e){return this.logger.verbose("Generating new PKCE codes"),this.pkceCode=await fe(F0,K.GeneratePkceCodes,this.logger,this.performanceClient,e)(this.performanceClient,this.logger,e),Promise.resolve()}getPreGeneratedPkceCodes(e){this.logger.verbose("Attempting to pick up pre-generated PKCE codes");const n=this.pkceCode?{...this.pkceCode}:void 0;return this.pkceCode=void 0,this.logger.verbose(`${n?"Found":"Did not find"} pre-generated PKCE codes`),this.performanceClient.addFields({usePreGeneratedPkce:!!n},e),n}logMultipleInstances(e){const n=this.config.auth.clientId;if(!window)return;window.msal=window.msal||{},window.msal.clientIds=window.msal.clientIds||[],window.msal.clientIds.length>0&&this.logger.verbose("There is already an instance of MSAL.js in the window."),window.msal.clientIds.push(n),$ie(n,e,this.logger)}}function Lie(t,e){const n=!(t instanceof ho&&t.subError!==R0),r=t.errorCode===Ti.INVALID_GRANT_ERROR||t.errorCode===Mc,i=n&&r||t.errorCode===cx||t.errorCode===SN,s=hre.includes(e);return i&&s}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function Fie(t,e){const n=new yu(t);return await n.initialize(),B0.createController(n,e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class XN{static async createPublicClientApplication(e){const n=await Fie(e);return new XN(e,n)}constructor(e,n){this.isBroker=!1,this.controller=n||new B0(new yu(e))}async initialize(e){return this.controller.initialize(e,this.isBroker)}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e,n){return this.controller.addEventCallback(e,n)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccount(e){return this.controller.getAccount(e)}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(e){return this.controller.getAllAccounts(e)}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,n){return this.controller.initializeWrapperLibrary(e,n)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,n){return this.controller.hydrateCache(e,n)}clearCache(e){return this.controller.clearCache(e)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Uie={initialize:()=>Promise.reject(dr(ur)),acquireTokenPopup:()=>Promise.reject(dr(ur)),acquireTokenRedirect:()=>Promise.reject(dr(ur)),acquireTokenSilent:()=>Promise.reject(dr(ur)),acquireTokenByCode:()=>Promise.reject(dr(ur)),getAllAccounts:()=>[],getAccount:()=>null,getAccountByHomeId:()=>null,getAccountByUsername:()=>null,getAccountByLocalId:()=>null,handleRedirectPromise:()=>Promise.reject(dr(ur)),loginPopup:()=>Promise.reject(dr(ur)),loginRedirect:()=>Promise.reject(dr(ur)),logout:()=>Promise.reject(dr(ur)),logoutRedirect:()=>Promise.reject(dr(ur)),logoutPopup:()=>Promise.reject(dr(ur)),ssoSilent:()=>Promise.reject(dr(ur)),addEventCallback:()=>null,removeEventCallback:()=>{},addPerformanceCallback:()=>"",removePerformanceCallback:()=>!1,enableAccountStorageEvents:()=>{},disableAccountStorageEvents:()=>{},getTokenCache:()=>{throw dr(ur)},getLogger:()=>{throw dr(ur)},setLogger:()=>{},setActiveAccount:()=>{},getActiveAccount:()=>null,initializeWrapperLibrary:()=>{},setNavigationClient:()=>{},getConfiguration:()=>{throw dr(ur)},hydrateCache:()=>Promise.reject(dr(ur)),clearCache:()=>Promise.reject(dr(ur))};/*! @azure/msal-browser v4.19.0 2025-08-05 */class Bie{static getInteractionStatusFromEvent(e,n){switch(e.eventType){case qe.LOGIN_START:return wr.Login;case qe.SSO_SILENT_START:return wr.SsoSilent;case qe.ACQUIRE_TOKEN_START:if(e.interactionType===xt.Redirect||e.interactionType===xt.Popup)return wr.AcquireToken;break;case qe.HANDLE_REDIRECT_START:return wr.HandleRedirect;case qe.LOGOUT_START:return wr.Logout;case qe.SSO_SILENT_SUCCESS:case qe.SSO_SILENT_FAILURE:if(n&&n!==wr.SsoSilent)break;return wr.None;case qe.LOGOUT_END:if(n&&n!==wr.Logout)break;return wr.None;case qe.HANDLE_REDIRECT_END:if(n&&n!==wr.HandleRedirect)break;return wr.None;case qe.LOGIN_SUCCESS:case qe.LOGIN_FAILURE:case qe.ACQUIRE_TOKEN_SUCCESS:case qe.ACQUIRE_TOKEN_FAILURE:case qe.RESTORE_FROM_BFCACHE:if(e.interactionType===xt.Redirect||e.interactionType===xt.Popup){if(n&&n!==wr.Login&&n!==wr.AcquireToken)break;return wr.None}break}return null}}const Hie="modulepreload",zie=function(t){return"/semblance/"+t},XI={},Vie=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),c=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=zie(l),l in XI)return;XI[l]=!0;const u=l.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":Hie,u||(f.as="script"),f.crossOrigin="",f.href=l,c&&f.setAttribute("nonce",c),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(o){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=o,window.dispatchEvent(c),!c.defaultPrevented)throw o}return i.then(o=>{for(const c of o||[])c.status==="rejected"&&s(c.reason);return e().catch(s)})};/*! @azure/msal-react v3.0.17 2025-08-05 */const Gie={instance:Uie,inProgress:wr.None,accounts:[],logger:new $a({})},JN=y.createContext(Gie);JN.Consumer;/*! @azure/msal-react v3.0.17 2025-08-05 */function JI(t,e){if(t.length!==e.length)return!1;const n=[...e];return t.every(r=>{const i=n.shift();return!r||!i?!1:r.homeAccountId===i.homeAccountId&&r.localAccountId===i.localAccountId&&r.username===i.username})}/*! @azure/msal-react v3.0.17 2025-08-05 */const Kie="@azure/msal-react",ZI="3.0.17";/*! @azure/msal-react v3.0.17 2025-08-05 */const vx={UNBLOCK_INPROGRESS:"UNBLOCK_INPROGRESS",EVENT:"EVENT"},Wie=(t,e)=>{const{type:n,payload:r}=e;let i=t.inProgress;switch(n){case vx.UNBLOCK_INPROGRESS:t.inProgress===wr.Startup&&(i=wr.None,r.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case vx.EVENT:const o=r.message,c=Bie.getInteractionStatusFromEvent(o,t.inProgress);c&&(r.logger.info(`MsalProvider - ${o.eventType} results in setting inProgress from ${t.inProgress} to ${c}`),i=c);break;default:throw new Error(`Unknown action type: ${n}`)}if(i===wr.Startup)return t;const s=r.instance.getAllAccounts();return i!==t.inProgress&&!JI(s,t.accounts)?{...t,inProgress:i,accounts:s}:i!==t.inProgress?{...t,inProgress:i}:JI(s,t.accounts)?t:{...t,accounts:s}};function qie({instance:t,children:e}){y.useEffect(()=>{t.initializeWrapperLibrary(ure.React,ZI)},[t]);const n=y.useMemo(()=>t.getLogger().clone(Kie,ZI),[t]),[r,i]=y.useReducer(Wie,void 0,()=>({inProgress:wr.Startup,accounts:[]}));y.useEffect(()=>{const o=t.addEventCallback(c=>{i({payload:{instance:t,logger:n,message:c},type:vx.EVENT})});return n.verbose(`MsalProvider - Registered event callback with id: ${o}`),t.initialize().then(()=>{t.handleRedirectPromise().catch(()=>{}).finally(()=>{i({payload:{instance:t,logger:n},type:vx.UNBLOCK_INPROGRESS})})}).catch(()=>{}),()=>{o&&(n.verbose(`MsalProvider - Removing event callback ${o}`),t.removeEventCallback(o))}},[t,n]);const s={instance:t,inProgress:r.inProgress,accounts:r.accounts,logger:n};return P.createElement(JN.Provider,{value:s},e)}/*! @azure/msal-react v3.0.17 2025-08-05 */const Yie=()=>y.useContext(JN),Qie={auth:{clientId:"7e9b250a-d984-4fba-8e1c-a0622242a595",authority:"https://login.microsoftonline.com/e519c2e6-bc6d-4fdf-8d9c-923c2f002385",redirectUri:"https://ai-sandbox.oliver.solutions/semblance",postLogoutRedirectUri:"https://ai-sandbox.oliver.solutions/semblance"},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:(t,e,n)=>{n||console.log(e)},logLevel:Rn.Verbose,piiLoggingEnabled:!1},allowNativeBroker:!1}},Xie={scopes:["openid","profile","email"],prompt:"select_account",extraQueryParameters:{code_challenge_method:"S256"}},qB=y.createContext(void 0);function Jie({children:t}){const[e,n]=y.useState(null),[r,i]=y.useState(null),[s,o]=y.useState(!0),[c,l]=y.useState(!1),u=lr(),{instance:d,accounts:f,inProgress:h}=Yie();y.useEffect(()=>{const w=S=>{const _=S.detail||{};if(_.isPersonaCreation){console.log("Ignoring auth error from persona creation",_);return}i(null),n(null),ne.error("Session expired",{description:"Please log in again"}),u("/login")};return window.addEventListener(Z_,w),()=>{window.removeEventListener(Z_,w)}},[u]),y.useEffect(()=>{const w=localStorage.getItem("auth_token"),S=localStorage.getItem("user");if(console.log("AuthContext initializing - stored data check:",{hasToken:!!w,hasUser:!!S}),w&&S)try{i(w),n(JSON.parse(S)),console.log("User session restored from localStorage")}catch(C){console.error("Failed to parse stored user data:",C),localStorage.removeItem("auth_token"),localStorage.removeItem("user")}else console.log("No stored authentication data found");o(!1)},[]),y.useEffect(()=>{if(r){console.log("Verifying token...");const w=`token_validated_${r.substring(0,10)}`;if(sessionStorage.getItem(w)==="true"&&e){console.log("Token already validated this session, skipping validation");return}ty.getProfile().then(C=>{C&&"data"in C&&(console.log("Profile verified successfully"),n(C.data),sessionStorage.setItem(w,"true"))}).catch(C=>{C.response&&C.response.status===401?(console.error("Token invalid (401):",C),localStorage.removeItem("auth_token"),localStorage.removeItem("user"),i(null),n(null)):(console.warn("Profile validation error (not clearing token):",C),sessionStorage.setItem(w,"true"))})}else console.log("No token available, not validating profile")},[r,e]);const p=async(w,S)=>{var C,_;o(!0),console.log("Attempting login for user:",w);try{const A=await ty.login(w,S);if(console.log("Login API response received"),!A.data.access_token)throw new Error("No access token received from server");return localStorage.setItem("auth_token",A.data.access_token),localStorage.setItem("user",JSON.stringify(A.data.user)),i(A.data.access_token),n(A.data.user),console.log("Authentication state updated"),ne.success("Login successful!"),A.data.access_token}catch(A){throw console.error("Login failed:",A),ne.error("Login failed",{description:((_=(C=A.response)==null?void 0:C.data)==null?void 0:_.message)||"Invalid username or password"}),A}finally{o(!1)}},g=async()=>{l(!0);try{console.log("Starting Microsoft authentication...");const w=await d.loginPopup(Xie);if(w&&w.account&&w.idToken){console.log("Microsoft authentication successful",w.account);const S=await ty.loginWithMicrosoft(w.idToken);S.data.access_token&&(localStorage.setItem("auth_token",S.data.access_token),localStorage.setItem("user",JSON.stringify(S.data.user)),localStorage.setItem("auth_type","microsoft"),i(S.data.access_token),n(S.data.user),console.log("Microsoft user authenticated and stored"),ne.success("Successfully signed in with Microsoft!"))}}catch(w){throw console.error("Microsoft login failed:",w),w.name==="BrowserAuthError"&&w.errorCode==="popup_window_error"?ne.error("Sign-in cancelled",{description:"The sign-in popup was closed before completing authentication."}):w.name==="InteractionRequiredAuthError"?ne.error("Authentication required",{description:"Please complete the authentication process."}):ne.error("Microsoft sign-in failed",{description:w.message||"An error occurred during authentication"}),w}finally{l(!1)}},m=async()=>{const w=localStorage.getItem("auth_type");if(localStorage.removeItem("auth_token"),localStorage.removeItem("user"),localStorage.removeItem("auth_type"),i(null),n(null),w==="microsoft"&&f.length>0)try{await d.logoutPopup({account:f[0],postLogoutRedirectUri:window.location.origin+"/semblance/"})}catch(S){console.error("Microsoft logout error:",S)}ne.info("You have been logged out")},v=!!localStorage.getItem("auth_token"),x={user:e,token:r,isLoading:s,login:p,loginWithMicrosoft:g,logout:m,isAuthenticated:!!r||v,isMsalLoading:c};return a.jsx(qB.Provider,{value:x,children:t})}function Zo(){const t=y.useContext(qB);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}function ja(){const[t,e]=y.useState(!1),n=Bi(),r=lr(),{isAuthenticated:i,logout:s}=Zo(),o=[{name:"Home",href:"/",icon:Ky},{name:"Synthetic Personas",href:"/synthetic-users",icon:Fr},{name:"Focus Groups",href:"/focus-groups",icon:Wo},{name:"Dashboard",href:"/dashboard",icon:G_}],c=()=>{e(!t)},l=d=>n.pathname===d,u=d=>{if(d==="/synthetic-users"){const f=new CustomEvent("syntheticUsersNavigation");window.dispatchEvent(f)}r(d)};return a.jsxs("header",{className:"fixed top-0 left-0 right-0 z-50 bg-white/80 backdrop-blur-md border-b border-slate-200/80",children:[a.jsx("div",{className:"px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex h-16 items-center justify-between",children:[a.jsx("div",{className:"flex items-center",children:a.jsx(bs,{to:"/",className:"flex items-center",children:a.jsx("span",{className:"font-sf text-2xl font-semibold text-gradient",children:"Semblance"})})}),a.jsx("nav",{className:"hidden md:block",children:a.jsxs("ul",{className:"flex items-center space-x-8",children:[o.map(d=>a.jsx("li",{children:d.href==="/"?a.jsxs(bs,{to:d.href,className:Pe("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",l(d.href)?"border-primary text-primary":"border-transparent text-slate-600 hover:text-slate-900 hover:border-slate-300"),children:[a.jsx(d.icon,{className:"mr-1 h-4 w-4"}),d.name]}):a.jsxs("button",{onClick:()=>u(d.href),className:Pe("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",l(d.href)?"border-primary text-primary":"border-transparent text-slate-600 hover:text-slate-900 hover:border-slate-300"),children:[a.jsx(d.icon,{className:"mr-1 h-4 w-4"}),d.name]})},d.name)),a.jsx("li",{children:i?a.jsxs("button",{onClick:()=>{s(),r("/login")},className:"flex items-center px-3 py-2 text-sm font-medium text-slate-600 hover:text-slate-900 button-transition rounded-md hover:bg-slate-50",children:[a.jsx(eI,{className:"mr-1 h-4 w-4"}),"Logout"]}):a.jsxs(bs,{to:"/login",className:"flex items-center px-3 py-2 text-sm font-medium text-slate-600 hover:text-slate-900 button-transition rounded-md hover:bg-slate-50",children:[a.jsx(ZO,{className:"mr-1 h-4 w-4"}),"Login"]})})]})}),a.jsx("div",{className:"flex md:hidden",children:a.jsxs("button",{type:"button",className:"inline-flex items-center justify-center rounded-md p-2 text-slate-700 hover:bg-slate-100 hover:text-slate-900 button-transition",onClick:c,children:[a.jsx("span",{className:"sr-only",children:"Open main menu"}),t?a.jsx(Mi,{className:"block h-6 w-6","aria-hidden":"true"}):a.jsx(iZ,{className:"block h-6 w-6","aria-hidden":"true"})]})})]})}),t&&a.jsx("div",{className:"md:hidden glass-panel animate-fade-in",children:a.jsxs("div",{className:"space-y-1 px-4 pb-3 pt-2",children:[o.map(d=>a.jsx("div",{children:d.href==="/"?a.jsxs(bs,{to:d.href,className:Pe("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition",l(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>e(!1),children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]}):a.jsxs("button",{className:Pe("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition w-full text-left",l(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>{e(!1),u(d.href)},children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]})},d.name)),i?a.jsxs("button",{onClick:()=>{s(),e(!1),r("/login")},className:"flex items-center rounded-md px-3 py-2 text-base font-medium button-transition text-slate-600 hover:bg-slate-50 hover:text-slate-900 w-full",children:[a.jsx(eI,{className:"mr-3 h-5 w-5"}),"Logout"]}):a.jsxs(bs,{to:"/login",className:"flex items-center rounded-md px-3 py-2 text-base font-medium button-transition text-slate-600 hover:bg-slate-50 hover:text-slate-900",onClick:()=>e(!1),children:[a.jsx(ZO,{className:"mr-3 h-5 w-5"}),"Login"]})]})})]})}const eR=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,tR=It,ZN=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return tR(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=e,o=Object.keys(i).map(u=>{const d=n==null?void 0:n[u],f=s==null?void 0:s[u];if(d===null)return null;const h=eR(d)||eR(f);return i[u][h]}),c=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(g=>{let[m,v]=g;return Array.isArray(v)?v.includes({...s,...c}[m]):{...s,...c}[m]===v})?[...u,f,h]:u},[]);return tR(t,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},eT=ZN("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),X=y.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...i},s)=>{const o=r?Go:"button";return a.jsx(o,{className:Pe(eT({variant:e,size:n,className:t})),ref:s,...i})});X.displayName="Button";function Zie(){return a.jsxs("div",{className:"relative isolate overflow-hidden",children:[a.jsx("div",{className:"absolute inset-x-0 top-[-10rem] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[-20rem]","aria-hidden":"true",children:a.jsx("div",{className:"relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-primary to-blue-400 opacity-20 sm:left-[calc(50%-30rem)] sm:w-[72.1875rem]",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})}),a.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-24 sm:py-32 lg:flex lg:items-center lg:gap-x-10 lg:px-8 lg:py-40",children:[a.jsxs("div",{className:"mx-auto max-w-2xl lg:mx-0 lg:flex-auto",children:[a.jsx("div",{className:"flex",children:a.jsxs("div",{className:"relative flex items-center gap-x-4 rounded-full px-4 py-1 text-sm leading-6 text-gray-600 ring-1 ring-gray-900/10 hover:ring-gray-900/20",children:[a.jsx("span",{className:"font-semibold text-primary",children:"New"}),a.jsx("span",{className:"h-4 w-px bg-gray-900/10","aria-hidden":"true"}),a.jsx("span",{children:"Introducing AI-driven focus groups"})]})}),a.jsxs("h1",{className:"mt-10 max-w-lg text-4xl font-sf font-bold tracking-tight text-gray-900 sm:text-6xl",children:["Research with ",a.jsx("span",{className:"text-gradient",children:"synthetic personas"})]}),a.jsx("p",{className:"mt-6 text-lg leading-8 text-gray-600",children:"Conduct research using AI-powered synthetic personas and autonomous focus groups. Gain valuable insights without the limitations of traditional research methods."}),a.jsxs("div",{className:"mt-10 flex items-center gap-x-6",children:[a.jsx(bs,{to:"/synthetic-users",children:a.jsxs(X,{className:"px-6 py-6 text-base hover:shadow-lg hover:translate-y-[-2px] button-transition",children:["Create synthetic personas",a.jsx(fs,{className:"ml-2 h-4 w-4"})]})}),a.jsxs(bs,{to:"/focus-groups",className:"text-sm font-semibold leading-6 text-gray-900 hover:text-primary button-transition",children:["Set up focus groups ",a.jsx("span",{"aria-hidden":"true",children:"→"})]})]})]}),a.jsx("div",{className:"mt-16 sm:mt-24 lg:mt-0 lg:flex-shrink-0 lg:flex-grow",children:a.jsxs("div",{className:"relative glass-card mx-auto w-[350px] h-[450px] rounded-2xl shadow-xl overflow-hidden animate-float",children:[a.jsxs("div",{className:"absolute top-4 left-4 right-4 h-12 bg-white/70 backdrop-blur-sm rounded-lg flex items-center px-4",children:[a.jsx("div",{className:"h-3 w-3 rounded-full bg-red-400 mr-2"}),a.jsx("div",{className:"h-3 w-3 rounded-full bg-yellow-400 mr-2"}),a.jsx("div",{className:"h-3 w-3 rounded-full bg-green-400 mr-2"}),a.jsx("div",{className:"text-xs text-gray-500 ml-2",children:"Shampoo Brand Perception"})]}),a.jsx("div",{className:"absolute top-20 left-4 right-4 bottom-4 bg-gray-50 rounded-lg overflow-hidden",children:[1,2,3,4].map(t=>a.jsx("div",{className:`flex ${t%2===0?"justify-end":"justify-start"} px-3 py-2`,children:a.jsxs("div",{className:`max-w-[70%] rounded-lg px-3 py-2 text-xs ${t%2===0?"bg-primary text-white":"bg-gray-200 text-gray-800"}`,children:[t===1&&"What qualities do you look for in a premium shampoo brand?",t===2&&"I value natural ingredients and a brand that feels luxurious but still eco-friendly.",t===3&&"How important is fragrance in your shampoo selection?",t===4&&"Very important - it affects my mood and how I feel about the product throughout the day."]})},t))})]})})]}),a.jsx("div",{className:"absolute inset-x-0 bottom-[-10rem] -z-10 transform-gpu overflow-hidden blur-3xl sm:bottom-[-20rem]","aria-hidden":"true",children:a.jsx("div",{className:"relative left-[calc(50%+11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-blue-400 to-primary opacity-20 sm:left-[calc(50%+30rem)] sm:w-[72.1875rem]",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})})]})}function Uu({title:t,description:e,icon:n,className:r}){return a.jsxs("div",{className:Pe("relative group glass-card rounded-xl overflow-hidden p-6 hover:shadow-lg hover:translate-y-[-4px] button-transition",r),children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary/5 to-blue-400/5 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-12 h-12 flex items-center justify-center mb-4",children:a.jsx(n,{className:"h-6 w-6 text-primary"})}),a.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:t}),a.jsx("p",{className:"text-gray-600 text-sm",children:e})]})]})}const ese=()=>(Zo(),lr(),a.jsxs("div",{className:"min-h-screen overflow-hidden bg-background",children:[a.jsx(ja,{}),a.jsx("main",{children:a.jsxs("div",{className:"pt-16",children:[a.jsx(Zie,{}),a.jsx("section",{className:"py-20 px-6 bg-white",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl font-sf font-bold sm:text-4xl",children:"Why Synthetic Personas?"}),a.jsx("p",{className:"mt-4 text-lg text-gray-600 max-w-3xl mx-auto",children:"Our platform combines advanced AI with intuitive design to help researchers gain deeper insights faster than traditional methods."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:[a.jsx(Uu,{title:"Scalable Research",description:"Create and test with thousands of synthetic personas, each with unique demographic profiles and behaviors.",icon:Fr}),a.jsx(Uu,{title:"AI-Driven Focus Groups",description:"Run autonomous focus groups moderated by AI that adapts to participant responses in real-time.",icon:Wo}),a.jsx(Uu,{title:"Instant Analysis",description:"Generate comprehensive reports and visualizations that highlight key insights and patterns.",icon:G_}),a.jsx(Uu,{title:"Diverse Perspectives",description:"Access synthetic personas from various backgrounds, ensuring representation across age, gender, and location.",icon:Fr}),a.jsx(Uu,{title:"Dynamic Discussions",description:"AI moderators guide conversations naturally, following up on interesting points without bias.",icon:dZ}),a.jsx(Uu,{title:"Comprehensive Reporting",description:"Export detailed reports with sentiment analysis, key themes, and actionable recommendations.",icon:G_})]})]})}),a.jsx("section",{className:"py-20 px-6 bg-gradient-to-b from-white to-slate-50",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl font-sf font-bold sm:text-4xl",children:"How It Works"}),a.jsx("p",{className:"mt-4 text-lg text-gray-600 max-w-3xl mx-auto",children:"Just three simple steps to gather valuable insights from synthetic personas."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:[a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"1"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Create Synthetic Personas"}),a.jsx("p",{className:"text-gray-600",children:"Define your target audience with customizable demographic profiles and personality traits."})]}),a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"2"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Set Up Focus Groups"}),a.jsx("p",{className:"text-gray-600",children:"Configure your research objectives, topics, and parameters for the AI moderator."})]}),a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"3"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Analyze Results"}),a.jsx("p",{className:"text-gray-600",children:"Review comprehensive visual reports and actionable insights from your synthetic research."})]})]}),a.jsx("div",{className:"text-center mt-12",children:a.jsx(bs,{to:"synthetic-users",className:"inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-primary hover:bg-primary/90 button-transition",children:"Get Started"})})]})}),a.jsxs("footer",{className:"bg-white py-12 px-6",children:[a.jsxs("div",{className:"max-w-7xl mx-auto flex flex-col md:flex-row justify-between items-center",children:[a.jsxs("div",{className:"mb-6 md:mb-0",children:[a.jsx("span",{className:"text-xl font-sf font-semibold text-gradient",children:"Semblance"}),a.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"AI-powered synthetic persona research"})]}),a.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Platform"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx(bs,{to:"/",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Home"})}),a.jsx("li",{children:a.jsx(bs,{to:"/synthetic-users",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Synthetic Personas"})}),a.jsx("li",{children:a.jsx(bs,{to:"/focus-groups",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Focus Groups"})}),a.jsx("li",{children:a.jsx(bs,{to:"/dashboard",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Dashboard"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Company"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"About"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Blog"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Careers"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Contact"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Legal"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Privacy"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Terms"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Security"})})]})]})]})]}),a.jsx("div",{className:"max-w-7xl mx-auto mt-8 pt-8 border-t border-gray-200",children:a.jsxs("p",{className:"text-sm text-gray-500 text-center",children:["Ā© ",new Date().getFullYear()," Semblance. All rights reserved."]})})]})]})})]})),tse=()=>{const t=Bi(),e=lr();y.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]);const n=t.pathname.startsWith("/synthetic-users/"),i=new URLSearchParams(t.search).get("fromReview")==="true";return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:a.jsxs("div",{className:"text-center p-8 max-w-md bg-white rounded-lg shadow-md",children:[a.jsx("h1",{className:"text-4xl font-bold mb-4",children:"404"}),n?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Persona Not Found"}),a.jsx("p",{className:"text-gray-500 mb-6",children:"The persona you're looking for may have been removed or doesn't exist."}),i?a.jsx(X,{onClick:()=>e("/synthetic-users?mode=create&tab=ai&step=review"),className:"mb-2 w-full",children:"Return to Review Page"}):a.jsx(X,{onClick:()=>e("/synthetic-users"),className:"mb-2 w-full",children:"View All Personas"})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Oops! Page not found"}),a.jsx("p",{className:"text-gray-500 mb-6",children:"The page you're looking for doesn't exist or has been moved."})]}),a.jsx(X,{variant:"outline",onClick:()=>e("/"),className:"w-full",children:"Return to Home"})]})})};function nse(t,e=[]){let n=[];function r(s,o){const c=y.createContext(o),l=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,v=y.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=y.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,d]}const i=()=>{const s=n.map(o=>y.createContext(o));return function(c){const l=(c==null?void 0:c[t])||s;return y.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,rse(i,...e)]}function rse(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(s)[`__scope${u}`];return{...c,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var tT="Progress",nT=100,[ise,lFe]=nse(tT),[sse,ose]=ise(tT),YB=y.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:i,getValueLabel:s=ase,...o}=t;(i||i===0)&&!nR(i)&&console.error(cse(`${i}`,"Progress"));const c=nR(i)?i:nT;r!==null&&!rR(r,c)&&console.error(lse(`${r}`,"Progress"));const l=rR(r,c)?r:null,u=yx(l)?s(l,c):void 0;return a.jsx(sse,{scope:n,value:l,max:c,children:a.jsx(it.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":yx(l)?l:void 0,"aria-valuetext":u,role:"progressbar","data-state":JB(l,c),"data-value":l??void 0,"data-max":c,...o,ref:e})})});YB.displayName=tT;var QB="ProgressIndicator",XB=y.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,i=ose(QB,n);return a.jsx(it.div,{"data-state":JB(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:e})});XB.displayName=QB;function ase(t,e){return`${Math.round(t/e*100)}%`}function JB(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function yx(t){return typeof t=="number"}function nR(t){return yx(t)&&!isNaN(t)&&t>0}function rR(t,e){return yx(t)&&!isNaN(t)&&t<=e&&t>=0}function cse(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${nT}\`.`}function lse(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: + - a positive number + - less than the value passed to \`max\` (or ${nT} if no \`max\` prop is set) + - \`null\` or \`undefined\` if the progress is indeterminate. + +Defaulting to \`null\`.`}var ZB=YB,use=XB;const $l=y.forwardRef(({className:t,value:e,...n},r)=>a.jsx(ZB,{ref:r,className:Pe("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:a.jsx(use,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));$l.displayName=ZB.displayName;var wg=t=>t.type==="checkbox",Ll=t=>t instanceof Date,pi=t=>t==null;const e3=t=>typeof t=="object";var cr=t=>!pi(t)&&!Array.isArray(t)&&e3(t)&&!Ll(t),t3=t=>cr(t)&&t.target?wg(t.target)?t.target.checked:t.target.value:t,dse=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,n3=(t,e)=>t.has(dse(e)),fse=t=>{const e=t.constructor&&t.constructor.prototype;return cr(e)&&e.hasOwnProperty("isPrototypeOf")},rT=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ai(t){let e;const n=Array.isArray(t);if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(rT&&(t instanceof Blob||t instanceof FileList))&&(n||cr(t)))if(e=n?[]:{},!n&&!fse(t))e=t;else for(const r in t)t.hasOwnProperty(r)&&(e[r]=Ai(t[r]));else return t;return e}var H0=t=>Array.isArray(t)?t.filter(Boolean):[],tr=t=>t===void 0,Me=(t,e,n)=>{if(!e||!cr(t))return n;const r=H0(e.split(/[,[\].]+?/)).reduce((i,s)=>pi(i)?i:i[s],t);return tr(r)||r===t?tr(t[e])?n:t[e]:r},ps=t=>typeof t=="boolean",iT=t=>/^\w*$/.test(t),r3=t=>H0(t.replace(/["|']|\]/g,"").split(/\.|\[/)),mn=(t,e,n)=>{let r=-1;const i=iT(e)?[e]:r3(e),s=i.length,o=s-1;for(;++rP.useContext(i3),hse=t=>{const{children:e,...n}=t;return P.createElement(i3.Provider,{value:n},e)};var s3=(t,e,n,r=!0)=>{const i={defaultValues:e._defaultValues};for(const s in t)Object.defineProperty(i,s,{get:()=>{const o=s;return e._proxyFormState[o]!==Ws.all&&(e._proxyFormState[o]=!r||Ws.all),n&&(n[o]=!0),t[o]}});return i},ji=t=>cr(t)&&!Object.keys(t).length,o3=(t,e,n,r)=>{n(t);const{name:i,...s}=t;return ji(s)||Object.keys(s).length>=Object.keys(e).length||Object.keys(s).find(o=>e[o]===(!r||Ws.all))},mp=t=>Array.isArray(t)?t:[t],a3=(t,e,n)=>!t||!e||t===e||mp(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r)));function sT(t){const e=P.useRef(t);e.current=t,P.useEffect(()=>{const n=!t.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{n&&n.unsubscribe()}},[t.disabled])}function pse(t){const e=z0(),{control:n=e.control,disabled:r,name:i,exact:s}=t||{},[o,c]=P.useState(n._formState),l=P.useRef(!0),u=P.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=P.useRef(i);return d.current=i,sT({disabled:r,next:f=>l.current&&a3(d.current,f.name,s)&&o3(f,u.current,n._updateFormState)&&c({...n._formState,...f}),subject:n._subjects.state}),P.useEffect(()=>(l.current=!0,u.current.isValid&&n._updateValid(!0),()=>{l.current=!1}),[n]),s3(o,n,u.current,!1)}var Mo=t=>typeof t=="string",c3=(t,e,n,r,i)=>Mo(t)?(r&&e.watch.add(t),Me(n,t,i)):Array.isArray(t)?t.map(s=>(r&&e.watch.add(s),Me(n,s))):(r&&(e.watchAll=!0),n);function mse(t){const e=z0(),{control:n=e.control,name:r,defaultValue:i,disabled:s,exact:o}=t||{},c=P.useRef(r);c.current=r,sT({disabled:s,subject:n._subjects.values,next:d=>{a3(c.current,d.name,o)&&u(Ai(c3(c.current,n._names,d.values||n._formValues,!1,i)))}});const[l,u]=P.useState(n._getWatch(r,i));return P.useEffect(()=>n._removeUnmounted()),l}function gse(t){const e=z0(),{name:n,disabled:r,control:i=e.control,shouldUnregister:s}=t,o=n3(i._names.array,n),c=mse({control:i,name:n,defaultValue:Me(i._formValues,n,Me(i._defaultValues,n,t.defaultValue)),exact:!0}),l=pse({control:i,name:n,exact:!0}),u=P.useRef(i.register(n,{...t.rules,value:c,...ps(t.disabled)?{disabled:t.disabled}:{}}));return P.useEffect(()=>{const d=i._options.shouldUnregister||s,f=(h,p)=>{const g=Me(i._fields,h);g&&g._f&&(g._f.mount=p)};if(f(n,!0),d){const h=Ai(Me(i._options.defaultValues,n));mn(i._defaultValues,n,h),tr(Me(i._formValues,n))&&mn(i._formValues,n,h)}return()=>{(o?d&&!i._state.action:d)?i.unregister(n):f(n,!1)}},[n,i,o,s]),P.useEffect(()=>{Me(i._fields,n)&&i._updateDisabledField({disabled:r,fields:i._fields,name:n,value:Me(i._fields,n)._f.value})},[r,n,i]),{field:{name:n,value:c,...ps(r)||l.disabled?{disabled:l.disabled||r}:{},onChange:P.useCallback(d=>u.current.onChange({target:{value:t3(d),name:n},type:xx.CHANGE}),[n]),onBlur:P.useCallback(()=>u.current.onBlur({target:{value:Me(i._formValues,n),name:n},type:xx.BLUR}),[n,i]),ref:P.useCallback(d=>{const f=Me(i._fields,n);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:h=>d.setCustomValidity(h),reportValidity:()=>d.reportValidity()})},[i._fields,n])},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Me(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!Me(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Me(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Me(l.validatingFields,n)},error:{enumerable:!0,get:()=>Me(l.errors,n)}})}}const vse=t=>t.render(gse(t));var l3=(t,e,n,r,i)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:i||!0}}:{},iR=t=>({isOnSubmit:!t||t===Ws.onSubmit,isOnBlur:t===Ws.onBlur,isOnChange:t===Ws.onChange,isOnAll:t===Ws.all,isOnTouch:t===Ws.onTouched}),sR=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const gp=(t,e,n,r)=>{for(const i of n||Object.keys(t)){const s=Me(t,i);if(s){const{_f:o,...c}=s;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],i)&&!r)return!0;if(o.ref&&e(o.ref,o.name)&&!r)return!0;if(gp(c,e))break}else if(cr(c)&&gp(c,e))break}}};var yse=(t,e,n)=>{const r=mp(Me(t,n));return mn(r,"root",e[n]),mn(t,n,r),t},oT=t=>t.type==="file",wa=t=>typeof t=="function",bx=t=>{if(!rT)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},sy=t=>Mo(t),aT=t=>t.type==="radio",wx=t=>t instanceof RegExp;const oR={value:!1,isValid:!1},aR={value:!0,isValid:!0};var u3=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!tr(t[0].attributes.value)?tr(t[0].value)||t[0].value===""?aR:{value:t[0].value,isValid:!0}:aR:oR}return oR};const cR={isValid:!1,value:null};var d3=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,cR):cR;function lR(t,e,n="validate"){if(sy(t)||Array.isArray(t)&&t.every(sy)||ps(t)&&!t)return{type:n,message:sy(t)?t:"",ref:e}}var Bu=t=>cr(t)&&!wx(t)?t:{value:t,message:""},uR=async(t,e,n,r,i)=>{const{ref:s,refs:o,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:m,mount:v,disabled:b}=t._f,x=Me(e,g);if(!v||b)return{};const w=o?o[0]:s,S=E=>{r&&w.reportValidity&&(w.setCustomValidity(ps(E)?"":E||""),w.reportValidity())},C={},_=aT(s),A=wg(s),j=_||A,T=(m||oT(s))&&tr(s.value)&&tr(x)||bx(s)&&s.value===""||x===""||Array.isArray(x)&&!x.length,k=l3.bind(null,g,n,C),I=(E,O,M,U=oa.maxLength,D=oa.minLength)=>{const B=E?O:M;C[g]={type:E?U:D,message:B,ref:s,...k(E?U:D,B)}};if(i?!Array.isArray(x)||!x.length:c&&(!j&&(T||pi(x))||ps(x)&&!x||A&&!u3(o).isValid||_&&!d3(o).isValid)){const{value:E,message:O}=sy(c)?{value:!!c,message:c}:Bu(c);if(E&&(C[g]={type:oa.required,message:O,ref:w,...k(oa.required,O)},!n))return S(O),C}if(!T&&(!pi(d)||!pi(f))){let E,O;const M=Bu(f),U=Bu(d);if(!pi(x)&&!isNaN(x)){const D=s.valueAsNumber||x&&+x;pi(M.value)||(E=D>M.value),pi(U.value)||(O=Dnew Date(new Date().toDateString()+" "+Y),R=s.type=="time",L=s.type=="week";Mo(M.value)&&x&&(E=R?B(x)>B(M.value):L?x>M.value:D>new Date(M.value)),Mo(U.value)&&x&&(O=R?B(x)+E.value,U=!pi(O.value)&&x.length<+O.value;if((M||U)&&(I(M,E.message,O.message),!n))return S(C[g].message),C}if(h&&!T&&Mo(x)){const{value:E,message:O}=Bu(h);if(wx(E)&&!x.match(E)&&(C[g]={type:oa.pattern,message:O,ref:s,...k(oa.pattern,O)},!n))return S(O),C}if(p){if(wa(p)){const E=await p(x,e),O=lR(E,w);if(O&&(C[g]={...O,...k(oa.validate,O.message)},!n))return S(O.message),C}else if(cr(p)){let E={};for(const O in p){if(!ji(E)&&!n)break;const M=lR(await p[O](x,e),w,O);M&&(E={...M,...k(O,M.message)},S(M.message),n&&(C[g]=E))}if(!ji(E)&&(C[g]={ref:w,...E},!n))return C}}return S(!0),C};function xse(t,e){const n=e.slice(0,-1).length;let r=0;for(;r{let t=[];return{get observers(){return t},next:i=>{for(const s of t)s.next&&s.next(i)},subscribe:i=>(t.push(i),{unsubscribe:()=>{t=t.filter(s=>s!==i)}}),unsubscribe:()=>{t=[]}}},gA=t=>pi(t)||!e3(t);function dc(t,e){if(gA(t)||gA(e))return t===e;if(Ll(t)&&Ll(e))return t.getTime()===e.getTime();const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const i of n){const s=t[i];if(!r.includes(i))return!1;if(i!=="ref"){const o=e[i];if(Ll(s)&&Ll(o)||cr(s)&&cr(o)||Array.isArray(s)&&Array.isArray(o)?!dc(s,o):s!==o)return!1}}return!0}var f3=t=>t.type==="select-multiple",wse=t=>aT(t)||wg(t),GS=t=>bx(t)&&t.isConnected,h3=t=>{for(const e in t)if(wa(t[e]))return!0;return!1};function Sx(t,e={}){const n=Array.isArray(t);if(cr(t)||n)for(const r in t)Array.isArray(t[r])||cr(t[r])&&!h3(t[r])?(e[r]=Array.isArray(t[r])?[]:{},Sx(t[r],e[r])):pi(t[r])||(e[r]=!0);return e}function p3(t,e,n){const r=Array.isArray(t);if(cr(t)||r)for(const i in t)Array.isArray(t[i])||cr(t[i])&&!h3(t[i])?tr(e)||gA(n[i])?n[i]=Array.isArray(t[i])?Sx(t[i],[]):{...Sx(t[i])}:p3(t[i],pi(e)?{}:e[i],n[i]):n[i]=!dc(t[i],e[i]);return n}var jh=(t,e)=>p3(t,e,Sx(e)),m3=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>tr(t)?t:e?t===""?NaN:t&&+t:n&&Mo(t)?new Date(t):r?r(t):t;function KS(t){const e=t.ref;if(!(t.refs?t.refs.every(n=>n.disabled):e.disabled))return oT(e)?e.files:aT(e)?d3(t.refs).value:f3(e)?[...e.selectedOptions].map(({value:n})=>n):wg(e)?u3(t.refs).value:m3(tr(e.value)?t.ref.value:e.value,t)}var Sse=(t,e,n,r)=>{const i={};for(const s of t){const o=Me(e,s);o&&mn(i,s,o._f)}return{criteriaMode:n,names:[...t],fields:i,shouldUseNativeValidation:r}},Eh=t=>tr(t)?t:wx(t)?t.source:cr(t)?wx(t.value)?t.value.source:t.value:t;const dR="AsyncFunction";var Cse=t=>(!t||!t.validate)&&!!(wa(t.validate)&&t.validate.constructor.name===dR||cr(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===dR)),_se=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function fR(t,e,n){const r=Me(t,n);if(r||iT(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const s=i.join("."),o=Me(e,s),c=Me(t,s);if(o&&!Array.isArray(o)&&n!==s)return{name:n};if(c&&c.type)return{name:s,error:c};i.pop()}return{name:n}}var Ase=(t,e,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(e||t):(n?r.isOnBlur:i.isOnBlur)?!t:(n?r.isOnChange:i.isOnChange)?t:!0,jse=(t,e)=>!H0(Me(t,e)).length&&br(t,e);const Ese={mode:Ws.onSubmit,reValidateMode:Ws.onChange,shouldFocusError:!0};function Nse(t={}){let e={...Ese,...t},n={submitCount:0,isDirty:!1,isLoading:wa(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},i=cr(e.defaultValues)||cr(e.values)?Ai(e.defaultValues||e.values)||{}:{},s=e.shouldUnregister?{}:Ai(i),o={action:!1,mount:!1,watch:!1},c={mount:new Set,unMount:new Set,array:new Set,watch:new Set},l,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:VS(),array:VS(),state:VS()},h=iR(e.mode),p=iR(e.reValidateMode),g=e.criteriaMode===Ws.all,m=N=>$=>{clearTimeout(u),u=setTimeout(N,$)},v=async N=>{if(!t.disabled&&(d.isValid||N)){const $=e.resolver?ji((await j()).errors):await k(r,!0);$!==n.isValid&&f.state.next({isValid:$})}},b=(N,$)=>{!t.disabled&&(d.isValidating||d.validatingFields)&&((N||Array.from(c.mount)).forEach(z=>{z&&($?mn(n.validatingFields,z,$):br(n.validatingFields,z))}),f.state.next({validatingFields:n.validatingFields,isValidating:!ji(n.validatingFields)}))},x=(N,$=[],z,G,Q=!0,H=!0)=>{if(G&&z&&!t.disabled){if(o.action=!0,H&&Array.isArray(Me(r,N))){const Z=z(Me(r,N),G.argA,G.argB);Q&&mn(r,N,Z)}if(H&&Array.isArray(Me(n.errors,N))){const Z=z(Me(n.errors,N),G.argA,G.argB);Q&&mn(n.errors,N,Z),jse(n.errors,N)}if(d.touchedFields&&H&&Array.isArray(Me(n.touchedFields,N))){const Z=z(Me(n.touchedFields,N),G.argA,G.argB);Q&&mn(n.touchedFields,N,Z)}d.dirtyFields&&(n.dirtyFields=jh(i,s)),f.state.next({name:N,isDirty:E(N,$),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else mn(s,N,$)},w=(N,$)=>{mn(n.errors,N,$),f.state.next({errors:n.errors})},S=N=>{n.errors=N,f.state.next({errors:n.errors,isValid:!1})},C=(N,$,z,G)=>{const Q=Me(r,N);if(Q){const H=Me(s,N,tr(z)?Me(i,N):z);tr(H)||G&&G.defaultChecked||$?mn(s,N,$?H:KS(Q._f)):U(N,H),o.mount&&v()}},_=(N,$,z,G,Q)=>{let H=!1,Z=!1;const he={name:N};if(!t.disabled){const xe=!!(Me(r,N)&&Me(r,N)._f&&Me(r,N)._f.disabled);if(!z||G){d.isDirty&&(Z=n.isDirty,n.isDirty=he.isDirty=E(),H=Z!==he.isDirty);const Oe=xe||dc(Me(i,N),$);Z=!!(!xe&&Me(n.dirtyFields,N)),Oe||xe?br(n.dirtyFields,N):mn(n.dirtyFields,N,!0),he.dirtyFields=n.dirtyFields,H=H||d.dirtyFields&&Z!==!Oe}if(z){const Oe=Me(n.touchedFields,N);Oe||(mn(n.touchedFields,N,z),he.touchedFields=n.touchedFields,H=H||d.touchedFields&&Oe!==z)}H&&Q&&f.state.next(he)}return H?he:{}},A=(N,$,z,G)=>{const Q=Me(n.errors,N),H=d.isValid&&ps($)&&n.isValid!==$;if(t.delayError&&z?(l=m(()=>w(N,z)),l(t.delayError)):(clearTimeout(u),l=null,z?mn(n.errors,N,z):br(n.errors,N)),(z?!dc(Q,z):Q)||!ji(G)||H){const Z={...G,...H&&ps($)?{isValid:$}:{},errors:n.errors,name:N};n={...n,...Z},f.state.next(Z)}},j=async N=>{b(N,!0);const $=await e.resolver(s,e.context,Sse(N||c.mount,r,e.criteriaMode,e.shouldUseNativeValidation));return b(N),$},T=async N=>{const{errors:$}=await j(N);if(N)for(const z of N){const G=Me($,z);G?mn(n.errors,z,G):br(n.errors,z)}else n.errors=$;return $},k=async(N,$,z={valid:!0})=>{for(const G in N){const Q=N[G];if(Q){const{_f:H,...Z}=Q;if(H){const he=c.array.has(H.name),xe=Q._f&&Cse(Q._f);xe&&d.validatingFields&&b([G],!0);const Oe=await uR(Q,s,g,e.shouldUseNativeValidation&&!$,he);if(xe&&d.validatingFields&&b([G]),Oe[H.name]&&(z.valid=!1,$))break;!$&&(Me(Oe,H.name)?he?yse(n.errors,Oe,H.name):mn(n.errors,H.name,Oe[H.name]):br(n.errors,H.name))}!ji(Z)&&await k(Z,$,z)}}return z.valid},I=()=>{for(const N of c.unMount){const $=Me(r,N);$&&($._f.refs?$._f.refs.every(z=>!GS(z)):!GS($._f.ref))&&se(N)}c.unMount=new Set},E=(N,$)=>!t.disabled&&(N&&$&&mn(s,N,$),!dc(q(),i)),O=(N,$,z)=>c3(N,c,{...o.mount?s:tr($)?i:Mo(N)?{[N]:$}:$},z,$),M=N=>H0(Me(o.mount?s:i,N,t.shouldUnregister?Me(i,N,[]):[])),U=(N,$,z={})=>{const G=Me(r,N);let Q=$;if(G){const H=G._f;H&&(!H.disabled&&mn(s,N,m3($,H)),Q=bx(H.ref)&&pi($)?"":$,f3(H.ref)?[...H.ref.options].forEach(Z=>Z.selected=Q.includes(Z.value)):H.refs?wg(H.ref)?H.refs.length>1?H.refs.forEach(Z=>(!Z.defaultChecked||!Z.disabled)&&(Z.checked=Array.isArray(Q)?!!Q.find(he=>he===Z.value):Q===Z.value)):H.refs[0]&&(H.refs[0].checked=!!Q):H.refs.forEach(Z=>Z.checked=Z.value===Q):oT(H.ref)?H.ref.value="":(H.ref.value=Q,H.ref.type||f.values.next({name:N,values:{...s}})))}(z.shouldDirty||z.shouldTouch)&&_(N,Q,z.shouldTouch,z.shouldDirty,!0),z.shouldValidate&&Y(N)},D=(N,$,z)=>{for(const G in $){const Q=$[G],H=`${N}.${G}`,Z=Me(r,H);(c.array.has(N)||cr(Q)||Z&&!Z._f)&&!Ll(Q)?D(H,Q,z):U(H,Q,z)}},B=(N,$,z={})=>{const G=Me(r,N),Q=c.array.has(N),H=Ai($);mn(s,N,H),Q?(f.array.next({name:N,values:{...s}}),(d.isDirty||d.dirtyFields)&&z.shouldDirty&&f.state.next({name:N,dirtyFields:jh(i,s),isDirty:E(N,H)})):G&&!G._f&&!pi(H)?D(N,H,z):U(N,H,z),sR(N,c)&&f.state.next({...n}),f.values.next({name:o.mount?N:void 0,values:{...s}})},R=async N=>{o.mount=!0;const $=N.target;let z=$.name,G=!0;const Q=Me(r,z),H=()=>$.type?KS(Q._f):t3(N),Z=he=>{G=Number.isNaN(he)||Ll(he)&&isNaN(he.getTime())||dc(he,Me(s,z,he))};if(Q){let he,xe;const Oe=H(),be=N.type===xx.BLUR||N.type===xx.FOCUS_OUT,We=!_se(Q._f)&&!e.resolver&&!Me(n.errors,z)&&!Q._f.deps||Ase(be,Me(n.touchedFields,z),n.isSubmitted,p,h),ot=sR(z,c,be);mn(s,z,Oe),be?(Q._f.onBlur&&Q._f.onBlur(N),l&&l(0)):Q._f.onChange&&Q._f.onChange(N);const Rt=_(z,Oe,be,!1),Ke=!ji(Rt)||ot;if(!be&&f.values.next({name:z,type:N.type,values:{...s}}),We)return d.isValid&&(t.mode==="onBlur"?be&&v():v()),Ke&&f.state.next({name:z,...ot?{}:Rt});if(!be&&ot&&f.state.next({...n}),e.resolver){const{errors:Ze}=await j([z]);if(Z(Oe),G){const _t=fR(n.errors,r,z),Kt=fR(Ze,r,_t.name||z);he=Kt.error,z=Kt.name,xe=ji(Ze)}}else b([z],!0),he=(await uR(Q,s,g,e.shouldUseNativeValidation))[z],b([z]),Z(Oe),G&&(he?xe=!1:d.isValid&&(xe=await k(r,!0)));G&&(Q._f.deps&&Y(Q._f.deps),A(z,xe,he,Rt))}},L=(N,$)=>{if(Me(n.errors,$)&&N.focus)return N.focus(),1},Y=async(N,$={})=>{let z,G;const Q=mp(N);if(e.resolver){const H=await T(tr(N)?N:Q);z=ji(H),G=N?!Q.some(Z=>Me(H,Z)):z}else N?(G=(await Promise.all(Q.map(async H=>{const Z=Me(r,H);return await k(Z&&Z._f?{[H]:Z}:Z)}))).every(Boolean),!(!G&&!n.isValid)&&v()):G=z=await k(r);return f.state.next({...!Mo(N)||d.isValid&&z!==n.isValid?{}:{name:N},...e.resolver||!N?{isValid:z}:{},errors:n.errors}),$.shouldFocus&&!G&&gp(r,L,N?Q:c.mount),G},q=N=>{const $={...o.mount?s:i};return tr(N)?$:Mo(N)?Me($,N):N.map(z=>Me($,z))},J=(N,$)=>({invalid:!!Me(($||n).errors,N),isDirty:!!Me(($||n).dirtyFields,N),error:Me(($||n).errors,N),isValidating:!!Me(n.validatingFields,N),isTouched:!!Me(($||n).touchedFields,N)}),me=N=>{N&&mp(N).forEach($=>br(n.errors,$)),f.state.next({errors:N?n.errors:{}})},F=(N,$,z)=>{const G=(Me(r,N,{_f:{}})._f||{}).ref,Q=Me(n.errors,N)||{},{ref:H,message:Z,type:he,...xe}=Q;mn(n.errors,N,{...xe,...$,ref:G}),f.state.next({name:N,errors:n.errors,isValid:!1}),z&&z.shouldFocus&&G&&G.focus&&G.focus()},oe=(N,$)=>wa(N)?f.values.subscribe({next:z=>N(O(void 0,$),z)}):O(N,$,!0),se=(N,$={})=>{for(const z of N?mp(N):c.mount)c.mount.delete(z),c.array.delete(z),$.keepValue||(br(r,z),br(s,z)),!$.keepError&&br(n.errors,z),!$.keepDirty&&br(n.dirtyFields,z),!$.keepTouched&&br(n.touchedFields,z),!$.keepIsValidating&&br(n.validatingFields,z),!e.shouldUnregister&&!$.keepDefaultValue&&br(i,z);f.values.next({values:{...s}}),f.state.next({...n,...$.keepDirty?{isDirty:E()}:{}}),!$.keepIsValid&&v()},le=({disabled:N,name:$,field:z,fields:G,value:Q})=>{if(ps(N)&&o.mount||N){const H=N?void 0:tr(Q)?KS(z?z._f:Me(G,$)._f):Q;mn(s,$,H),_($,H,!1,!1,!0)}},ke=(N,$={})=>{let z=Me(r,N);const G=ps($.disabled)||ps(t.disabled);return mn(r,N,{...z||{},_f:{...z&&z._f?z._f:{ref:{name:N}},name:N,mount:!0,...$}}),c.mount.add(N),z?le({field:z,disabled:ps($.disabled)?$.disabled:t.disabled,name:N,value:$.value}):C(N,!0,$.value),{...G?{disabled:$.disabled||t.disabled}:{},...e.progressive?{required:!!$.required,min:Eh($.min),max:Eh($.max),minLength:Eh($.minLength),maxLength:Eh($.maxLength),pattern:Eh($.pattern)}:{},name:N,onChange:R,onBlur:R,ref:Q=>{if(Q){ke(N,$),z=Me(r,N);const H=tr(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,Z=wse(H),he=z._f.refs||[];if(Z?he.find(xe=>xe===H):H===z._f.ref)return;mn(r,N,{_f:{...z._f,...Z?{refs:[...he.filter(GS),H,...Array.isArray(Me(i,N))?[{}]:[]],ref:{type:H.type,name:N}}:{ref:H}}}),C(N,!1,void 0,H)}else z=Me(r,N,{}),z._f&&(z._f.mount=!1),(e.shouldUnregister||$.shouldUnregister)&&!(n3(c.array,N)&&o.action)&&c.unMount.add(N)}}},ue=()=>e.shouldFocusError&&gp(r,L,c.mount),we=N=>{ps(N)&&(f.state.next({disabled:N}),gp(r,($,z)=>{const G=Me(r,z);G&&($.disabled=G._f.disabled||N,Array.isArray(G._f.refs)&&G._f.refs.forEach(Q=>{Q.disabled=G._f.disabled||N}))},0,!1))},Ae=(N,$)=>async z=>{let G;z&&(z.preventDefault&&z.preventDefault(),z.persist&&z.persist());let Q=Ai(s);if(f.state.next({isSubmitting:!0}),e.resolver){const{errors:H,values:Z}=await j();n.errors=H,Q=Z}else await k(r);if(br(n.errors,"root"),ji(n.errors)){f.state.next({errors:{}});try{await N(Q,z)}catch(H){G=H}}else $&&await $({...n.errors},z),ue(),setTimeout(ue);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ji(n.errors)&&!G,submitCount:n.submitCount+1,errors:n.errors}),G)throw G},ee=(N,$={})=>{Me(r,N)&&(tr($.defaultValue)?B(N,Ai(Me(i,N))):(B(N,$.defaultValue),mn(i,N,Ai($.defaultValue))),$.keepTouched||br(n.touchedFields,N),$.keepDirty||(br(n.dirtyFields,N),n.isDirty=$.defaultValue?E(N,Ai(Me(i,N))):E()),$.keepError||(br(n.errors,N),d.isValid&&v()),f.state.next({...n}))},wt=(N,$={})=>{const z=N?Ai(N):i,G=Ai(z),Q=ji(N),H=Q?i:G;if($.keepDefaultValues||(i=z),!$.keepValues){if($.keepDirtyValues){const Z=new Set([...c.mount,...Object.keys(jh(i,s))]);for(const he of Array.from(Z))Me(n.dirtyFields,he)?mn(H,he,Me(s,he)):B(he,Me(H,he))}else{if(rT&&tr(N))for(const Z of c.mount){const he=Me(r,Z);if(he&&he._f){const xe=Array.isArray(he._f.refs)?he._f.refs[0]:he._f.ref;if(bx(xe)){const Oe=xe.closest("form");if(Oe){Oe.reset();break}}}}r={}}s=t.shouldUnregister?$.keepDefaultValues?Ai(i):{}:Ai(H),f.array.next({values:{...H}}),f.values.next({values:{...H}})}c={mount:$.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!d.isValid||!!$.keepIsValid||!!$.keepDirtyValues,o.watch=!!t.shouldUnregister,f.state.next({submitCount:$.keepSubmitCount?n.submitCount:0,isDirty:Q?!1:$.keepDirty?n.isDirty:!!($.keepDefaultValues&&!dc(N,i)),isSubmitted:$.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Q?{}:$.keepDirtyValues?$.keepDefaultValues&&s?jh(i,s):n.dirtyFields:$.keepDefaultValues&&N?jh(i,N):$.keepDirty?n.dirtyFields:{},touchedFields:$.keepTouched?n.touchedFields:{},errors:$.keepErrors?n.errors:{},isSubmitSuccessful:$.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},et=(N,$)=>wt(wa(N)?N(s):N,$);return{control:{register:ke,unregister:se,getFieldState:J,handleSubmit:Ae,setError:F,_executeSchema:j,_getWatch:O,_getDirty:E,_updateValid:v,_removeUnmounted:I,_updateFieldArray:x,_updateDisabledField:le,_getFieldArray:M,_reset:wt,_resetDefaultValues:()=>wa(e.defaultValues)&&e.defaultValues().then(N=>{et(N,e.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:N=>{n={...n,...N}},_disableForm:we,_subjects:f,_proxyFormState:d,_setErrors:S,get _fields(){return r},get _formValues(){return s},get _state(){return o},set _state(N){o=N},get _defaultValues(){return i},get _names(){return c},set _names(N){c=N},get _formState(){return n},set _formState(N){n=N},get _options(){return e},set _options(N){e={...e,...N}}},trigger:Y,register:ke,handleSubmit:Ae,watch:oe,setValue:B,getValues:q,reset:et,resetField:ee,clearErrors:me,unregister:se,setError:F,setFocus:(N,$={})=>{const z=Me(r,N),G=z&&z._f;if(G){const Q=G.refs?G.refs[0]:G.ref;Q.focus&&(Q.focus(),$.shouldSelect&&Q.select())}},getFieldState:J}}function V0(t={}){const e=P.useRef(),n=P.useRef(),[r,i]=P.useState({isDirty:!1,isValidating:!1,isLoading:wa(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:wa(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...Nse(t),formState:r});const s=e.current.control;return s._options=t,sT({subject:s._subjects.state,next:o=>{o3(o,s._proxyFormState,s._updateFormState,!0)&&i({...s._formState})}}),P.useEffect(()=>s._disableForm(t.disabled),[s,t.disabled]),P.useEffect(()=>{if(s._proxyFormState.isDirty){const o=s._getDirty();o!==r.isDirty&&s._subjects.state.next({isDirty:o})}},[s,r.isDirty]),P.useEffect(()=>{t.values&&!dc(t.values,n.current)?(s._reset(t.values,s._options.resetOptions),n.current=t.values,i(o=>({...o}))):s._resetDefaultValues()},[t.values,s]),P.useEffect(()=>{t.errors&&s._setErrors(t.errors)},[t.errors,s]),P.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),P.useEffect(()=>{t.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[t.shouldUnregister,s]),P.useEffect(()=>{e.current&&(e.current.watch=e.current.watch.bind({}))},[r]),e.current.formState=s3(r,s),e.current}const hR=(t,e,n)=>{if(t&&"reportValidity"in t){const r=Me(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},g3=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?hR(r.ref,n,t):r.refs&&r.refs.forEach(i=>hR(i,n,t))}},Tse=(t,e)=>{e.shouldUseNativeValidation&&g3(t,e);const n={};for(const r in t){const i=Me(e.fields,r),s=Object.assign(t[r]||{},{ref:i&&i.ref});if(Pse(e.names||Object.keys(t),r)){const o=Object.assign({},Me(n,r));mn(o,"root",s),mn(n,r,o)}else mn(n,r,s)}return n},Pse=(t,e)=>t.some(n=>n.startsWith(e+"."));var kse=function(t,e){for(var n={};t.length;){var r=t[0],i=r.code,s=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var c=r.unionErrors[0].errors[0];n[o]={message:c.message,type:c.code}}else n[o]={message:s,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return t.push(f)})}),e){var l=n[o].types,u=l&&l[r.code];n[o]=l3(o,e,n,i,u?[].concat(u,r.message):r.message)}t.shift()}return n},G0=function(t,e,n){return n===void 0&&(n={}),function(r,i,s){try{return Promise.resolve(function(o,c){try{var l=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(u){return s.shouldUseNativeValidation&&g3({},s),{errors:{},values:n.raw?r:u}})}catch(u){return c(u)}return l&&l.then?l.then(void 0,c):l}(0,function(o){if(function(c){return Array.isArray(c==null?void 0:c.errors)}(o))return{values:{},errors:Tse(kse(o.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw o}))}catch(o){return Promise.reject(o)}}},tn;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),o={};for(const c of s)o[c]=i[c];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},t.find=(i,s)=>{for(const o of i)if(s(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(tn||(tn={}));var vA;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(vA||(vA={}));const Ge=tn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),fc=t=>{switch(typeof t){case"undefined":return Ge.undefined;case"string":return Ge.string;case"number":return isNaN(t)?Ge.nan:Ge.number;case"boolean":return Ge.boolean;case"function":return Ge.function;case"bigint":return Ge.bigint;case"symbol":return Ge.symbol;case"object":return Array.isArray(t)?Ge.array:t===null?Ge.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ge.promise:typeof Map<"u"&&t instanceof Map?Ge.map:typeof Set<"u"&&t instanceof Set?Ge.set:typeof Date<"u"&&t instanceof Date?Ge.date:Ge.object;default:return Ge.unknown}},_e=tn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ose=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class ns extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const n=e||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let c=r,l=0;for(;ln.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ns.create=t=>new ns(t);const ef=(t,e)=>{let n;switch(t.code){case _e.invalid_type:t.received===Ge.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case _e.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,tn.jsonStringifyReplacer)}`;break;case _e.unrecognized_keys:n=`Unrecognized key(s) in object: ${tn.joinValues(t.keys,", ")}`;break;case _e.invalid_union:n="Invalid input";break;case _e.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${tn.joinValues(t.options)}`;break;case _e.invalid_enum_value:n=`Invalid enum value. Expected ${tn.joinValues(t.options)}, received '${t.received}'`;break;case _e.invalid_arguments:n="Invalid function arguments";break;case _e.invalid_return_type:n="Invalid function return type";break;case _e.invalid_date:n="Invalid date";break;case _e.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:tn.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case _e.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case _e.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case _e.custom:n="Invalid input";break;case _e.invalid_intersection_types:n="Intersection results could not be merged";break;case _e.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case _e.not_finite:n="Number must be finite";break;default:n=e.defaultError,tn.assertNever(t)}return{message:n}};let v3=ef;function Ise(t){v3=t}function Cx(){return v3}const _x=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let c="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)c=u(o,{data:e,defaultError:c}).message;return{...i,path:s,message:c}},Rse=[];function He(t,e){const n=Cx(),r=_x({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ef?void 0:ef].filter(i=>!!i)});t.common.issues.push(r)}class ai{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return Tt;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return ai.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Tt;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:e.value,value:r}}}const Tt=Object.freeze({status:"aborted"}),ud=t=>({status:"dirty",value:t}),wi=t=>({status:"valid",value:t}),yA=t=>t.status==="aborted",xA=t=>t.status==="dirty",sm=t=>t.status==="valid",om=t=>typeof Promise<"u"&&t instanceof Promise;function Ax(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function y3(t,e,n,r,i){if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var ct;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ct||(ct={}));var Kh,Wh;class qo{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const pR=(t,e)=>{if(sm(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ns(t.common.issues);return this._error=n,this._error}}};function Lt(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,c)=>{var l,u;const{message:d}=t;return o.code==="invalid_enum_value"?{message:d??c.defaultError}:typeof c.data>"u"?{message:(l=d??r)!==null&&l!==void 0?l:c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:c.defaultError}},description:i}}class Gt{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return fc(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:fc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ai,ctx:{common:e.parent.common,data:e.data,parsedType:fc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(om(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:fc(e)},s=this._parseSync({data:e,path:i.path,parent:i});return pR(i,s)}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:fc(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(om(i)?i:Promise.resolve(i));return pR(r,s)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=e(i),c=()=>s.addIssue({code:_e.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new mo({schema:this,typeName:Et.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Bo.create(this,this._def)}nullable(){return rl.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return no.create(this,this._def)}promise(){return nf.create(this,this._def)}or(e){return um.create([this,e],this._def)}and(e){return dm.create(this,e,this._def)}transform(e){return new mo({...Lt(this._def),schema:this,typeName:Et.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new gm({...Lt(this._def),innerType:this,defaultValue:n,typeName:Et.ZodDefault})}brand(){return new cT({typeName:Et.ZodBranded,type:this,...Lt(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new vm({...Lt(this._def),innerType:this,catchValue:n,typeName:Et.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Sg.create(this,e)}readonly(){return ym.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Mse=/^c[^\s-]{8,}$/i,Dse=/^[0-9a-z]+$/,$se=/^[0-9A-HJKMNP-TV-Z]{26}$/,Lse=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Fse=/^[a-z0-9_-]{21}$/i,Use=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Bse=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Hse="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let WS;const zse=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Vse=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Gse=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,x3="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Kse=new RegExp(`^${x3}$`);function b3(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Wse(t){return new RegExp(`^${b3(t)}$`)}function w3(t){let e=`${x3}T${b3(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function qse(t,e){return!!((e==="v4"||!e)&&zse.test(t)||(e==="v6"||!e)&&Vse.test(t))}class Qs extends Gt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ge.string){const s=this._getOrReturnCtx(e);return He(s,{code:_e.invalid_type,expected:Ge.string,received:s.parsedType}),Tt}const r=new ai;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.lengths.value&&(i=this._getOrReturnCtx(e,i),He(i,{code:_e.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=e.data.length>s.value,c=e.data.lengthe.test(i),{validation:n,code:_e.invalid_string,...ct.errToObj(r)})}_addCheck(e){return new Qs({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ct.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...ct.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...ct.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ct.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...ct.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...ct.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...ct.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...ct.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...ct.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...ct.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...ct.errToObj(n)})}nonempty(e){return this.min(1,ct.errToObj(e))}trim(){return new Qs({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Qs({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Qs({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value{var e;return new Qs({checks:[],typeName:Et.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Lt(t)})};function Yse(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,s=parseInt(t.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return s%o/Math.pow(10,i)}class el extends Gt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ge.number){const s=this._getOrReturnCtx(e);return He(s,{code:_e.invalid_type,expected:Ge.number,received:s.parsedType}),Tt}let r;const i=new ai;for(const s of this._def.checks)s.kind==="int"?tn.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),He(r,{code:_e.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),He(r,{code:_e.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?Yse(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),He(r,{code:_e.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),He(r,{code:_e.not_finite,message:s.message}),i.dirty()):tn.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ct.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ct.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ct.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ct.toString(n))}setLimit(e,n,r,i){return new el({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ct.toString(i)}]})}_addCheck(e){return new el({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ct.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ct.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ct.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuee.kind==="int"||e.kind==="multipleOf"&&tn.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.valuenew el({checks:[],typeName:Et.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Lt(t)});class tl extends Gt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Ge.bigint){const s=this._getOrReturnCtx(e);return He(s,{code:_e.invalid_type,expected:Ge.bigint,received:s.parsedType}),Tt}let r;const i=new ai;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),He(r,{code:_e.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),He(r,{code:_e.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):tn.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ct.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ct.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ct.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ct.toString(n))}setLimit(e,n,r,i){return new tl({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ct.toString(i)}]})}_addCheck(e){return new tl({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ct.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ct.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value{var e;return new tl({checks:[],typeName:Et.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Lt(t)})};class am extends Gt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ge.boolean){const r=this._getOrReturnCtx(e);return He(r,{code:_e.invalid_type,expected:Ge.boolean,received:r.parsedType}),Tt}return wi(e.data)}}am.create=t=>new am({typeName:Et.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Lt(t)});class xu extends Gt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ge.date){const s=this._getOrReturnCtx(e);return He(s,{code:_e.invalid_type,expected:Ge.date,received:s.parsedType}),Tt}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return He(s,{code:_e.invalid_date}),Tt}const r=new ai;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()s.value&&(i=this._getOrReturnCtx(e,i),He(i,{code:_e.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):tn.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new xu({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ct.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ct.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew xu({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Et.ZodDate,...Lt(t)});class jx extends Gt{_parse(e){if(this._getType(e)!==Ge.symbol){const r=this._getOrReturnCtx(e);return He(r,{code:_e.invalid_type,expected:Ge.symbol,received:r.parsedType}),Tt}return wi(e.data)}}jx.create=t=>new jx({typeName:Et.ZodSymbol,...Lt(t)});class cm extends Gt{_parse(e){if(this._getType(e)!==Ge.undefined){const r=this._getOrReturnCtx(e);return He(r,{code:_e.invalid_type,expected:Ge.undefined,received:r.parsedType}),Tt}return wi(e.data)}}cm.create=t=>new cm({typeName:Et.ZodUndefined,...Lt(t)});class lm extends Gt{_parse(e){if(this._getType(e)!==Ge.null){const r=this._getOrReturnCtx(e);return He(r,{code:_e.invalid_type,expected:Ge.null,received:r.parsedType}),Tt}return wi(e.data)}}lm.create=t=>new lm({typeName:Et.ZodNull,...Lt(t)});class tf extends Gt{constructor(){super(...arguments),this._any=!0}_parse(e){return wi(e.data)}}tf.create=t=>new tf({typeName:Et.ZodAny,...Lt(t)});class Zl extends Gt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return wi(e.data)}}Zl.create=t=>new Zl({typeName:Et.ZodUnknown,...Lt(t)});class Fa extends Gt{_parse(e){const n=this._getOrReturnCtx(e);return He(n,{code:_e.invalid_type,expected:Ge.never,received:n.parsedType}),Tt}}Fa.create=t=>new Fa({typeName:Et.ZodNever,...Lt(t)});class Ex extends Gt{_parse(e){if(this._getType(e)!==Ge.undefined){const r=this._getOrReturnCtx(e);return He(r,{code:_e.invalid_type,expected:Ge.void,received:r.parsedType}),Tt}return wi(e.data)}}Ex.create=t=>new Ex({typeName:Et.ZodVoid,...Lt(t)});class no extends Gt{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==Ge.array)return He(n,{code:_e.invalid_type,expected:Ge.array,received:n.parsedType}),Tt;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,c=n.data.lengthi.maxLength.value&&(He(n,{code:_e.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,c)=>i.type._parseAsync(new qo(n,o,n.path,c)))).then(o=>ai.mergeArray(r,o));const s=[...n.data].map((o,c)=>i.type._parseSync(new qo(n,o,n.path,c)));return ai.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new no({...this._def,minLength:{value:e,message:ct.toString(n)}})}max(e,n){return new no({...this._def,maxLength:{value:e,message:ct.toString(n)}})}length(e,n){return new no({...this._def,exactLength:{value:e,message:ct.toString(n)}})}nonempty(e){return this.min(1,e)}}no.create=(t,e)=>new no({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Et.ZodArray,...Lt(e)});function Xu(t){if(t instanceof Kn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Bo.create(Xu(r))}return new Kn({...t._def,shape:()=>e})}else return t instanceof no?new no({...t._def,type:Xu(t.element)}):t instanceof Bo?Bo.create(Xu(t.unwrap())):t instanceof rl?rl.create(Xu(t.unwrap())):t instanceof Yo?Yo.create(t.items.map(e=>Xu(e))):t}class Kn extends Gt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=tn.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==Ge.object){const u=this._getOrReturnCtx(e);return He(u,{code:_e.invalid_type,expected:Ge.object,received:u.parsedType}),Tt}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof Fa&&this._def.unknownKeys==="strip"))for(const u in i.data)o.includes(u)||c.push(u);const l=[];for(const u of o){const d=s[u],f=i.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new qo(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Fa){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of c)l.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")c.length>0&&(He(i,{code:_e.unrecognized_keys,keys:c}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of c){const f=i.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new qo(i,f,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of l){const f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>ai.mergeObjectSync(r,u)):ai.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ct.errToObj,new Kn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,s,o,c;const l=(o=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,n,r).message)!==null&&o!==void 0?o:r.defaultError;return n.code==="unrecognized_keys"?{message:(c=ct.errToObj(e).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new Kn({...this._def,unknownKeys:"strip"})}passthrough(){return new Kn({...this._def,unknownKeys:"passthrough"})}extend(e){return new Kn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Kn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Et.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Kn({...this._def,catchall:e})}pick(e){const n={};return tn.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Kn({...this._def,shape:()=>n})}omit(e){const n={};return tn.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new Kn({...this._def,shape:()=>n})}deepPartial(){return Xu(this)}partial(e){const n={};return tn.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}),new Kn({...this._def,shape:()=>n})}required(e){const n={};return tn.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Bo;)s=s._def.innerType;n[r]=s}}),new Kn({...this._def,shape:()=>n})}keyof(){return S3(tn.objectKeys(this.shape))}}Kn.create=(t,e)=>new Kn({shape:()=>t,unknownKeys:"strip",catchall:Fa.create(),typeName:Et.ZodObject,...Lt(e)});Kn.strictCreate=(t,e)=>new Kn({shape:()=>t,unknownKeys:"strict",catchall:Fa.create(),typeName:Et.ZodObject,...Lt(e)});Kn.lazycreate=(t,e)=>new Kn({shape:t,unknownKeys:"strip",catchall:Fa.create(),typeName:Et.ZodObject,...Lt(e)});class um extends Gt{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const o=s.map(c=>new ns(c.ctx.common.issues));return He(n,{code:_e.invalid_union,unionErrors:o}),Tt}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=l._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const c=o.map(l=>new ns(l));return He(n,{code:_e.invalid_union,unionErrors:c}),Tt}}get options(){return this._def.options}}um.create=(t,e)=>new um({options:t,typeName:Et.ZodUnion,...Lt(e)});const la=t=>t instanceof hm?la(t.schema):t instanceof mo?la(t.innerType()):t instanceof pm?[t.value]:t instanceof nl?t.options:t instanceof mm?tn.objectValues(t.enum):t instanceof gm?la(t._def.innerType):t instanceof cm?[void 0]:t instanceof lm?[null]:t instanceof Bo?[void 0,...la(t.unwrap())]:t instanceof rl?[null,...la(t.unwrap())]:t instanceof cT||t instanceof ym?la(t.unwrap()):t instanceof vm?la(t._def.innerType):[];class K0 extends Gt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.object)return He(n,{code:_e.invalid_type,expected:Ge.object,received:n.parsedType}),Tt;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(He(n,{code:_e.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Tt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const i=new Map;for(const s of n){const o=la(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const c of o){if(i.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);i.set(c,s)}}return new K0({typeName:Et.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...Lt(r)})}}function bA(t,e){const n=fc(t),r=fc(e);if(t===e)return{valid:!0,data:t};if(n===Ge.object&&r===Ge.object){const i=tn.objectKeys(e),s=tn.objectKeys(t).filter(c=>i.indexOf(c)!==-1),o={...t,...e};for(const c of s){const l=bA(t[c],e[c]);if(!l.valid)return{valid:!1};o[c]=l.data}return{valid:!0,data:o}}else if(n===Ge.array&&r===Ge.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s{if(yA(s)||yA(o))return Tt;const c=bA(s.value,o.value);return c.valid?((xA(s)||xA(o))&&n.dirty(),{status:n.value,value:c.data}):(He(r,{code:_e.invalid_intersection_types}),Tt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}dm.create=(t,e,n)=>new dm({left:t,right:e,typeName:Et.ZodIntersection,...Lt(n)});class Yo extends Gt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ge.array)return He(r,{code:_e.invalid_type,expected:Ge.array,received:r.parsedType}),Tt;if(r.data.lengththis._def.items.length&&(He(r,{code:_e.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,c)=>{const l=this._def.items[c]||this._def.rest;return l?l._parse(new qo(r,o,r.path,c)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>ai.mergeArray(n,o)):ai.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Yo({...this._def,rest:e})}}Yo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Yo({items:t,typeName:Et.ZodTuple,rest:null,...Lt(e)})};class fm extends Gt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ge.object)return He(r,{code:_e.invalid_type,expected:Ge.object,received:r.parsedType}),Tt;const i=[],s=this._def.keyType,o=this._def.valueType;for(const c in r.data)i.push({key:s._parse(new qo(r,c,r.path,c)),value:o._parse(new qo(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?ai.mergeObjectAsync(n,i):ai.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Gt?new fm({keyType:e,valueType:n,typeName:Et.ZodRecord,...Lt(r)}):new fm({keyType:Qs.create(),valueType:e,typeName:Et.ZodRecord,...Lt(n)})}}class Nx extends Gt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ge.map)return He(r,{code:_e.invalid_type,expected:Ge.map,received:r.parsedType}),Tt;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([c,l],u)=>({key:i._parse(new qo(r,c,r.path,[u,"key"])),value:s._parse(new qo(r,l,r.path,[u,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const l of o){const u=await l.key,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return Tt;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),c.set(u.value,d.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const l of o){const u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return Tt;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),c.set(u.value,d.value)}return{status:n.value,value:c}}}}Nx.create=(t,e,n)=>new Nx({valueType:e,keyType:t,typeName:Et.ZodMap,...Lt(n)});class bu extends Gt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ge.set)return He(r,{code:_e.invalid_type,expected:Ge.set,received:r.parsedType}),Tt;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(He(r,{code:_e.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(l){const u=new Set;for(const d of l){if(d.status==="aborted")return Tt;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const c=[...r.data.values()].map((l,u)=>s._parse(new qo(r,l,r.path,u)));return r.common.async?Promise.all(c).then(l=>o(l)):o(c)}min(e,n){return new bu({...this._def,minSize:{value:e,message:ct.toString(n)}})}max(e,n){return new bu({...this._def,maxSize:{value:e,message:ct.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}bu.create=(t,e)=>new bu({valueType:t,minSize:null,maxSize:null,typeName:Et.ZodSet,...Lt(e)});class jd extends Gt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.function)return He(n,{code:_e.invalid_type,expected:Ge.function,received:n.parsedType}),Tt;function r(c,l){return _x({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Cx(),ef].filter(u=>!!u),issueData:{code:_e.invalid_arguments,argumentsError:l}})}function i(c,l){return _x({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Cx(),ef].filter(u=>!!u),issueData:{code:_e.invalid_return_type,returnTypeError:l}})}const s={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof nf){const c=this;return wi(async function(...l){const u=new ns([]),d=await c._def.args.parseAsync(l,s).catch(p=>{throw u.addIssue(r(l,p)),u}),f=await Reflect.apply(o,this,d);return await c._def.returns._def.type.parseAsync(f,s).catch(p=>{throw u.addIssue(i(f,p)),u})})}else{const c=this;return wi(function(...l){const u=c._def.args.safeParse(l,s);if(!u.success)throw new ns([r(l,u.error)]);const d=Reflect.apply(o,this,u.data),f=c._def.returns.safeParse(d,s);if(!f.success)throw new ns([i(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new jd({...this._def,args:Yo.create(e).rest(Zl.create())})}returns(e){return new jd({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new jd({args:e||Yo.create([]).rest(Zl.create()),returns:n||Zl.create(),typeName:Et.ZodFunction,...Lt(r)})}}class hm extends Gt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}hm.create=(t,e)=>new hm({getter:t,typeName:Et.ZodLazy,...Lt(e)});class pm extends Gt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return He(n,{received:n.data,code:_e.invalid_literal,expected:this._def.value}),Tt}return{status:"valid",value:e.data}}get value(){return this._def.value}}pm.create=(t,e)=>new pm({value:t,typeName:Et.ZodLiteral,...Lt(e)});function S3(t,e){return new nl({values:t,typeName:Et.ZodEnum,...Lt(e)})}class nl extends Gt{constructor(){super(...arguments),Kh.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return He(n,{expected:tn.joinValues(r),received:n.parsedType,code:_e.invalid_type}),Tt}if(Ax(this,Kh)||y3(this,Kh,new Set(this._def.values)),!Ax(this,Kh).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return He(n,{received:n.data,code:_e.invalid_enum_value,options:r}),Tt}return wi(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return nl.create(e,{...this._def,...n})}exclude(e,n=this._def){return nl.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Kh=new WeakMap;nl.create=S3;class mm extends Gt{constructor(){super(...arguments),Wh.set(this,void 0)}_parse(e){const n=tn.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ge.string&&r.parsedType!==Ge.number){const i=tn.objectValues(n);return He(r,{expected:tn.joinValues(i),received:r.parsedType,code:_e.invalid_type}),Tt}if(Ax(this,Wh)||y3(this,Wh,new Set(tn.getValidEnumValues(this._def.values))),!Ax(this,Wh).has(e.data)){const i=tn.objectValues(n);return He(r,{received:r.data,code:_e.invalid_enum_value,options:i}),Tt}return wi(e.data)}get enum(){return this._def.values}}Wh=new WeakMap;mm.create=(t,e)=>new mm({values:t,typeName:Et.ZodNativeEnum,...Lt(e)});class nf extends Gt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.promise&&n.common.async===!1)return He(n,{code:_e.invalid_type,expected:Ge.promise,received:n.parsedType}),Tt;const r=n.parsedType===Ge.promise?n.data:Promise.resolve(n.data);return wi(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}nf.create=(t,e)=>new nf({type:t,typeName:Et.ZodPromise,...Lt(e)});class mo extends Gt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Et.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{He(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async c=>{if(n.value==="aborted")return Tt;const l=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return l.status==="aborted"?Tt:l.status==="dirty"||n.value==="dirty"?ud(l.value):l});{if(n.value==="aborted")return Tt;const c=this._def.schema._parseSync({data:o,path:r.path,parent:r});return c.status==="aborted"?Tt:c.status==="dirty"||n.value==="dirty"?ud(c.value):c}}if(i.type==="refinement"){const o=c=>{const l=i.refinement(c,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Tt:(c.status==="dirty"&&n.dirty(),o(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Tt:(c.status==="dirty"&&n.dirty(),o(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!sm(o))return o;const c=i.transform(o.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>sm(o)?Promise.resolve(i.transform(o.value,s)).then(c=>({status:n.value,value:c})):o);tn.assertNever(i)}}mo.create=(t,e,n)=>new mo({schema:t,typeName:Et.ZodEffects,effect:e,...Lt(n)});mo.createWithPreprocess=(t,e,n)=>new mo({schema:e,effect:{type:"preprocess",transform:t},typeName:Et.ZodEffects,...Lt(n)});class Bo extends Gt{_parse(e){return this._getType(e)===Ge.undefined?wi(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Bo.create=(t,e)=>new Bo({innerType:t,typeName:Et.ZodOptional,...Lt(e)});class rl extends Gt{_parse(e){return this._getType(e)===Ge.null?wi(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}rl.create=(t,e)=>new rl({innerType:t,typeName:Et.ZodNullable,...Lt(e)});class gm extends Gt{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Ge.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}gm.create=(t,e)=>new gm({innerType:t,typeName:Et.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Lt(e)});class vm extends Gt{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return om(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ns(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ns(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}vm.create=(t,e)=>new vm({innerType:t,typeName:Et.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Lt(e)});class Tx extends Gt{_parse(e){if(this._getType(e)!==Ge.nan){const r=this._getOrReturnCtx(e);return He(r,{code:_e.invalid_type,expected:Ge.nan,received:r.parsedType}),Tt}return{status:"valid",value:e.data}}}Tx.create=t=>new Tx({typeName:Et.ZodNaN,...Lt(t)});const Qse=Symbol("zod_brand");class cT extends Gt{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Sg extends Gt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Tt:s.status==="dirty"?(n.dirty(),ud(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Tt:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new Sg({in:e,out:n,typeName:Et.ZodPipeline})}}class ym extends Gt{_parse(e){const n=this._def.innerType._parse(e),r=i=>(sm(i)&&(i.value=Object.freeze(i.value)),i);return om(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}ym.create=(t,e)=>new ym({innerType:t,typeName:Et.ZodReadonly,...Lt(e)});function C3(t,e={},n){return t?tf.create().superRefine((r,i)=>{var s,o;if(!t(r)){const c=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,l=(o=(s=c.fatal)!==null&&s!==void 0?s:n)!==null&&o!==void 0?o:!0,u=typeof c=="string"?{message:c}:c;i.addIssue({code:"custom",...u,fatal:l})}}):tf.create()}const Xse={object:Kn.lazycreate};var Et;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Et||(Et={}));const Jse=(t,e={message:`Input not instance of ${t.name}`})=>C3(n=>n instanceof t,e),_3=Qs.create,A3=el.create,Zse=Tx.create,eoe=tl.create,j3=am.create,toe=xu.create,noe=jx.create,roe=cm.create,ioe=lm.create,soe=tf.create,ooe=Zl.create,aoe=Fa.create,coe=Ex.create,loe=no.create,uoe=Kn.create,doe=Kn.strictCreate,foe=um.create,hoe=K0.create,poe=dm.create,moe=Yo.create,goe=fm.create,voe=Nx.create,yoe=bu.create,xoe=jd.create,boe=hm.create,woe=pm.create,Soe=nl.create,Coe=mm.create,_oe=nf.create,mR=mo.create,Aoe=Bo.create,joe=rl.create,Eoe=mo.createWithPreprocess,Noe=Sg.create,Toe=()=>_3().optional(),Poe=()=>A3().optional(),koe=()=>j3().optional(),Ooe={string:t=>Qs.create({...t,coerce:!0}),number:t=>el.create({...t,coerce:!0}),boolean:t=>am.create({...t,coerce:!0}),bigint:t=>tl.create({...t,coerce:!0}),date:t=>xu.create({...t,coerce:!0})},Ioe=Tt;var Re=Object.freeze({__proto__:null,defaultErrorMap:ef,setErrorMap:Ise,getErrorMap:Cx,makeIssue:_x,EMPTY_PATH:Rse,addIssueToContext:He,ParseStatus:ai,INVALID:Tt,DIRTY:ud,OK:wi,isAborted:yA,isDirty:xA,isValid:sm,isAsync:om,get util(){return tn},get objectUtil(){return vA},ZodParsedType:Ge,getParsedType:fc,ZodType:Gt,datetimeRegex:w3,ZodString:Qs,ZodNumber:el,ZodBigInt:tl,ZodBoolean:am,ZodDate:xu,ZodSymbol:jx,ZodUndefined:cm,ZodNull:lm,ZodAny:tf,ZodUnknown:Zl,ZodNever:Fa,ZodVoid:Ex,ZodArray:no,ZodObject:Kn,ZodUnion:um,ZodDiscriminatedUnion:K0,ZodIntersection:dm,ZodTuple:Yo,ZodRecord:fm,ZodMap:Nx,ZodSet:bu,ZodFunction:jd,ZodLazy:hm,ZodLiteral:pm,ZodEnum:nl,ZodNativeEnum:mm,ZodPromise:nf,ZodEffects:mo,ZodTransformer:mo,ZodOptional:Bo,ZodNullable:rl,ZodDefault:gm,ZodCatch:vm,ZodNaN:Tx,BRAND:Qse,ZodBranded:cT,ZodPipeline:Sg,ZodReadonly:ym,custom:C3,Schema:Gt,ZodSchema:Gt,late:Xse,get ZodFirstPartyTypeKind(){return Et},coerce:Ooe,any:soe,array:loe,bigint:eoe,boolean:j3,date:toe,discriminatedUnion:hoe,effect:mR,enum:Soe,function:xoe,instanceof:Jse,intersection:poe,lazy:boe,literal:woe,map:voe,nan:Zse,nativeEnum:Coe,never:aoe,null:ioe,nullable:joe,number:A3,object:uoe,oboolean:koe,onumber:Poe,optional:Aoe,ostring:Toe,pipeline:Noe,preprocess:Eoe,promise:_oe,record:goe,set:yoe,strictObject:doe,string:_3,symbol:noe,transformer:mR,tuple:moe,undefined:roe,union:foe,unknown:ooe,void:coe,NEVER:Ioe,ZodIssueCode:_e,quotelessJson:Ose,ZodError:ns}),Roe="Label",E3=y.forwardRef((t,e)=>a.jsx(it.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));E3.displayName=Roe;var N3=E3;const Moe=ZN("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ms=y.forwardRef(({className:t,...e},n)=>a.jsx(N3,{ref:n,className:Pe(Moe(),t),...e}));ms.displayName=N3.displayName;const W0=hse,T3=y.createContext({}),yt=({...t})=>a.jsx(T3.Provider,{value:{name:t.name},children:a.jsx(vse,{...t})}),q0=()=>{const t=y.useContext(T3),e=y.useContext(P3),{getFieldState:n,formState:r}=z0(),i=n(t.name,r);if(!t)throw new Error("useFormField should be used within ");const{id:s}=e;return{id:s,name:t.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...i}},P3=y.createContext({}),pt=y.forwardRef(({className:t,...e},n)=>{const r=y.useId();return a.jsx(P3.Provider,{value:{id:r},children:a.jsx("div",{ref:n,className:Pe("space-y-2",t),...e})})});pt.displayName="FormItem";const mt=y.forwardRef(({className:t,...e},n)=>{const{error:r,formItemId:i}=q0();return a.jsx(ms,{ref:n,className:Pe(r&&"text-destructive",t),htmlFor:i,...e})});mt.displayName="FormLabel";const gt=y.forwardRef(({...t},e)=>{const{error:n,formItemId:r,formDescriptionId:i,formMessageId:s}=q0();return a.jsx(Go,{ref:e,id:r,"aria-describedby":n?`${i} ${s}`:`${i}`,"aria-invalid":!!n,...t})});gt.displayName="FormControl";const Mn=y.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:r}=q0();return a.jsx("p",{ref:n,id:r,className:Pe("text-sm text-muted-foreground",t),...e})});Mn.displayName="FormDescription";const vt=y.forwardRef(({className:t,children:e,...n},r)=>{const{error:i,formMessageId:s}=q0(),o=i?String(i==null?void 0:i.message):e;return o?a.jsx("p",{ref:r,id:s,className:Pe("text-sm font-medium text-destructive",t),...n,children:o}):null});vt.displayName="FormMessage";const Ht=y.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:Pe("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Ht.displayName="Input";const ht=y.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:Pe("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));ht.displayName="Textarea";function xm(t,[e,n]){return Math.min(n,Math.max(e,t))}function Doe(t,e=[]){let n=[];function r(s,o){const c=y.createContext(o),l=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,v=y.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=y.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,d]}const i=()=>{const s=n.map(o=>y.createContext(o));return function(c){const l=(c==null?void 0:c[t])||s;return y.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,$oe(i,...e)]}function $oe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(s)[`__scope${u}`];return{...c,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function Y0(t){const e=t+"CollectionProvider",[n,r]=Doe(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:g,children:m}=p,v=P.useRef(null),b=P.useRef(new Map).current;return a.jsx(i,{scope:g,itemMap:b,collectionRef:v,children:m})};o.displayName=e;const c=t+"CollectionSlot",l=P.forwardRef((p,g)=>{const{scope:m,children:v}=p,b=s(c,m),x=Pt(g,b.collectionRef);return a.jsx(Go,{ref:x,children:v})});l.displayName=c;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=P.forwardRef((p,g)=>{const{scope:m,children:v,...b}=p,x=P.useRef(null),w=Pt(g,x),S=s(u,m);return P.useEffect(()=>(S.itemMap.set(x,{ref:x,...b}),()=>void S.itemMap.delete(x))),a.jsx(Go,{[d]:"",ref:w,children:v})});f.displayName=u;function h(p){const g=s(t+"CollectionConsumer",p);return P.useCallback(()=>{const v=g.collectionRef.current;if(!v)return[];const b=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((S,C)=>b.indexOf(S.ref.current)-b.indexOf(C.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:o,Slot:l,ItemSlot:f},h,r]}var Loe=y.createContext(void 0);function Ou(t){const e=y.useContext(Loe);return t||e||"ltr"}var qS=0;function lT(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??gR()),document.body.insertAdjacentElement("beforeend",t[1]??gR()),qS++,()=>{qS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),qS--}},[])}function gR(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var YS="focusScope.autoFocusOnMount",QS="focusScope.autoFocusOnUnmount",vR={bubbles:!1,cancelable:!0},Foe="FocusScope",Q0=y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[c,l]=y.useState(null),u=Ar(i),d=Ar(s),f=y.useRef(null),h=Pt(e,m=>l(m)),p=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let m=function(w){if(p.paused||!c)return;const S=w.target;c.contains(S)?f.current=S:nc(f.current,{select:!0})},v=function(w){if(p.paused||!c)return;const S=w.relatedTarget;S!==null&&(c.contains(S)||nc(f.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&nc(c)};document.addEventListener("focusin",m),document.addEventListener("focusout",v);const x=new MutationObserver(b);return c&&x.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",v),x.disconnect()}}},[r,c,p.paused]),y.useEffect(()=>{if(c){xR.add(p);const m=document.activeElement;if(!c.contains(m)){const b=new CustomEvent(YS,vR);c.addEventListener(YS,u),c.dispatchEvent(b),b.defaultPrevented||(Uoe(Goe(k3(c)),{select:!0}),document.activeElement===m&&nc(c))}return()=>{c.removeEventListener(YS,u),setTimeout(()=>{const b=new CustomEvent(QS,vR);c.addEventListener(QS,d),c.dispatchEvent(b),b.defaultPrevented||nc(m??document.body,{select:!0}),c.removeEventListener(QS,d),xR.remove(p)},0)}}},[c,u,d,p]);const g=y.useCallback(m=>{if(!n&&!r||p.paused)return;const v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(v&&b){const x=m.currentTarget,[w,S]=Boe(x);w&&S?!m.shiftKey&&b===S?(m.preventDefault(),n&&nc(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),n&&nc(S,{select:!0})):b===x&&m.preventDefault()}},[n,r,p.paused]);return a.jsx(it.div,{tabIndex:-1,...o,ref:h,onKeyDown:g})});Q0.displayName=Foe;function Uoe(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(nc(r,{select:e}),document.activeElement!==n)return}function Boe(t){const e=k3(t),n=yR(e,t),r=yR(e.reverse(),t);return[n,r]}function k3(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function yR(t,e){for(const n of t)if(!Hoe(n,{upTo:e}))return n}function Hoe(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function zoe(t){return t instanceof HTMLInputElement&&"select"in t}function nc(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&zoe(t)&&e&&t.select()}}var xR=Voe();function Voe(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=bR(t,e),t.unshift(e)},remove(e){var n;t=bR(t,e),(n=t[0])==null||n.resume()}}}function bR(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Goe(t){return t.filter(e=>e.tagName!=="A")}function Cg(t){const e=y.useRef({value:t,previous:t});return y.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Koe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Hu=new WeakMap,yv=new WeakMap,xv={},XS=0,O3=function(t){return t&&(t.host||O3(t.parentNode))},Woe=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=O3(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},qoe=function(t,e,n,r){var i=Woe(e,Array.isArray(t)?t:[t]);xv[n]||(xv[n]=new WeakMap);var s=xv[n],o=[],c=new Set,l=new Set(i),u=function(f){!f||c.has(f)||(c.add(f),u(f.parentNode))};i.forEach(u);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(c.has(h))d(h);else try{var p=h.getAttribute(r),g=p!==null&&p!=="false",m=(Hu.get(h)||0)+1,v=(s.get(h)||0)+1;Hu.set(h,m),s.set(h,v),o.push(h),m===1&&g&&yv.set(h,!0),v===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(e),c.clear(),XS++,function(){o.forEach(function(f){var h=Hu.get(f)-1,p=s.get(f)-1;Hu.set(f,h),s.set(f,p),h||(yv.has(f)||f.removeAttribute(r),yv.delete(f)),p||f.removeAttribute(n)}),XS--,XS||(Hu=new WeakMap,Hu=new WeakMap,yv=new WeakMap,xv={})}},uT=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=Koe(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),qoe(r,i,n,"aria-hidden")):function(){return null}},Ro=function(){return Ro=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return dae;var e=fae(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},pae=D3(),Ed="data-scroll-locked",mae=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),` + .`.concat(Qoe,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(c,"px ").concat(r,`; + } + body[`).concat(Ed,`] { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` + padding-left: `.concat(i,`px; + padding-top: `).concat(s,`px; + padding-right: `).concat(o,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(c,"px ").concat(r,`; + `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(oy,` { + right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(ay,` { + margin-right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(oy," .").concat(oy,` { + right: 0 `).concat(r,`; + } + + .`).concat(ay," .").concat(ay,` { + margin-right: 0 `).concat(r,`; + } + + body[`).concat(Ed,`] { + `).concat(Xoe,": ").concat(c,`px; + } +`)},SR=function(){var t=parseInt(document.body.getAttribute(Ed)||"0",10);return isFinite(t)?t:0},gae=function(){y.useEffect(function(){return document.body.setAttribute(Ed,(SR()+1).toString()),function(){var t=SR()-1;t<=0?document.body.removeAttribute(Ed):document.body.setAttribute(Ed,t.toString())}},[])},vae=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;gae();var s=y.useMemo(function(){return hae(i)},[i]);return y.createElement(pae,{styles:mae(s,!e,i,n?"":"!important")})},wA=!1;if(typeof window<"u")try{var bv=Object.defineProperty({},"passive",{get:function(){return wA=!0,!0}});window.addEventListener("test",bv,bv),window.removeEventListener("test",bv,bv)}catch{wA=!1}var zu=wA?{passive:!1}:!1,yae=function(t){return t.tagName==="TEXTAREA"},$3=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!yae(t)&&n[e]==="visible")},xae=function(t){return $3(t,"overflowY")},bae=function(t){return $3(t,"overflowX")},CR=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=L3(t,r);if(i){var s=F3(t,r),o=s[1],c=s[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},wae=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Sae=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},L3=function(t,e){return t==="v"?xae(e):bae(e)},F3=function(t,e){return t==="v"?wae(e):Sae(e)},Cae=function(t,e){return t==="h"&&e==="rtl"?-1:1},_ae=function(t,e,n,r,i){var s=Cae(t,window.getComputedStyle(e).direction),o=s*r,c=n.target,l=e.contains(c),u=!1,d=o>0,f=0,h=0;do{var p=F3(t,c),g=p[0],m=p[1],v=p[2],b=m-v-s*g;(g||b)&&L3(t,c)&&(f+=b,h+=g),c instanceof ShadowRoot?c=c.host:c=c.parentNode}while(!l&&c!==document.body||l&&(e.contains(c)||e===c));return(d&&(Math.abs(f)<1||!i)||!d&&(Math.abs(h)<1||!i))&&(u=!0),u},wv=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},_R=function(t){return[t.deltaX,t.deltaY]},AR=function(t){return t&&"current"in t?t.current:t},Aae=function(t,e){return t[0]===e[0]&&t[1]===e[1]},jae=function(t){return` + .block-interactivity-`.concat(t,` {pointer-events: none;} + .allow-interactivity-`).concat(t,` {pointer-events: all;} +`)},Eae=0,Vu=[];function Nae(t){var e=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),i=y.useState(Eae++)[0],s=y.useState(D3)[0],o=y.useRef(t);y.useEffect(function(){o.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var m=Yoe([t.lockRef.current],(t.shards||[]).map(AR),!0).filter(Boolean);return m.forEach(function(v){return v.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var c=y.useCallback(function(m,v){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!o.current.allowPinchZoom;var b=wv(m),x=n.current,w="deltaX"in m?m.deltaX:x[0]-b[0],S="deltaY"in m?m.deltaY:x[1]-b[1],C,_=m.target,A=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in m&&A==="h"&&_.type==="range")return!1;var j=CR(A,_);if(!j)return!0;if(j?C=A:(C=A==="v"?"h":"v",j=CR(A,_)),!j)return!1;if(!r.current&&"changedTouches"in m&&(w||S)&&(r.current=C),!C)return!0;var T=r.current||C;return _ae(T,v,m,T==="h"?w:S,!0)},[]),l=y.useCallback(function(m){var v=m;if(!(!Vu.length||Vu[Vu.length-1]!==s)){var b="deltaY"in v?_R(v):wv(v),x=e.current.filter(function(C){return C.name===v.type&&(C.target===v.target||v.target===C.shadowParent)&&Aae(C.delta,b)})[0];if(x&&x.should){v.cancelable&&v.preventDefault();return}if(!x){var w=(o.current.shards||[]).map(AR).filter(Boolean).filter(function(C){return C.contains(v.target)}),S=w.length>0?c(v,w[0]):!o.current.noIsolation;S&&v.cancelable&&v.preventDefault()}}},[]),u=y.useCallback(function(m,v,b,x){var w={name:m,delta:v,target:b,should:x,shadowParent:Tae(b)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),d=y.useCallback(function(m){n.current=wv(m),r.current=void 0},[]),f=y.useCallback(function(m){u(m.type,_R(m),m.target,c(m,t.lockRef.current))},[]),h=y.useCallback(function(m){u(m.type,wv(m),m.target,c(m,t.lockRef.current))},[]);y.useEffect(function(){return Vu.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,zu),document.addEventListener("touchmove",l,zu),document.addEventListener("touchstart",d,zu),function(){Vu=Vu.filter(function(m){return m!==s}),document.removeEventListener("wheel",l,zu),document.removeEventListener("touchmove",l,zu),document.removeEventListener("touchstart",d,zu)}},[]);var p=t.removeScrollBar,g=t.inert;return y.createElement(y.Fragment,null,g?y.createElement(s,{styles:jae(i)}):null,p?y.createElement(vae,{gapMode:t.gapMode}):null)}function Tae(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Pae=iae(M3,Nae);var J0=y.forwardRef(function(t,e){return y.createElement(X0,Ro({},t,{ref:e,sideCar:Pae}))});J0.classNames=X0.classNames;var kae=[" ","Enter","ArrowUp","ArrowDown"],Oae=[" ","Enter"],_g="Select",[Z0,ew,Iae]=Y0(_g),[Wf,uFe]=Ui(_g,[Iae,$f]),tw=$f(),[Rae,dl]=Wf(_g),[Mae,Dae]=Wf(_g),U3=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:g}=t,m=tw(e),[v,b]=y.useState(null),[x,w]=y.useState(null),[S,C]=y.useState(!1),_=Ou(u),[A=!1,j]=lo({prop:r,defaultProp:i,onChange:s}),[T,k]=lo({prop:o,defaultProp:c,onChange:l}),I=y.useRef(null),E=v?g||!!v.closest("form"):!0,[O,M]=y.useState(new Set),U=Array.from(O).map(D=>D.props.value).join(";");return a.jsx(O4,{...m,children:a.jsxs(Rae,{required:p,scope:e,trigger:v,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Zs(),value:T,onValueChange:k,open:A,onOpenChange:j,dir:_,triggerPointerDownPosRef:I,disabled:h,children:[a.jsx(Z0.Provider,{scope:e,children:a.jsx(Mae,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback(D=>{M(B=>new Set(B).add(D))},[]),onNativeOptionRemove:y.useCallback(D=>{M(B=>{const R=new Set(B);return R.delete(D),R})},[]),children:n})}),E?a.jsxs(d6,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:T,onChange:D=>k(D.target.value),disabled:h,form:g,children:[T===void 0?a.jsx("option",{value:""}):null,Array.from(O)]},U):null]})})};U3.displayName=_g;var B3="SelectTrigger",H3=y.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,s=tw(n),o=dl(B3,n),c=o.disabled||r,l=Pt(e,o.onTriggerChange),u=ew(n),d=y.useRef("touch"),[f,h,p]=f6(m=>{const v=u().filter(w=>!w.disabled),b=v.find(w=>w.value===o.value),x=h6(v,m,b);x!==void 0&&o.onValueChange(x.value)}),g=m=>{c||(o.onOpenChange(!0),p()),m&&(o.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return a.jsx(SE,{asChild:!0,...s,children:a.jsx(it.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":u6(o.value)?"":void 0,...i,ref:l,onClick:Ne(i.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:Ne(i.onPointerDown,m=>{d.current=m.pointerType;const v=m.target;v.hasPointerCapture(m.pointerId)&&v.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:Ne(i.onKeyDown,m=>{const v=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(v&&m.key===" ")&&kae.includes(m.key)&&(g(),m.preventDefault())})})})});H3.displayName=B3;var z3="SelectValue",V3=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:o="",...c}=t,l=dl(z3,n),{onValueNodeHasChildrenChange:u}=l,d=s!==void 0,f=Pt(e,l.onValueNodeChange);return qr(()=>{u(d)},[u,d]),a.jsx(it.span,{...c,ref:f,style:{pointerEvents:"none"},children:u6(l.value)?a.jsx(a.Fragment,{children:o}):s})});V3.displayName=z3;var $ae="SelectIcon",G3=y.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return a.jsx(it.span,{"aria-hidden":!0,...i,ref:e,children:r||"ā–¼"})});G3.displayName=$ae;var Lae="SelectPortal",K3=t=>a.jsx(f0,{asChild:!0,...t});K3.displayName=Lae;var wu="SelectContent",W3=y.forwardRef((t,e)=>{const n=dl(wu,t.__scopeSelect),[r,i]=y.useState();if(qr(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?Rf.createPortal(a.jsx(q3,{scope:t.__scopeSelect,children:a.jsx(Z0.Slot,{scope:t.__scopeSelect,children:a.jsx("div",{children:t.children})})}),s):null}return a.jsx(Y3,{...t,ref:e})});W3.displayName=wu;var Ls=10,[q3,fl]=Wf(wu),Fae="SelectContentImpl",Y3=y.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:v,...b}=t,x=dl(wu,n),[w,S]=y.useState(null),[C,_]=y.useState(null),A=Pt(e,le=>S(le)),[j,T]=y.useState(null),[k,I]=y.useState(null),E=ew(n),[O,M]=y.useState(!1),U=y.useRef(!1);y.useEffect(()=>{if(w)return uT(w)},[w]),lT();const D=y.useCallback(le=>{const[ke,...ue]=E().map(ee=>ee.ref.current),[we]=ue.slice(-1),Ae=document.activeElement;for(const ee of le)if(ee===Ae||(ee==null||ee.scrollIntoView({block:"nearest"}),ee===ke&&C&&(C.scrollTop=0),ee===we&&C&&(C.scrollTop=C.scrollHeight),ee==null||ee.focus(),document.activeElement!==Ae))return},[E,C]),B=y.useCallback(()=>D([j,w]),[D,j,w]);y.useEffect(()=>{O&&B()},[O,B]);const{onOpenChange:R,triggerPointerDownPosRef:L}=x;y.useEffect(()=>{if(w){let le={x:0,y:0};const ke=we=>{var Ae,ee;le={x:Math.abs(Math.round(we.pageX)-(((Ae=L.current)==null?void 0:Ae.x)??0)),y:Math.abs(Math.round(we.pageY)-(((ee=L.current)==null?void 0:ee.y)??0))}},ue=we=>{le.x<=10&&le.y<=10?we.preventDefault():w.contains(we.target)||R(!1),document.removeEventListener("pointermove",ke),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",ke),document.addEventListener("pointerup",ue,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ke),document.removeEventListener("pointerup",ue,{capture:!0})}}},[w,R,L]),y.useEffect(()=>{const le=()=>R(!1);return window.addEventListener("blur",le),window.addEventListener("resize",le),()=>{window.removeEventListener("blur",le),window.removeEventListener("resize",le)}},[R]);const[Y,q]=f6(le=>{const ke=E().filter(Ae=>!Ae.disabled),ue=ke.find(Ae=>Ae.ref.current===document.activeElement),we=h6(ke,le,ue);we&&setTimeout(()=>we.ref.current.focus())}),J=y.useCallback((le,ke,ue)=>{const we=!U.current&&!ue;(x.value!==void 0&&x.value===ke||we)&&(T(le),we&&(U.current=!0))},[x.value]),me=y.useCallback(()=>w==null?void 0:w.focus(),[w]),F=y.useCallback((le,ke,ue)=>{const we=!U.current&&!ue;(x.value!==void 0&&x.value===ke||we)&&I(le)},[x.value]),oe=r==="popper"?SA:Q3,se=oe===SA?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:v}:{};return a.jsx(q3,{scope:n,content:w,viewport:C,onViewportChange:_,itemRefCallback:J,selectedItem:j,onItemLeave:me,itemTextRefCallback:F,focusSelectedItem:B,selectedItemText:k,position:r,isPositioned:O,searchRef:Y,children:a.jsx(J0,{as:Go,allowPinchZoom:!0,children:a.jsx(Q0,{asChild:!0,trapped:x.open,onMountAutoFocus:le=>{le.preventDefault()},onUnmountAutoFocus:Ne(i,le=>{var ke;(ke=x.trigger)==null||ke.focus({preventScroll:!0}),le.preventDefault()}),children:a.jsx(pg,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:le=>le.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:a.jsx(oe,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:le=>le.preventDefault(),...b,...se,onPlaced:()=>M(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Ne(b.onKeyDown,le=>{const ke=le.ctrlKey||le.altKey||le.metaKey;if(le.key==="Tab"&&le.preventDefault(),!ke&&le.key.length===1&&q(le.key),["ArrowUp","ArrowDown","Home","End"].includes(le.key)){let we=E().filter(Ae=>!Ae.disabled).map(Ae=>Ae.ref.current);if(["ArrowUp","End"].includes(le.key)&&(we=we.slice().reverse()),["ArrowUp","ArrowDown"].includes(le.key)){const Ae=le.target,ee=we.indexOf(Ae);we=we.slice(ee+1)}setTimeout(()=>D(we)),le.preventDefault()}})})})})})})});Y3.displayName=Fae;var Uae="SelectItemAlignedPosition",Q3=y.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,s=dl(wu,n),o=fl(wu,n),[c,l]=y.useState(null),[u,d]=y.useState(null),f=Pt(e,A=>d(A)),h=ew(n),p=y.useRef(!1),g=y.useRef(!0),{viewport:m,selectedItem:v,selectedItemText:b,focusSelectedItem:x}=o,w=y.useCallback(()=>{if(s.trigger&&s.valueNode&&c&&u&&m&&v&&b){const A=s.trigger.getBoundingClientRect(),j=u.getBoundingClientRect(),T=s.valueNode.getBoundingClientRect(),k=b.getBoundingClientRect();if(s.dir!=="rtl"){const Ae=k.left-j.left,ee=T.left-Ae,wt=A.left-ee,et=A.width+wt,Ct=Math.max(et,j.width),Xe=window.innerWidth-Ls,nn=xm(ee,[Ls,Math.max(Ls,Xe-Ct)]);c.style.minWidth=et+"px",c.style.left=nn+"px"}else{const Ae=j.right-k.right,ee=window.innerWidth-T.right-Ae,wt=window.innerWidth-A.right-ee,et=A.width+wt,Ct=Math.max(et,j.width),Xe=window.innerWidth-Ls,nn=xm(ee,[Ls,Math.max(Ls,Xe-Ct)]);c.style.minWidth=et+"px",c.style.right=nn+"px"}const I=h(),E=window.innerHeight-Ls*2,O=m.scrollHeight,M=window.getComputedStyle(u),U=parseInt(M.borderTopWidth,10),D=parseInt(M.paddingTop,10),B=parseInt(M.borderBottomWidth,10),R=parseInt(M.paddingBottom,10),L=U+D+O+R+B,Y=Math.min(v.offsetHeight*5,L),q=window.getComputedStyle(m),J=parseInt(q.paddingTop,10),me=parseInt(q.paddingBottom,10),F=A.top+A.height/2-Ls,oe=E-F,se=v.offsetHeight/2,le=v.offsetTop+se,ke=U+D+le,ue=L-ke;if(ke<=F){const Ae=I.length>0&&v===I[I.length-1].ref.current;c.style.bottom="0px";const ee=u.clientHeight-m.offsetTop-m.offsetHeight,wt=Math.max(oe,se+(Ae?me:0)+ee+B),et=ke+wt;c.style.height=et+"px"}else{const Ae=I.length>0&&v===I[0].ref.current;c.style.top="0px";const wt=Math.max(F,U+m.offsetTop+(Ae?J:0)+se)+ue;c.style.height=wt+"px",m.scrollTop=ke-F+m.offsetTop}c.style.margin=`${Ls}px 0`,c.style.minHeight=Y+"px",c.style.maxHeight=E+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,s.trigger,s.valueNode,c,u,m,v,b,s.dir,r]);qr(()=>w(),[w]);const[S,C]=y.useState();qr(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const _=y.useCallback(A=>{A&&g.current===!0&&(w(),x==null||x(),g.current=!1)},[w,x]);return a.jsx(Hae,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:p,onScrollButtonChange:_,children:a.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:a.jsx(it.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Q3.displayName=Uae;var Bae="SelectPopperPosition",SA=y.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Ls,...s}=t,o=tw(n);return a.jsx(CE,{...o,...s,ref:e,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});SA.displayName=Bae;var[Hae,dT]=Wf(wu,{}),CA="SelectViewport",X3=y.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,s=fl(CA,n),o=dT(CA,n),c=Pt(e,s.onViewportChange),l=y.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(Z0.Slot,{scope:n,children:a.jsx(it.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Ne(i.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&f){const p=Math.abs(l.current-d.scrollTop);if(p>0){const g=window.innerHeight-Ls*2,m=parseFloat(f.style.minHeight),v=parseFloat(f.style.height),b=Math.max(m,v);if(b0?S:0,f.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});X3.displayName=CA;var J3="SelectGroup",[zae,Vae]=Wf(J3),Gae=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Zs();return a.jsx(zae,{scope:n,id:i,children:a.jsx(it.div,{role:"group","aria-labelledby":i,...r,ref:e})})});Gae.displayName=J3;var Z3="SelectLabel",e6=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Vae(Z3,n);return a.jsx(it.div,{id:i.id,...r,ref:e})});e6.displayName=Z3;var Px="SelectItem",[Kae,t6]=Wf(Px),n6=y.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...o}=t,c=dl(Px,n),l=fl(Px,n),u=c.value===r,[d,f]=y.useState(s??""),[h,p]=y.useState(!1),g=Pt(e,x=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,x,r,i)}),m=Zs(),v=y.useRef("touch"),b=()=>{i||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(Kae,{scope:n,value:r,disabled:i,textId:m,isSelected:u,onItemTextChange:y.useCallback(x=>{f(w=>w||((x==null?void 0:x.textContent)??"").trim())},[]),children:a.jsx(Z0.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:a.jsx(it.div,{role:"option","aria-labelledby":m,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:g,onFocus:Ne(o.onFocus,()=>p(!0)),onBlur:Ne(o.onBlur,()=>p(!1)),onClick:Ne(o.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:Ne(o.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:Ne(o.onPointerDown,x=>{v.current=x.pointerType}),onPointerMove:Ne(o.onPointerMove,x=>{var w;v.current=x.pointerType,i?(w=l.onItemLeave)==null||w.call(l):v.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ne(o.onPointerLeave,x=>{var w;x.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:Ne(o.onKeyDown,x=>{var S;((S=l.searchRef)==null?void 0:S.current)!==""&&x.key===" "||(Oae.includes(x.key)&&b(),x.key===" "&&x.preventDefault())})})})})});n6.displayName=Px;var qh="SelectItemText",r6=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...s}=t,o=dl(qh,n),c=fl(qh,n),l=t6(qh,n),u=Dae(qh,n),[d,f]=y.useState(null),h=Pt(e,b=>f(b),l.onItemTextChange,b=>{var x;return(x=c.itemTextRefCallback)==null?void 0:x.call(c,b,l.value,l.disabled)}),p=d==null?void 0:d.textContent,g=y.useMemo(()=>a.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:v}=u;return qr(()=>(m(g),()=>v(g)),[m,v,g]),a.jsxs(a.Fragment,{children:[a.jsx(it.span,{id:l.textId,...s,ref:h}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Rf.createPortal(s.children,o.valueNode):null]})});r6.displayName=qh;var i6="SelectItemIndicator",s6=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return t6(i6,n).isSelected?a.jsx(it.span,{"aria-hidden":!0,...r,ref:e}):null});s6.displayName=i6;var _A="SelectScrollUpButton",o6=y.forwardRef((t,e)=>{const n=fl(_A,t.__scopeSelect),r=dT(_A,t.__scopeSelect),[i,s]=y.useState(!1),o=Pt(e,r.onScrollButtonChange);return qr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollTop>0;s(u)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?a.jsx(c6,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop-l.offsetHeight)}}):null});o6.displayName=_A;var AA="SelectScrollDownButton",a6=y.forwardRef((t,e)=>{const n=fl(AA,t.__scopeSelect),r=dT(AA,t.__scopeSelect),[i,s]=y.useState(!1),o=Pt(e,r.onScrollButtonChange);return qr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?a.jsx(c6,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop+l.offsetHeight)}}):null});a6.displayName=AA;var c6=y.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,s=fl("SelectScrollButton",n),o=y.useRef(null),c=ew(n),l=y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return y.useEffect(()=>()=>l(),[l]),qr(()=>{var d;const u=c().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[c]),a.jsx(it.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:Ne(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Ne(i.onPointerMove,()=>{var u;(u=s.onItemLeave)==null||u.call(s),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Ne(i.onPointerLeave,()=>{l()})})}),Wae="SelectSeparator",l6=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return a.jsx(it.div,{"aria-hidden":!0,...r,ref:e})});l6.displayName=Wae;var jA="SelectArrow",qae=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=tw(n),s=dl(jA,n),o=fl(jA,n);return s.open&&o.position==="popper"?a.jsx(_E,{...i,...r,ref:e}):null});qae.displayName=jA;function u6(t){return t===""||t===void 0}var d6=y.forwardRef((t,e)=>{const{value:n,...r}=t,i=y.useRef(null),s=Pt(e,i),o=Cg(n);return y.useEffect(()=>{const c=i.current,l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==n&&d){const f=new Event("change",{bubbles:!0});d.call(c,n),c.dispatchEvent(f)}},[o,n]),a.jsx(AE,{asChild:!0,children:a.jsx("select",{...r,ref:s,defaultValue:n})})});d6.displayName="BubbleSelect";function f6(t){const e=Ar(t),n=y.useRef(""),r=y.useRef(0),i=y.useCallback(o=>{const c=n.current+o;e(c),function l(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(c)},[e]),s=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function h6(t,e,n){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=Yae(t,Math.max(s,0));i.length===1&&(o=o.filter(u=>u!==n));const l=o.find(u=>u.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Yae(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Qae=U3,p6=H3,Xae=V3,Jae=G3,Zae=K3,m6=W3,ece=X3,g6=e6,v6=n6,tce=r6,nce=s6,y6=o6,x6=a6,b6=l6;const Bn=Qae,Hn=Xae,$n=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(p6,{ref:r,className:Pe("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,a.jsx(Jae,{asChild:!0,children:a.jsx(Da,{className:"h-4 w-4 opacity-50"})})]}));$n.displayName=p6.displayName;const w6=y.forwardRef(({className:t,...e},n)=>a.jsx(y6,{ref:n,className:Pe("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(fu,{className:"h-4 w-4"})}));w6.displayName=y6.displayName;const S6=y.forwardRef(({className:t,...e},n)=>a.jsx(x6,{ref:n,className:Pe("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(Da,{className:"h-4 w-4"})}));S6.displayName=x6.displayName;const Ln=y.forwardRef(({className:t,children:e,position:n="popper",...r},i)=>a.jsx(Zae,{children:a.jsxs(m6,{ref:i,className:Pe("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[a.jsx(w6,{}),a.jsx(ece,{className:Pe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(S6,{})]})}));Ln.displayName=m6.displayName;const rce=y.forwardRef(({className:t,...e},n)=>a.jsx(g6,{ref:n,className:Pe("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));rce.displayName=g6.displayName;const ie=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(v6,{ref:r,className:Pe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(nce,{children:a.jsx(uo,{className:"h-4 w-4"})})}),a.jsx(tce,{children:e})]}));ie.displayName=v6.displayName;const ice=y.forwardRef(({className:t,...e},n)=>a.jsx(b6,{ref:n,className:Pe("-mx-1 my-1 h-px bg-muted",t),...e}));ice.displayName=b6.displayName;const sce=Re.object({audienceBrief:Re.string().min(10,{message:"Audience brief must be at least 10 characters."}),researchObjective:Re.string().optional(),personaCount:Re.string().min(1,{message:"Number of personas is required."}),dataFile:Re.instanceof(FileList).optional(),llm_model:Re.string().optional()});function oce({onSubmit:t,isGenerating:e}){const[n,r]=y.useState(!1),[i,s]=y.useState(!1),[o,c]=y.useState({audience_brief:[],research_objective:[]}),[l,u]=y.useState(!1),[d,f]=y.useState(null),h=V0({resolver:G0(sce),defaultValues:{audienceBrief:"",researchObjective:"",personaCount:"5",llm_model:"gemini-2.5-pro"}}),p=h.watch("audienceBrief"),g=h.watch("researchObjective"),m=async()=>{var w,S,C,_,A,j,T,k,I,E,O;const b=p==null?void 0:p.trim(),x=g==null?void 0:g.trim();if(!b||b.length<10){ne.error("Audience brief too short",{description:"Please enter at least 10 characters in the audience brief"});return}if(!x||x.length<10){ne.error("Research objective too short",{description:"Please enter at least 10 characters in the research objective"});return}u(!0),f(null);try{const M=await da.enhanceAudienceBrief(b,x);c(M.data.suggestions||{audience_brief:[],research_objective:[]}),r(!0),s(!1);const U=(((S=(w=M.data.suggestions)==null?void 0:w.audience_brief)==null?void 0:S.length)||0)+(((_=(C=M.data.suggestions)==null?void 0:C.research_objective)==null?void 0:_.length)||0);ne.success("Enhancement suggestions generated",{description:`Generated ${U} suggestions to improve your research inputs`})}catch(M){console.error("Error enhancing audience brief:",M);let U="Please try again or modify your brief",D="Failed to generate suggestions";if(M&&typeof M=="object"){const B=M;B.code==="ECONNABORTED"||(A=B.message)!=null&&A.includes("timeout")?(D="Request timeout",U="The AI took too long to analyze your brief. Please try again."):((j=B.response)==null?void 0:j.status)===500?(D="Server error",U=((k=(T=B.response)==null?void 0:T.data)==null?void 0:k.message)||"The server encountered an error. Please try again later."):((I=B.response)==null?void 0:I.status)===400?(D="Invalid brief",U=((O=(E=B.response)==null?void 0:E.data)==null?void 0:O.message)||"Please check your audience brief and try again."):B.message&&(U=B.message)}else M instanceof Error&&(U=M.message);f(U),ne.error(D,{description:U,duration:5e3})}finally{u(!1)}},v=()=>{s(!i)};return a.jsx(W0,{...h,children:a.jsxs("form",{onSubmit:h.handleSubmit(t),className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-6",children:[a.jsx(yt,{control:h.control,name:"audienceBrief",render:({field:b})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Audience Brief"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Describe your target audience and research goals...",className:"h-40",...b})}),a.jsx(Mn,{children:"Provide details about the demographics, behaviors, and attitudes you want to explore"}),a.jsx(vt,{})]})}),a.jsx(yt,{control:h.control,name:"researchObjective",render:({field:b})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Research Objective"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"What is the main research topic or objective you want to explore?",className:"h-32",...b})}),a.jsx(Mn,{children:"Specify your research focus to generate more targeted persona goals, frustrations, and scenarios"}),a.jsx(vt,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx(X,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:!p||p.trim().length<10||!g||g.trim().length<10||l||e,className:"flex items-center gap-2 hover-transition",children:l?a.jsxs(a.Fragment,{children:[a.jsx(Xl,{className:"h-4 w-4 animate-spin"}),"Analyzing Research Inputs..."]}):a.jsxs(a.Fragment,{children:[a.jsx(hu,{className:"h-4 w-4"}),"Enhance Brief"]})})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(yt,{control:h.control,name:"dataFile",render:({field:{value:b,onChange:x,...w}})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Customer Data (Optional)"}),a.jsx(gt,{children:a.jsxs("div",{className:"border-2 border-dashed border-slate-200 rounded-lg p-6 flex flex-col items-center justify-center bg-slate-50 hover:bg-slate-100 transition cursor-pointer",children:[a.jsx(H_,{className:"h-10 w-10 text-slate-400 mb-2"}),a.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Upload customer data for more accurate personas"}),a.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Supports PDF, Office docs, images, and more"}),a.jsx(Ht,{...w,type:"file",multiple:!0,accept:".pdf,.docx,.pptx,.xlsx,.html,.xml,.rtf,.pages,.key,.epub,.txt,.csv,.jpg,.jpeg,.png",onChange:S=>{x(S.target.files)},className:"hidden",id:"data-file-input"}),a.jsxs(X,{type:"button",variant:"outline",size:"sm",onClick:()=>{var S;return(S=document.getElementById("data-file-input"))==null?void 0:S.click()},children:[a.jsx(h5,{className:"mr-2 h-4 w-4"}),"Select Files"]}),b&&b.length>0&&a.jsx("p",{className:"text-xs text-primary mt-2",children:b.length===1?b[0].name:`${b.length} files selected`})]})}),a.jsx(Mn,{children:"Upload existing customer data to create more realistic personas"}),a.jsx(vt,{})]})}),a.jsxs("div",{className:"bg-muted/30 p-4 rounded-lg border border-border",children:[a.jsxs("div",{className:"flex items-center mb-2",children:[a.jsx(Yp,{className:"h-5 w-5 text-muted-foreground mr-2"}),a.jsx("h3",{className:"font-sf font-medium",children:"What's included?"})]}),a.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Demographic profiles based on your brief"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Personality traits and behavioral patterns"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Consumer preferences and interests"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Review and refine capabilities"]})]})]})]})]}),n&&a.jsxs("div",{className:"glass-panel rounded-lg p-4 border border-border bg-muted/30",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("h3",{className:"font-sf font-medium text-sm flex items-center gap-2",children:[a.jsx(hu,{className:"h-4 w-4 text-primary"}),"Enhancement Suggestions:"]}),a.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:v,className:"h-6 w-6 p-0 hover:bg-slate-200",title:i?"Expand suggestions":"Collapse suggestions",children:i?a.jsx(Da,{className:"h-4 w-4"}):a.jsx(fu,{className:"h-4 w-4"})})]}),!i&&a.jsx(a.Fragment,{children:d?a.jsx("div",{className:"text-sm text-red-600 bg-red-50 p-3 rounded-md",children:d}):a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx("div",{children:o.audience_brief.length>0?a.jsxs("div",{children:[a.jsxs("h4",{className:"font-sf font-medium text-sm text-slate-800 mb-2 flex items-center gap-2",children:[a.jsx(Fr,{className:"h-4 w-4 text-blue-600"}),"Suggestions for your Audience Brief:"]}),a.jsx("ul",{className:"space-y-2 text-sm text-slate-700",children:o.audience_brief.map((b,x)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-blue-600 mt-1.5 text-xs",children:"•"}),a.jsx("span",{className:"flex-1",children:b})]},x))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No audience brief suggestions available"})}),a.jsx("div",{children:o.research_objective.length>0?a.jsxs("div",{children:[a.jsxs("h4",{className:"font-sf font-medium text-sm text-slate-800 mb-2 flex items-center gap-2",children:[a.jsx(Yp,{className:"h-4 w-4 text-green-600"}),"Suggestions for your Research Objective:"]}),a.jsx("ul",{className:"space-y-2 text-sm text-slate-700",children:o.research_objective.map((b,x)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-green-600 mt-1.5 text-xs",children:"•"}),a.jsx("span",{className:"flex-1",children:b})]},x))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No research objective suggestions available"})}),o.audience_brief.length===0&&o.research_objective.length===0&&a.jsx("div",{className:"col-span-full text-sm text-muted-foreground text-center",children:"No suggestions available"})]})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(yt,{control:h.control,name:"llm_model",render:({field:b})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"AI Model"}),a.jsxs(Bn,{onValueChange:b.onChange,defaultValue:b.value,children:[a.jsx(gt,{children:a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select AI model"})})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(ie,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(ie,{value:"gpt-5",children:"GPT-5"})]})]}),a.jsx(Mn,{children:"Choose which AI model to use for generating personas"}),a.jsx(vt,{})]})}),a.jsx(yt,{control:h.control,name:"personaCount",render:({field:b})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Number of Personas to Generate"}),a.jsx(gt,{children:a.jsx(Ht,{type:"number",min:"1",max:"20",...b})}),a.jsx(Mn,{children:"How many synthetic users do you need for your research?"}),a.jsx(vt,{})]})})]}),a.jsxs("div",{className:"flex flex-col items-end",children:[a.jsx(X,{type:"submit",disabled:e,className:"min-w-36",children:e?a.jsxs(a.Fragment,{children:[a.jsx(Xl,{className:"mr-2 h-4 w-4 animate-spin"}),"AI Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Fr,{className:"mr-2 h-4 w-4"}),"Generate Personas"]})}),e&&a.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Generating multiple personas in parallel. This may take 1-2 minutes..."})]})]})})}const lt=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Pe("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));lt.displayName="Card";const Ei=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Pe("flex flex-col space-y-1.5 p-6",t),...e}));Ei.displayName="CardHeader";const Yi=y.forwardRef(({className:t,...e},n)=>a.jsx("h3",{ref:n,className:Pe("text-2xl font-semibold leading-none tracking-tight",t),...e}));Yi.displayName="CardTitle";const fT=y.forwardRef(({className:t,...e},n)=>a.jsx("p",{ref:n,className:Pe("text-sm text-muted-foreground",t),...e}));fT.displayName="CardDescription";const Ot=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Pe("p-6 pt-0",t),...e}));Ot.displayName="CardContent";const hT=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Pe("flex items-center p-6 pt-0",t),...e}));hT.displayName="CardFooter";const ace=t=>{const e=t==null?void 0:t.toLowerCase(),n="/semblance/";switch(e){case"male":return`${n}male_avatar.png`;case"female":return`${n}female_avatar.png`;case"non-binary":case"nonbinary":case"non binary":return`${n}nonbinary_avatar.png`;default:return`${n}male_avatar.png`}},Ag=t=>t.avatar||ace(t.gender);function pT({user:t,selected:e=!1,onClick:n,showDetailedDialog:r=!1,onSelectionToggle:i,showAddToFolderButton:s=!1,onAddToFolder:o,onViewDetails:c,folders:l=[]}){const u=lr();y.useState(!1);const[d,f]=y.useState(t),h=t._id||t.id,p=v=>{v.stopPropagation(),u(`/synthetic-users/${h}`)};d.oceanTraits&&(d.oceanTraits.openness,d.oceanTraits.conscientiousness,d.oceanTraits.extraversion,d.oceanTraits.agreeableness,d.oceanTraits.neuroticism);const g=v=>{var w,S;const b=v.target;b.closest("button")&&((S=(w=b.closest("button"))==null?void 0:w.textContent)!=null&&S.includes("View Details"))||(i?i(v):n&&n(v))},m=v=>{v.stopPropagation(),c?c(d):p(v)};return a.jsxs("div",{className:Pe("persona-card glass-card rounded-xl p-4 cursor-pointer hover:shadow-md button-transition",e&&"selected ring-2 ring-primary"),onClick:g,children:[a.jsx("div",{className:"persona-card-overlay"}),a.jsx("div",{className:"persona-card-checkmark",children:a.jsx(uo,{className:"h-4 w-4 text-primary"})}),a.jsx("div",{className:"relative z-10",children:a.jsxs("div",{className:"flex items-start space-x-4",children:[a.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center",children:a.jsx("img",{src:Ag(d),alt:`${d.name} avatar`,className:"h-12 w-12 rounded-full object-cover"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsx("h3",{className:"text-sm font-medium truncate flex-1",children:d.name})}),a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[d.age," • ",d.gender]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:d.occupation}),a.jsx("p",{className:"text-xs text-muted-foreground",children:d.location}),a.jsx("div",{className:"mt-2",children:d.aiSynthesizedBio?a.jsxs("p",{className:"text-xs text-slate-700 line-clamp-3 leading-relaxed",children:[d.aiSynthesizedBio,d.aiSynthesizedBio.length>150&&"..."]}):a.jsxs("p",{className:"text-xs text-muted-foreground italic line-clamp-3",children:['"',d.personality,'"']})}),d.qualitativeAttributes&&d.qualitativeAttributes.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx("div",{className:"flex flex-wrap gap-1",children:d.qualitativeAttributes.slice(0,3).map((v,b)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-blue-50 text-blue-700 text-xs rounded-full",children:[a.jsx(pZ,{className:"h-3 w-3"}),v]},b))})}),d.folder_ids&&d.folder_ids.length>0&&a.jsx("div",{className:"mt-2",children:a.jsxs("div",{className:"flex flex-wrap gap-1",children:[d.folder_ids.slice(0,2).map(v=>{const b=l.find(x=>x._id===v);return b?a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded-full",title:`In folder: ${b.name}`,children:[a.jsx(hs,{className:"h-3 w-3"}),b.name]},v):null}),d.folder_ids.length>2&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded-full",children:[a.jsx(Vr,{className:"h-3 w-3"}),d.folder_ids.length-2," more"]})]})}),d.topPersonalityTraits&&d.topPersonalityTraits.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx("div",{className:"flex flex-wrap gap-1",children:d.topPersonalityTraits.slice(0,3).map((v,b)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-purple-50 text-purple-700 text-xs rounded-full",children:[a.jsx(du,{className:"h-3 w-3"}),v]},b))})}),a.jsx("div",{className:"mt-3 flex justify-end",children:a.jsx(X,{variant:"ghost",size:"sm",onClick:m,children:"View Details"})})]})]})})]})}var mT="Collapsible",[cce,dFe]=Ui(mT),[lce,gT]=cce(mT),C6=y.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:s,onOpenChange:o,...c}=t,[l=!1,u]=lo({prop:r,defaultProp:i,onChange:o});return a.jsx(lce,{scope:n,disabled:s,contentId:Zs(),open:l,onOpenToggle:y.useCallback(()=>u(d=>!d),[u]),children:a.jsx(it.div,{"data-state":yT(l),"data-disabled":s?"":void 0,...c,ref:e})})});C6.displayName=mT;var _6="CollapsibleTrigger",A6=y.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=gT(_6,n);return a.jsx(it.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":yT(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:e,onClick:Ne(t.onClick,i.onOpenToggle)})});A6.displayName=_6;var vT="CollapsibleContent",j6=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=gT(vT,t.__scopeCollapsible);return a.jsx(Yr,{present:n||i.open,children:({present:s})=>a.jsx(uce,{...r,ref:e,present:s})})});j6.displayName=vT;var uce=y.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...s}=t,o=gT(vT,n),[c,l]=y.useState(r),u=y.useRef(null),d=Pt(e,u),f=y.useRef(0),h=f.current,p=y.useRef(0),g=p.current,m=o.open||c,v=y.useRef(m),b=y.useRef();return y.useEffect(()=>{const x=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(x)},[]),qr(()=>{const x=u.current;if(x){b.current=b.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const w=x.getBoundingClientRect();f.current=w.height,p.current=w.width,v.current||(x.style.transitionDuration=b.current.transitionDuration,x.style.animationName=b.current.animationName),l(r)}},[o.open,r]),a.jsx(it.div,{"data-state":yT(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m,...s,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:m&&i})});function yT(t){return t?"open":"closed"}var dce=C6;const jg=dce,Eg=A6,Ng=j6;function fce({generatedPersonas:t,selectedPersonas:e,isGenerating:n,onPersonaSelection:r,onRefinePersonas:i,onApprovePersonas:s,onBackToGenerator:o}){const c=lr(),[l,u]=y.useState(""),[d,f]=y.useState(!1),h=p=>{c(`/synthetic-users/${p}?fromReview=true`)};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Review Generated Personas"}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.length," of ",t.length," selected"]})]}),a.jsx("div",{className:"space-y-4",children:t.map(p=>a.jsx(lt,{className:`border ${e.includes(p.id)?"border-primary/50 bg-primary/5":""} cursor-pointer`,onClick:()=>h(p.id),children:a.jsx(Ot,{className:"p-4",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsx("div",{className:"flex-1",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{type:"checkbox",id:`persona-${p.id}`,checked:e.includes(p.id),onChange:g=>{g.stopPropagation(),r(p.id)},className:"mr-3 h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium",children:p.name}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[p.age," • ",p.gender," • ",p.occupation]})]})]})}),a.jsx(pT,{user:p,showDetailedDialog:!1,onClick:g=>{g.stopPropagation(),h(p.id)}})]})})},p.id))}),a.jsx("div",{className:"space-y-4 pt-4 border-t",children:a.jsxs("div",{children:[a.jsx("div",{className:"flex justify-between items-start mb-4",children:a.jsxs(X,{variant:"outline",onClick:o,children:[a.jsx(Wp,{className:"mr-2 h-4 w-4"}),"Back to Generator"]})}),a.jsxs(jg,{open:d,onOpenChange:f,className:"w-full space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx(Eg,{asChild:!0,children:a.jsxs(X,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(Xl,{className:"h-4 w-4"}),"Refine Personas",a.jsx(Da,{className:"h-4 w-4 ml-1 transition-transform duration-200",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]})}),a.jsxs(X,{onClick:s,disabled:e.length===0,children:[a.jsx(zh,{className:"mr-2 h-4 w-4"}),"Approve Selected (",e.length,")"]})]}),a.jsx(Ng,{children:a.jsx(lt,{className:"border shadow-sm w-full mt-4",children:a.jsx(Ot,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"refinement-prompt",className:"text-sm font-medium block mb-2",children:"Refinement Instructions"}),a.jsx(ht,{id:"refinement-prompt",placeholder:"Example: Make all personas 5 years younger, or ensure everyone is from different locations...",value:l,onChange:p=>u(p.target.value),className:"min-h-[100px] w-full resize-y"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Use natural language to describe how you'd like to refine the selected personas."})]}),a.jsxs(X,{onClick:()=>i(l),disabled:n||l.trim()==="",className:"w-full",children:[n?a.jsx(Xl,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Xl,{className:"mr-2 h-4 w-4"}),"Apply Refinements"]})]})})})})]})]})})]})}async function hce(t,e,n,r,i,s){console.log(`generateSyntheticPersonas called with targetFolderId: ${i||"none"}`),console.log(`šŸ”„ generateSyntheticPersonas using model: ${s||"gemini-2.5-pro"}`);try{if(console.log(`Generating ${n} synthetic personas using two-stage approach...`),t.trim().length<10)throw new Error("Audience brief is too short. Please provide more context for better persona generation.");let o;if(r&&r.length>0){console.log(`Uploading ${r.length} customer data files...`);try{o=(await da.uploadCustomerData(r)).data.session_id,console.log(`Customer data uploaded with session ID: ${o}`)}catch(l){throw console.error("Failed to upload customer data:",l),new Error("Failed to upload customer data files. Please try again.")}}const c=await da.batchGenerateWithStages(t,e,n,.8,o,s);if(c.data){const l=c.data.partial_success===!0,u=c.data.personas&&c.data.personas.length>0,d=c.data.errors&&c.data.errors.length>0;if(u){if(console.log(`Generated ${c.data.personas.length} personas with two-stage process${d?` (${c.data.errors.length} failed)`:""}`),i){const f=c.data.personas,h=f.map(p=>p._id||p.id).filter(Boolean);console.log(`Adding ${h.length} newly generated personas to folder: ${i}`);try{await Po.addPersonasBatch(i,h),console.log(`Added ${h.length} newly generated personas to folder: ${i}`)}catch(p){console.error("Error adding personas to folder:",p)}if(o)try{await da.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(p){console.warn("Failed to cleanup customer data:",p)}return l||d?{...c.data,length:f.length}:{...c.data,personas:f}}if(o)try{await da.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}if(l||d)return{...c.data.personas,length:c.data.personas.length,partial_success:l,errors:c.data.errors};if(o)try{await da.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}return c.data.personas}else if(d){if(o)try{await da.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}throw new Error(`Failed to generate personas: ${c.data.errors.length} generation attempts failed.`)}else throw new Error("No personas returned from API")}else throw new Error("Invalid response format from API")}catch(o){if(customerDataSessionId)try{await da.cleanupCustomerData(customerDataSessionId),console.log(`Cleaned up customer data for session: ${customerDataSessionId}`)}catch(c){console.warn("Failed to cleanup customer data:",c)}throw console.error("Error generating AI personas:",o),o}}function E6(){const[t,e]=y.useState([]),n=async s=>{const o=[];for(const c of s){const l={...c};l._id&&typeof l._id=="string"&&l._id.startsWith("local-")&&delete l._id;const u=await $r.create(l);console.log("Persona saved to database:",u.data),o.push({...c,id:u.data._id||u.data.id,_id:u.data._id||u.data.id,isDbPersona:!0})}e(o)},r=async()=>{const s=await $r.getAll();return s&&s.data&&Array.isArray(s.data)?(console.log("Personas loaded from database:",s.data.length),s.data.map(o=>({...o,id:o._id||o.id,isDbPersona:!0}))):[]};return y.useEffect(()=>{(async()=>{const o=await r();e(o)})()},[]),{storedPersonas:t,savePersonas:n,loadPersonas:r,clearPersonas:async()=>{const s=await r();for(const o of s)o._id&&await $r.delete(o._id);e([])}}}function pce({targetFolderId:t,targetFolderName:e}){const n=Bi(),r=lr(),{loadPersonas:i,savePersonas:s}=E6(),[o,c]=y.useState(!1),[l,u]=y.useState([]),[d,f]=y.useState([]),[h,p]=y.useState(!1),[g,m]=y.useState(0);y.useEffect(()=>{const C=new URLSearchParams(n.search),_=C.get("mode"),A=C.get("tab"),j=C.get("step");if(_==="create"&&A==="ai"&&j==="review"){const T=i();T.length>0&&(u(T),f(T.map(k=>k.id)),p(!0))}},[n,i]);async function v(C){var _,A,j,T,k,I,E,O,M,U;try{c(!0),m(0);const D=parseInt(C.personaCount);if(isNaN(D)||D<1||D>10){ne.error("Invalid number of personas",{description:"Please enter a number between 1 and 10"}),c(!1);return}m(5);const B=setInterval(()=>{m(q=>q<90?q+Math.random()*5:q)},500),R=D<=2?"30-60 seconds":D<=4?"1-2 minutes":D<=6?"2-3 minutes":"3-5 minutes";D>4&&ne.info("Generation may take longer",{description:`Generating ${D} personas at once may result in some timeouts. If this happens, the successfully created personas will still be saved.`,duration:8e3}),ne.info("Generating AI personas in parallel",{description:`Creating ${D} synthetic personas based on your brief. This may take ${R}. Please be patient.`,duration:1e4}),t&&e?(console.log(`Target folder for new personas: ID=${t}, Name=${e}`),ne.info(`Creating personas in "${e}" folder`,{duration:3e3})):console.log("No target folder specified for new personas"),console.log(`šŸ¤– Starting persona generation with model: ${C.llm_model||"gemini-2.5-pro"}`);const L=await hce(C.audienceBrief,C.researchObjective,D,C.dataFile,t,C.llm_model),Y=L.personas||L;if(clearInterval(B),m(100),Y&&Y.length>0)console.log(`āœ… Successfully generated ${Y.length} personas using model: ${C.llm_model||"gemini-2.5-pro"}`),L.partial_success||L.errors&&L.errors.length>0?(ne.success("Some personas generated successfully",{description:`${Y.length} synthetic personas were created using ${C.llm_model||"Gemini 2.5 Pro"}. ${((_=L.errors)==null?void 0:_.length)||0} failed due to timeout or other errors.`,duration:8e3}),L.errors&&L.errors.length>0&&setTimeout(()=>{ne.error("Some personas failed to generate",{description:`${L.errors.length} personas timed out. The server took too long to generate them. The successfully generated personas have been saved${t?" in the selected folder":""}.`,duration:1e4})},1e3)):ne.success("Personas generated and saved successfully",{description:`${Y.length} synthetic personas have been created using ${C.llm_model||"Gemini 2.5 Pro"} and saved ${t?`to the "${e}" folder`:"to the database"}.`}),r("/synthetic-users?mode=view");else throw new Error("No personas were generated")}catch(D){console.error(`āŒ Error generating personas using model: ${C.llm_model||"gemini-2.5-pro"}:`,D);let B="Please try again or adjust your parameters",R="Failed to generate personas";D.code==="ECONNABORTED"||(A=D.message)!=null&&A.includes("timeout")||((j=D.response)==null?void 0:j.status)===504?(R="Generation timeout",B="AI persona generation timed out. This often happens when generating multiple complex personas. Try generating fewer personas (2-3) or try again later."):((T=D.response)==null?void 0:T.status)===500?(R="Server error",(I=(k=D.response)==null?void 0:k.data)!=null&&I.message?B=D.response.data.message:(O=(E=D.response)==null?void 0:E.data)!=null&&O.error?B=D.response.data.error:B="The server encountered an error processing your request. Please try again later."):((M=D.response)==null?void 0:M.status)===401?(R="Authentication required",B="Please log in to generate personas."):(U=D.message)!=null&&U.includes("504 Deadline Exceeded")?(R="Generation timeout",B="The AI model took too long to generate personas. Try generating fewer personas or simplify your brief."):D instanceof Error&&(B=D.message),ne.error(R,{description:B,duration:6e3})}finally{setTimeout(()=>{c(!1),m(0)},500)}}const b=C=>{f(_=>_.includes(C)?_.filter(A=>A!==C):[..._,C])},x=(C,_)=>{const A=_.toLowerCase();return C.map(j=>{const T={...j};if(A.includes("younger")){const k=parseInt(T.age);T.age=(k-5).toString()}else if(A.includes("older")){const k=parseInt(T.age);T.age=(k+5).toString()}if(A.includes("different locations")&&(T.location=`${T.location} (Diversified)`),A.includes("more extroverted")?T.personality=`Extroverted, ${T.personality.toLowerCase()}`:A.includes("more introverted")&&(T.personality=`Introverted, ${T.personality.toLowerCase()}`),A.includes("diverse")){const k=["tech-savvy","traditional","innovative","conservative","creative"],I=k[Math.floor(Math.random()*k.length)];T.personality=`${I}, ${T.personality}`}return T})},w=C=>{if(!C.trim()){ne.error("Please provide refinement instructions");return}c(!0),setTimeout(()=>{try{const _=l.filter(T=>d.includes(T.id)),A=x(_,C),j=l.map(T=>A.find(I=>I.id===T.id)||T);u(j),c(!1),s(j),ne.success("Personas refined based on your instructions",{description:"Review the updated profiles"})}catch(_){console.error("Error refining personas:",_),ne.error("Failed to refine personas",{description:"Please try different instructions"}),c(!1)}},1500)},S=()=>{const C=l.filter(_=>d.includes(_.id));ne.success(`${C.length} personas approved`,{description:"Added to your synthetic persona library"}),s(C),r("/synthetic-users?mode=view")};return a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[a.jsx(Fr,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Persona Recruiter"})]}),o&&a.jsxs("div",{className:"mb-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-2",children:[a.jsx("span",{className:"text-sm font-medium",children:"Generating personas in parallel..."}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[Math.round(g),"%"]})]}),a.jsx($l,{value:g,className:"h-2"})]}),h?a.jsx(fce,{generatedPersonas:l,selectedPersonas:d,isGenerating:o,onPersonaSelection:b,onRefinePersonas:w,onApprovePersonas:S,onBackToGenerator:()=>p(!1)}):a.jsx(oce,{onSubmit:v,isGenerating:o})]})}const il=new Map;function N6(t){const{id:e,title:n,description:r,type:i="default",duration:s}=t;let o;switch(i){case"success":o=ne.success(n,{description:r,duration:s});break;case"error":o=ne.error(n,{description:r,duration:s});break;case"warning":o=ne.warning(n,{description:r,duration:s});break;case"info":o=ne.info(n,{description:r,duration:s});break;default:o=ne(n,{description:r,duration:s});break}return il.set(e,o.toString()),e}function mce(t,e){const n=il.get(t);if(!n)return console.warn(`Toast with ID "${t}" not found. Creating new toast instead.`),N6({id:t,...e,title:e.title||"Updated"}),!1;const{title:r,description:i,type:s="default",duration:o}=e;ne.dismiss(n);let c;switch(s){case"success":c=ne.success(r,{description:i,duration:o});break;case"error":c=ne.error(r,{description:i,duration:o});break;case"warning":c=ne.warning(r,{description:i,duration:o});break;case"info":c=ne.info(r,{description:i,duration:o});break;default:c=ne(r,{description:i,duration:o});break}return il.set(t,c.toString()),!0}function gce(t){const e=il.get(t);return e?(ne.dismiss(e),il.delete(t),!0):(console.warn(`Toast with ID "${t}" not found.`),!1)}function vce(t){return il.has(t)}function yce(){il.forEach(t=>{ne.dismiss(t)}),il.clear()}const Fe={success:ne.success,error:ne.error,warning:ne.warning,info:ne.info,loading:ne.loading,dismiss:ne.dismiss,createPersistent:N6,updatePersistent:mce,dismissPersistent:gce,hasPersistent:vce,dismissAllPersistent:yce};var T6=["PageUp","PageDown"],P6=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],k6={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},qf="Slider",[EA,xce,bce]=Y0(qf),[O6,fFe]=Ui(qf,[bce]),[wce,nw]=O6(qf),I6=y.forwardRef((t,e)=>{const{name:n,min:r=0,max:i=100,step:s=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:l=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:p=!1,form:g,...m}=t,v=y.useRef(new Set),b=y.useRef(0),w=o==="horizontal"?Sce:Cce,[S=[],C]=lo({prop:d,defaultProp:u,onChange:I=>{var O;(O=[...v.current][b.current])==null||O.focus(),f(I)}}),_=y.useRef(S);function A(I){const E=Nce(S,I);k(I,E)}function j(I){k(I,b.current)}function T(){const I=_.current[b.current];S[b.current]!==I&&h(S)}function k(I,E,{commit:O}={commit:!1}){const M=Oce(s),U=Ice(Math.round((I-r)/s)*s+r,M),D=xm(U,[r,i]);C((B=[])=>{const R=jce(B,D,E);if(kce(R,l*s)){b.current=R.indexOf(D);const L=String(R)!==String(B);return L&&O&&h(R),L?R:B}else return B})}return a.jsx(wce,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:i,valueIndexToChangeRef:b,thumbs:v.current,values:S,orientation:o,form:g,children:a.jsx(EA.Provider,{scope:t.__scopeSlider,children:a.jsx(EA.Slot,{scope:t.__scopeSlider,children:a.jsx(w,{"aria-disabled":c,"data-disabled":c?"":void 0,...m,ref:e,onPointerDown:Ne(m.onPointerDown,()=>{c||(_.current=S)}),min:r,max:i,inverted:p,onSlideStart:c?void 0:A,onSlideMove:c?void 0:j,onSlideEnd:c?void 0:T,onHomeKeyDown:()=>!c&&k(r,0,{commit:!0}),onEndKeyDown:()=>!c&&k(i,S.length-1,{commit:!0}),onStepKeyDown:({event:I,direction:E})=>{if(!c){const U=T6.includes(I.key)||I.shiftKey&&P6.includes(I.key)?10:1,D=b.current,B=S[D],R=s*U*E;k(B+R,D,{commit:!0})}}})})})})});I6.displayName=qf;var[R6,M6]=O6(qf,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Sce=y.forwardRef((t,e)=>{const{min:n,max:r,dir:i,inverted:s,onSlideStart:o,onSlideMove:c,onSlideEnd:l,onStepKeyDown:u,...d}=t,[f,h]=y.useState(null),p=Pt(e,w=>h(w)),g=y.useRef(),m=Ou(i),v=m==="ltr",b=v&&!s||!v&&s;function x(w){const S=g.current||f.getBoundingClientRect(),C=[0,S.width],A=xT(C,b?[n,r]:[r,n]);return g.current=S,A(w-S.left)}return a.jsx(R6,{scope:t.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:a.jsx(D6,{dir:m,"data-orientation":"horizontal",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const S=x(w.clientX);o==null||o(S)},onSlideMove:w=>{const S=x(w.clientX);c==null||c(S)},onSlideEnd:()=>{g.current=void 0,l==null||l()},onStepKeyDown:w=>{const C=k6[b?"from-left":"from-right"].includes(w.key);u==null||u({event:w,direction:C?-1:1})}})})}),Cce=y.forwardRef((t,e)=>{const{min:n,max:r,inverted:i,onSlideStart:s,onSlideMove:o,onSlideEnd:c,onStepKeyDown:l,...u}=t,d=y.useRef(null),f=Pt(e,d),h=y.useRef(),p=!i;function g(m){const v=h.current||d.current.getBoundingClientRect(),b=[0,v.height],w=xT(b,p?[r,n]:[n,r]);return h.current=v,w(m-v.top)}return a.jsx(R6,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:a.jsx(D6,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{const v=g(m.clientY);s==null||s(v)},onSlideMove:m=>{const v=g(m.clientY);o==null||o(v)},onSlideEnd:()=>{h.current=void 0,c==null||c()},onStepKeyDown:m=>{const b=k6[p?"from-bottom":"from-top"].includes(m.key);l==null||l({event:m,direction:b?-1:1})}})})}),D6=y.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:s,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:l,...u}=t,d=nw(qf,n);return a.jsx(it.span,{...u,ref:e,onKeyDown:Ne(t.onKeyDown,f=>{f.key==="Home"?(o(f),f.preventDefault()):f.key==="End"?(c(f),f.preventDefault()):T6.concat(P6).includes(f.key)&&(l(f),f.preventDefault())}),onPointerDown:Ne(t.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:Ne(t.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&i(f)}),onPointerUp:Ne(t.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),s(f))})})}),$6="SliderTrack",L6=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=nw($6,n);return a.jsx(it.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:e})});L6.displayName=$6;var NA="SliderRange",F6=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=nw(NA,n),s=M6(NA,n),o=y.useRef(null),c=Pt(e,o),l=i.values.length,u=i.values.map(h=>B6(h,i.min,i.max)),d=l>1?Math.min(...u):0,f=100-Math.max(...u);return a.jsx(it.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:c,style:{...t.style,[s.startEdge]:d+"%",[s.endEdge]:f+"%"}})});F6.displayName=NA;var TA="SliderThumb",U6=y.forwardRef((t,e)=>{const n=xce(t.__scopeSlider),[r,i]=y.useState(null),s=Pt(e,c=>i(c)),o=y.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return a.jsx(_ce,{...t,ref:s,index:o})}),_ce=y.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:i,...s}=t,o=nw(TA,n),c=M6(TA,n),[l,u]=y.useState(null),d=Pt(e,x=>u(x)),f=l?o.form||!!l.closest("form"):!0,h=gg(l),p=o.values[r],g=p===void 0?0:B6(p,o.min,o.max),m=Ece(r,o.values.length),v=h==null?void 0:h[c.size],b=v?Tce(v,g,c.direction):0;return y.useEffect(()=>{if(l)return o.thumbs.add(l),()=>{o.thumbs.delete(l)}},[l,o.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${g}% + ${b}px)`},children:[a.jsx(EA.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(it.span,{role:"slider","aria-label":t["aria-label"]||m,"aria-valuemin":o.min,"aria-valuenow":p,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...s,ref:d,style:p===void 0?{display:"none"}:t.style,onFocus:Ne(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),f&&a.jsx(Ace,{name:i??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:p},r)]})});U6.displayName=TA;var Ace=t=>{const{value:e,...n}=t,r=y.useRef(null),i=Cg(e);return y.useEffect(()=>{const s=r.current,o=window.HTMLInputElement.prototype,l=Object.getOwnPropertyDescriptor(o,"value").set;if(i!==e&&l){const u=new Event("input",{bubbles:!0});l.call(s,e),s.dispatchEvent(u)}},[i,e]),a.jsx("input",{style:{display:"none"},...n,ref:r,defaultValue:e})};function jce(t=[],e,n){const r=[...t];return r[n]=e,r.sort((i,s)=>i-s)}function B6(t,e,n){const s=100/(n-e)*(t-e);return xm(s,[0,100])}function Ece(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Nce(t,e){if(t.length===1)return 0;const n=t.map(i=>Math.abs(i-e)),r=Math.min(...n);return n.indexOf(r)}function Tce(t,e,n){const r=t/2,s=xT([0,50],[0,r]);return(r-s(e)*n)*n}function Pce(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function kce(t,e){if(e>0){const n=Pce(t);return Math.min(...n)>=e}return!0}function xT(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function Oce(t){return(String(t).split(".")[1]||"").length}function Ice(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var H6=I6,Rce=L6,Mce=F6,Dce=U6;const Sr=y.forwardRef(({className:t,...e},n)=>a.jsxs(H6,{ref:n,className:Pe("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(Rce,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(Mce,{className:"absolute h-full bg-primary"})}),a.jsx(Dce,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));Sr.displayName=H6.displayName;var bT="Switch",[$ce,hFe]=Ui(bT),[Lce,Fce]=$ce(bT),z6=y.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:s,required:o,disabled:c,value:l="on",onCheckedChange:u,form:d,...f}=t,[h,p]=y.useState(null),g=Pt(e,w=>p(w)),m=y.useRef(!1),v=h?d||!!h.closest("form"):!0,[b=!1,x]=lo({prop:i,defaultProp:s,onChange:u});return a.jsxs(Lce,{scope:n,checked:b,disabled:c,children:[a.jsx(it.button,{type:"button",role:"switch","aria-checked":b,"aria-required":o,"data-state":K6(b),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:g,onClick:Ne(t.onClick,w=>{x(S=>!S),v&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})}),v&&a.jsx(Uce,{control:h,bubbles:!m.current,name:r,value:l,checked:b,required:o,disabled:c,form:d,style:{transform:"translateX(-100%)"}})]})});z6.displayName=bT;var V6="SwitchThumb",G6=y.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=Fce(V6,n);return a.jsx(it.span,{"data-state":K6(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});G6.displayName=V6;var Uce=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,s=y.useRef(null),o=Cg(n),c=gg(e);return y.useEffect(()=>{const l=s.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==n&&f){const h=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(h)}},[o,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...t.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function K6(t){return t?"checked":"unchecked"}var W6=z6,Bce=G6;const bm=y.forwardRef(({className:t,...e},n)=>a.jsx(W6,{className:Pe("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:a.jsx(Bce,{className:Pe("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));bm.displayName=W6.displayName;function Hce(t,e=[]){let n=[];function r(s,o){const c=y.createContext(o),l=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,v=y.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:v,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=y.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,d]}const i=()=>{const s=n.map(o=>y.createContext(o));return function(c){const l=(c==null?void 0:c[t])||s;return y.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,zce(i,...e)]}function zce(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(s)[`__scope${u}`];return{...c,...f}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var tC="rovingFocusGroup.onEntryFocus",Vce={bubbles:!1,cancelable:!0},rw="RovingFocusGroup",[PA,q6,Gce]=Y0(rw),[Kce,Yf]=Hce(rw,[Gce]),[Wce,qce]=Kce(rw),Y6=y.forwardRef((t,e)=>a.jsx(PA.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(PA.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(Yce,{...t,ref:e})})}));Y6.displayName=rw;var Yce=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=t,h=y.useRef(null),p=Pt(e,h),g=Ou(s),[m=null,v]=lo({prop:o,defaultProp:c,onChange:l}),[b,x]=y.useState(!1),w=Ar(u),S=q6(n),C=y.useRef(!1),[_,A]=y.useState(0);return y.useEffect(()=>{const j=h.current;if(j)return j.addEventListener(tC,w),()=>j.removeEventListener(tC,w)},[w]),a.jsx(Wce,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:m,onItemFocus:y.useCallback(j=>v(j),[v]),onItemShiftTab:y.useCallback(()=>x(!0),[]),onFocusableItemAdd:y.useCallback(()=>A(j=>j+1),[]),onFocusableItemRemove:y.useCallback(()=>A(j=>j-1),[]),children:a.jsx(it.div,{tabIndex:b||_===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...t.style},onMouseDown:Ne(t.onMouseDown,()=>{C.current=!0}),onFocus:Ne(t.onFocus,j=>{const T=!C.current;if(j.target===j.currentTarget&&T&&!b){const k=new CustomEvent(tC,Vce);if(j.currentTarget.dispatchEvent(k),!k.defaultPrevented){const I=S().filter(D=>D.focusable),E=I.find(D=>D.active),O=I.find(D=>D.id===m),U=[E,O,...I].filter(Boolean).map(D=>D.ref.current);J6(U,d)}}C.current=!1}),onBlur:Ne(t.onBlur,()=>x(!1))})})}),Q6="RovingFocusGroupItem",X6=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,...o}=t,c=Zs(),l=s||c,u=qce(Q6,n),d=u.currentTabStopId===l,f=q6(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=u;return y.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),a.jsx(PA.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:a.jsx(it.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...o,ref:e,onMouseDown:Ne(t.onMouseDown,g=>{r?u.onItemFocus(l):g.preventDefault()}),onFocus:Ne(t.onFocus,()=>u.onItemFocus(l)),onKeyDown:Ne(t.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const m=Jce(g,u.orientation,u.dir);if(m!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let b=f().filter(x=>x.focusable).map(x=>x.ref.current);if(m==="last")b.reverse();else if(m==="prev"||m==="next"){m==="prev"&&b.reverse();const x=b.indexOf(g.currentTarget);b=u.loop?Zce(b,x+1):b.slice(x+1)}setTimeout(()=>J6(b))}})})})});X6.displayName=Q6;var Qce={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Xce(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Jce(t,e,n){const r=Xce(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Qce[r]}function J6(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Zce(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var wT=Y6,ST=X6,CT="Tabs",[ele,pFe]=Ui(CT,[Yf]),Z6=Yf(),[tle,_T]=ele(CT),eH=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:s,orientation:o="horizontal",dir:c,activationMode:l="automatic",...u}=t,d=Ou(c),[f,h]=lo({prop:r,onChange:i,defaultProp:s});return a.jsx(tle,{scope:n,baseId:Zs(),value:f,onValueChange:h,orientation:o,dir:d,activationMode:l,children:a.jsx(it.div,{dir:d,"data-orientation":o,...u,ref:e})})});eH.displayName=CT;var tH="TabsList",nH=y.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...i}=t,s=_T(tH,n),o=Z6(n);return a.jsx(wT,{asChild:!0,...o,orientation:s.orientation,dir:s.dir,loop:r,children:a.jsx(it.div,{role:"tablist","aria-orientation":s.orientation,...i,ref:e})})});nH.displayName=tH;var rH="TabsTrigger",iH=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...s}=t,o=_T(rH,n),c=Z6(n),l=aH(o.baseId,r),u=cH(o.baseId,r),d=r===o.value;return a.jsx(ST,{asChild:!0,...c,focusable:!i,active:d,children:a.jsx(it.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...s,ref:e,onMouseDown:Ne(t.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?o.onValueChange(r):f.preventDefault()}),onKeyDown:Ne(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(r)}),onFocus:Ne(t.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!i&&f&&o.onValueChange(r)})})})});iH.displayName=rH;var sH="TabsContent",oH=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:i,children:s,...o}=t,c=_T(sH,n),l=aH(c.baseId,r),u=cH(c.baseId,r),d=r===c.value,f=y.useRef(d);return y.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),a.jsx(Yr,{present:i||d,children:({present:h})=>a.jsx(it.div,{"data-state":d?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:u,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:f.current?"0s":void 0},children:h&&s})})});oH.displayName=sH;function aH(t,e){return`${t}-trigger-${e}`}function cH(t,e){return`${t}-content-${e}`}var nle=eH,lH=nH,uH=iH,dH=oH;const hl=nle,Ka=y.forwardRef(({className:t,...e},n)=>a.jsx(lH,{ref:n,className:Pe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));Ka.displayName=lH.displayName;const gn=y.forwardRef(({className:t,...e},n)=>a.jsx(uH,{ref:n,className:Pe("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...e}));gn.displayName=uH.displayName;const vn=y.forwardRef(({className:t,...e},n)=>a.jsx(dH,{ref:n,className:Pe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));vn.displayName=dH.displayName;const rle=Re.object({name:Re.string().min(2,{message:"Name must be at least 2 characters."}),age:Re.string().min(1,{message:"Age is required."}),gender:Re.string().min(1,{message:"Gender is required."}),occupation:Re.string().min(2,{message:"Occupation is required."}),education:Re.string().min(1,{message:"Education is required."}),location:Re.string().min(2,{message:"Location is required."}),ethnicity:Re.string().optional(),personality:Re.string(),interests:Re.string(),hasPurchasingPower:Re.boolean().optional(),hasChildren:Re.boolean().optional(),techSavviness:Re.number().min(0).max(100),brandLoyalty:Re.number().min(0).max(100),priceConsciousness:Re.number().min(0).max(100),environmentalConcern:Re.number().min(0).max(100),socialGrade:Re.string().optional(),householdIncome:Re.string().optional(),householdComposition:Re.string().optional(),livingSituation:Re.string().optional(),goals:Re.array(Re.string()).optional(),frustrations:Re.array(Re.string()).optional(),motivations:Re.array(Re.string()).optional(),scenarios:Re.array(Re.string()).optional(),scenarioType:Re.string().optional(),oceanTraits:Re.object({openness:Re.number().min(0).max(100),conscientiousness:Re.number().min(0).max(100),extraversion:Re.number().min(0).max(100),agreeableness:Re.number().min(0).max(100),neuroticism:Re.number().min(0).max(100)}).optional(),thinkFeelDo:Re.object({thinks:Re.array(Re.string()),feels:Re.array(Re.string()),does:Re.array(Re.string())}).optional(),mediaConsumption:Re.string().optional(),deviceUsage:Re.string().optional(),shoppingHabits:Re.string().optional(),brandPreferences:Re.string().optional(),communicationPreferences:Re.string().optional(),paymentMethods:Re.string().optional(),purchaseBehaviour:Re.string().optional(),coreValues:Re.string().optional(),lifestyleChoices:Re.string().optional(),socialActivities:Re.string().optional(),categoryKnowledge:Re.string().optional(),decisionInfluences:Re.string().optional(),painPoints:Re.string().optional(),journeyContext:Re.string().optional(),keyTouchpoints:Re.string().optional(),selfDeterminationNeeds:Re.object({autonomy:Re.string(),competence:Re.string(),relatedness:Re.string()}).optional(),fears:Re.array(Re.string()).optional(),narrative:Re.string().optional(),additionalInformation:Re.string().optional()});function ile({targetFolderId:t,targetFolderName:e}){const[n,r]=y.useState(1),[i,s]=y.useState(!1),[o,c]=y.useState(!1),[l,u]=y.useState(0),d=lr(),{isAuthenticated:f,login:h}=Zo();y.useEffect(()=>{u(0)},[]),y.useEffect(()=>{(async()=>{if(!f&&!o){c(!0);try{console.log("Attempting auto login with default credentials"),await h("user","pass"),console.log("Auto login successful");const A=localStorage.getItem("auth_token");A?(console.log("Token successfully stored:",A.substring(0,10)+"..."),Fe.success("Logged in automatically with default account")):(console.error("Token not stored after successful login"),Fe.error("Authentication problem, token not stored"))}catch(A){console.error("Auto login failed:",A)}finally{c(!1)}}})()},[]);const p=V0({resolver:G0(rle),defaultValues:{name:"",age:"",gender:"",occupation:"",education:"",location:"",ethnicity:"",personality:"",interests:"",hasPurchasingPower:!1,hasChildren:!1,techSavviness:50,brandLoyalty:50,priceConsciousness:50,environmentalConcern:50,socialGrade:"",householdIncome:"",householdComposition:"",livingSituation:"",goals:[],frustrations:[],motivations:[],scenarios:[],scenarioType:"",oceanTraits:{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:{thinks:[],feels:[],does:[]},mediaConsumption:"",deviceUsage:"",shoppingHabits:"",brandPreferences:"",communicationPreferences:"",paymentMethods:"",purchaseBehaviour:"",coreValues:"",lifestyleChoices:"",socialActivities:"",categoryKnowledge:"",decisionInfluences:"",painPoints:"",journeyContext:"",keyTouchpoints:"",selfDeterminationNeeds:{autonomy:"",competence:"",relatedness:""},fears:[],narrative:"",additionalInformation:""}}),g=_=>{const A=p.getValues(_)||[];p.setValue(_,[...A,""])},m=(_,A,j)=>{const k=[...p.getValues(_)||[]];k[A]=j,p.setValue(_,k)},v=(_,A)=>{const T=[...p.getValues(_)||[]];T.splice(A,1),p.setValue(_,T)},b=_=>{const A=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},j={...A,[_]:[...A[_]||[],""]};p.setValue("thinkFeelDo",j)},x=(_,A,j)=>{const T=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},k=[...T[_]||[]];k[A]=j;const I={...T,[_]:k};p.setValue("thinkFeelDo",I)},w=(_,A)=>{const j=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},T=[...j[_]||[]];T.splice(A,1);const k={...j,[_]:T};p.setValue("thinkFeelDo",k)},S=(_,A)=>{const T={...p.getValues("oceanTraits")||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},[_]:A};p.setValue("oceanTraits",T)};async function C(_,A=!1){var j,T,k,I,E;if(A&&l>=1){console.log("Max retry attempts reached, stopping retry loop"),Fe.error("Authentication failed after multiple attempts",{description:"Please try logging in manually (user/pass)"}),d("/login",{state:{from:"/synthetic-users"}}),s(!1);return}A?(u(O=>O+1),console.log(`Retry attempt ${l+1}`)):u(0),s(!0);try{if(!f)try{console.log("Not authenticated, attempting login with default credentials before submission"),await h("user","pass"),console.log("Login successful before persona creation")}catch(L){console.error("Login failed before persona creation:",L),Fe.error("Authentication required",{description:"Please log in before creating personas. Default: user/pass"}),d("/login",{state:{from:"/synthetic-users"}}),s(!1);return}const O=`persona-generation-${Date.now()}`,M=t&&e?` in "${e}" folder`:"",U=n>1?`${n} personas`:"persona";console.log(`UserCreator - Creating ${U}${M}`),Fe.createPersistent({id:O,title:`Generating ${U}...`,description:`Creating synthetic user profile${n>1?"s":""}${M}`,type:"info"});const D={..._,oceanTraits:_.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:_.thinkFeelDo||{thinks:[],feels:[],does:[]},folderId:t||void 0},B={id:`temp-${Date.now()}`,...D},R=JSON.parse(localStorage.getItem("tempPersonas")||"[]");if(R.push(B),localStorage.setItem("tempPersonas",JSON.stringify(R)),n===1)try{if(!localStorage.getItem("auth_token")){console.error("No authentication token found"),Fe.error("Authentication required",{description:"No valid token found. Please log in again."});try{console.log("No token found, attempting new login"),await h("user","pass"),console.log("Login successful, token:",((j=localStorage.getItem("auth_token"))==null?void 0:j.substring(0,10))+"...")}catch(q){throw console.error("Login retry failed:",q),new Error("Authentication failed after retry")}}console.log("Sending persona creation request to API with auth token");const Y=await $r.create(D);console.log("Persona created successfully:",Y),Fe.updatePersistent(O,{title:"Synthetic user created successfully",description:`Created profile for ${_.name}`,type:"success"})}catch(L){throw console.error("Error creating persona via API:",L),L.response&&L.response.status===401&&Fe.error("Authentication error",{description:"Failed to authenticate with server. Please try again."}),L}else{const L=[];L.push(D);for(let Y=1;Y{d("/synthetic-users?mode=view")},300)}catch(O){if(console.error("Error creating personas:",O),O.response&&O.response.status===401||O.message&&O.message.includes("Authentication failed")&&l<1)try{console.log("Got auth error, attempting login retry with default credentials"),localStorage.removeItem("auth_token");const M=await ty.login("user","pass");if((k=M==null?void 0:M.data)!=null&&k.access_token){localStorage.setItem("auth_token",M.data.access_token),localStorage.setItem("user",JSON.stringify(M.data.user)),console.log("Manual login successful, got new token:",M.data.access_token.substring(0,10)+"..."),Fe.info("Logged in with default account, retrying submission..."),setTimeout(()=>{C(_,!0)},500);return}else throw new Error("No access token received")}catch(M){console.error("Login retry failed:",M),Fe.error("Authentication error",{description:"Cannot authenticate with server. Please contact support."})}else Fe.updatePersistent(generationToastId,{title:"Failed to create synthetic users",description:((E=(I=O.response)==null?void 0:I.data)==null?void 0:E.message)||O.message||"An unexpected error occurred",type:"error"})}finally{s(!1)}}return a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h2",{className:"text-2xl font-sf font-semibold",children:"Create Synthetic Users"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(X,{variant:"outline",size:"sm",onClick:()=>r(Math.max(1,n-1)),children:"-"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Fr,{size:16,className:"text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:n})]}),a.jsx(X,{variant:"outline",size:"sm",onClick:()=>r(n+1),children:"+"})]})]}),a.jsx(W0,{...p,children:a.jsxs("form",{onSubmit:p.handleSubmit(C),className:"space-y-6",children:[a.jsxs(hl,{defaultValue:"basic",children:[a.jsxs(Ka,{className:"grid w-full grid-cols-6",children:[a.jsx(gn,{value:"basic",children:"Basic"}),a.jsx(gn,{value:"cooper",children:"Cooper"}),a.jsx(gn,{value:"personality",children:"Personality"}),a.jsx(gn,{value:"demographics",children:"Demographics"}),a.jsx(gn,{value:"lifestyle",children:"Lifestyle"}),a.jsx(gn,{value:"extended",children:"Extended"})]}),a.jsx(vn,{value:"basic",className:"mt-6",children:a.jsx(lt,{children:a.jsx(Ot,{className:"p-6",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(yt,{control:p.control,name:"name",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Name"}),a.jsx(gt,{children:a.jsx(Ht,{placeholder:"Jane Smith",..._})}),a.jsx(vt,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(yt,{control:p.control,name:"age",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Age Range"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select age range"})})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"18-24",children:"18-24"}),a.jsx(ie,{value:"25-34",children:"25-34"}),a.jsx(ie,{value:"35-44",children:"35-44"}),a.jsx(ie,{value:"45-54",children:"45-54"}),a.jsx(ie,{value:"55-64",children:"55-64"}),a.jsx(ie,{value:"65+",children:"65+"})]})]}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"gender",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Gender"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select gender"})})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"Male",children:"Male"}),a.jsx(ie,{value:"Female",children:"Female"}),a.jsx(ie,{value:"Non-binary",children:"Non-binary"}),a.jsx(ie,{value:"Other",children:"Other"})]})]}),a.jsx(vt,{})]})})]}),a.jsx(yt,{control:p.control,name:"occupation",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Occupation"}),a.jsx(gt,{children:a.jsx(Ht,{placeholder:"Software Engineer",..._})}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"education",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Education"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select education level"})})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"High School",children:"High School"}),a.jsx(ie,{value:"Some College",children:"Some College"}),a.jsx(ie,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(ie,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(ie,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(ie,{value:"PhD",children:"PhD"})]})]}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"location",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Location"}),a.jsx(gt,{children:a.jsx(Ht,{placeholder:"New York, USA",..._})}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"ethnicity",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Ethnicity (Optional)"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select ethnicity"})})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"white",children:"White"}),a.jsx(ie,{value:"black",children:"Black"}),a.jsx(ie,{value:"asian",children:"Asian"}),a.jsx(ie,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(ie,{value:"native-american",children:"Native American"}),a.jsx(ie,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(ie,{value:"mixed",children:"Mixed"}),a.jsx(ie,{value:"other",children:"Other"}),a.jsx(ie,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]}),a.jsx(vt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(yt,{control:p.control,name:"personality",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Personality Traits"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Curious, analytical, detail-oriented",..._,rows:3})}),a.jsx(Mn,{children:"Describe key personality traits that define this user"}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"interests",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Interests"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Technology, fitness, cooking, travel",..._,rows:3})}),a.jsx(Mn,{children:"List interests, hobbies and activities this user enjoys"}),a.jsx(vt,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"font-medium text-sm",children:"Behavioral Attributes"}),a.jsx(yt,{control:p.control,name:"techSavviness",render:({field:_})=>a.jsxs(pt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(mt,{children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(gt,{children:a.jsx(Sr,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"brandLoyalty",render:({field:_})=>a.jsxs(pt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(mt,{children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(gt,{children:a.jsx(Sr,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"priceConsciousness",render:({field:_})=>a.jsxs(pt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(mt,{children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(gt,{children:a.jsx(Sr,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"environmentalConcern",render:({field:_})=>a.jsxs(pt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(mt,{children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(gt,{children:a.jsx(Sr,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(vt,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsx(yt,{control:p.control,name:"hasPurchasingPower",render:({field:_})=>a.jsxs(pt,{className:"flex items-center justify-between",children:[a.jsx(mt,{children:"Purchasing Power"}),a.jsx(gt,{children:a.jsx(bm,{checked:_.value,onCheckedChange:_.onChange})}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"hasChildren",render:({field:_})=>a.jsxs(pt,{className:"flex items-center justify-between",children:[a.jsx(mt,{children:"Has Children"}),a.jsx(gt,{children:a.jsx(bm,{checked:_.value,onCheckedChange:_.onChange})}),a.jsx(vt,{})]})})]})]})]})]})})})}),a.jsxs(vn,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Goals"}),(p.watch("goals")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("goals",A,j.target.value),placeholder:"Enter a goal"}),a.jsx(X,{variant:"ghost",size:"icon",type:"button",onClick:()=>v("goals",A),children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(X,{variant:"outline",size:"sm",type:"button",onClick:()=>g("goals"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Goal"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Frustrations"}),(p.watch("frustrations")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("frustrations",A,j.target.value),placeholder:"Enter a frustration"}),a.jsx(X,{variant:"ghost",size:"icon",type:"button",onClick:()=>v("frustrations",A),children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(X,{variant:"outline",size:"sm",type:"button",onClick:()=>g("frustrations"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Frustration"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Motivations"}),(p.watch("motivations")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("motivations",A,j.target.value),placeholder:"Enter a motivation"}),a.jsx(X,{variant:"ghost",size:"icon",type:"button",onClick:()=>v("motivations",A),children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(X,{variant:"outline",size:"sm",type:"button",onClick:()=>g("motivations"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Thinks"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).thinks||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>x("thinks",A,j.target.value),placeholder:"What they think"}),a.jsx(X,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("thinks",A),children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(X,{variant:"outline",size:"sm",type:"button",onClick:()=>b("thinks"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Thought"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Feels"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).feels||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>x("feels",A,j.target.value),placeholder:"What they feel"}),a.jsx(X,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("feels",A),children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(X,{variant:"outline",size:"sm",type:"button",onClick:()=>b("feels"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Feeling"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Does"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).does||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>x("does",A,j.target.value),placeholder:"What they do"}),a.jsx(X,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("does",A),children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(X,{variant:"outline",size:"sm",type:"button",onClick:()=>b("does"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(lt,{children:a.jsx(Ot,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(yt,{control:p.control,name:"scenarioType",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Scenario Section Title"}),a.jsx(gt,{children:a.jsx(Ht,{placeholder:"Life Scenarios",..._})}),a.jsx(Mn,{children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'}),a.jsx(vt,{})]})}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(p.watch("scenarios")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(ht,{value:_,onChange:j=>m("scenarios",A,j.target.value),rows:2,placeholder:"Describe a usage scenario"}),a.jsx(X,{variant:"ghost",size:"icon",type:"button",onClick:()=>v("scenarios",A),className:"mt-2",children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(X,{variant:"outline",size:"sm",type:"button",onClick:()=>g("scenarios"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})]})})})]}),a.jsx(vn,{value:"personality",className:"mt-6",children:a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Openness to Experience"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{openness:50}).openness||50,"%"]})]}),a.jsx(Sr,{value:[(p.watch("oceanTraits")||{openness:50}).openness||50],onValueChange:_=>S("openness",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Creativity, curiosity, and openness to new ideas"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Conscientiousness"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50,"%"]})]}),a.jsx(Sr,{value:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50],onValueChange:_=>S("conscientiousness",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization, responsibility, and self-discipline"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Extraversion"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50,"%"]})]}),a.jsx(Sr,{value:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50],onValueChange:_=>S("extraversion",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Sociability, assertiveness, and talkativeness"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Agreeableness"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50,"%"]})]}),a.jsx(Sr,{value:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50],onValueChange:_=>S("agreeableness",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Compassion, cooperation, and concern for others"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Neuroticism"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50,"%"]})]}),a.jsx(Sr,{value:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50],onValueChange:_=>S("neuroticism",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Emotional reactivity, anxiety, and sensitivity to stress"})]})]})]})})}),a.jsx(vn,{value:"demographics",className:"mt-6",children:a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Demographic Information"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(yt,{control:p.control,name:"socialGrade",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Social Grade"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select social grade"})})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"A",children:"A - Higher managerial"}),a.jsx(ie,{value:"B",children:"B - Intermediate managerial"}),a.jsx(ie,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(ie,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(ie,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(ie,{value:"E",children:"E - State pensioners, unemployed"})]})]}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"householdIncome",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Household Income"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select income range"})})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"Under $25k",children:"Under $25,000"}),a.jsx(ie,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(ie,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(ie,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(ie,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(ie,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(ie,{value:"Over $250k",children:"Over $250,000"}),a.jsx(ie,{value:"Prefer not to say",children:"Prefer not to say"})]})]}),a.jsx(vt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(yt,{control:p.control,name:"householdComposition",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Household Composition"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select household type"})})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"Single person",children:"Single person"}),a.jsx(ie,{value:"Couple without children",children:"Couple without children"}),a.jsx(ie,{value:"Couple with children",children:"Couple with children"}),a.jsx(ie,{value:"Single parent",children:"Single parent"}),a.jsx(ie,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(ie,{value:"Shared housing",children:"Shared housing"}),a.jsx(ie,{value:"Other",children:"Other"})]})]}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"livingSituation",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Living Situation"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select living situation"})})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"Own home",children:"Own home"}),a.jsx(ie,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(ie,{value:"Rent house",children:"Rent house"}),a.jsx(ie,{value:"Live with family",children:"Live with family"}),a.jsx(ie,{value:"Student housing",children:"Student housing"}),a.jsx(ie,{value:"Assisted living",children:"Assisted living"}),a.jsx(ie,{value:"Other",children:"Other"})]})]}),a.jsx(vt,{})]})})]})]})]})})}),a.jsx(vn,{value:"lifestyle",className:"mt-6",children:a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Lifestyle & Behavior"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(yt,{control:p.control,name:"mediaConsumption",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Media Consumption"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"TV shows, podcasts, news sources, social media platforms",..._,rows:3})}),a.jsx(Mn,{children:"Describe media consumption habits and preferences"}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"deviceUsage",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Device Usage"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Smartphone, laptop, tablet, smart TV, gaming console",..._,rows:3})}),a.jsx(Mn,{children:"Primary devices and usage patterns"}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"shoppingHabits",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Shopping Habits"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Online vs in-store, frequency, preferred retailers",..._,rows:3})}),a.jsx(Mn,{children:"Shopping behavior and preferences"}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"brandPreferences",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Brand Preferences"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Favorite brands, brand values alignment",..._,rows:3})}),a.jsx(Mn,{children:"Preferred brands and reasoning"}),a.jsx(vt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(yt,{control:p.control,name:"communicationPreferences",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Communication Preferences"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Email, phone, text, video calls, in-person",..._,rows:3})}),a.jsx(Mn,{children:"Preferred communication methods and channels"}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"paymentMethods",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Payment Methods"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Credit cards, digital wallets, cash, BNPL",..._,rows:3})}),a.jsx(Mn,{children:"Preferred payment methods and financial tools"}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"purchaseBehaviour",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Purchase Behavior"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Research habits, decision factors, impulse vs planned buying",..._,rows:3})}),a.jsx(Mn,{children:"How they approach making purchase decisions"}),a.jsx(vt,{})]})})]})]})]})})}),a.jsxs(vn,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Extended Profile"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(yt,{control:p.control,name:"coreValues",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Core Values"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Key principles and values that guide decisions",..._,rows:3})}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"lifestyleChoices",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Lifestyle Choices"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Health, fitness, diet, work-life balance preferences",..._,rows:3})}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"socialActivities",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Social Activities"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Social hobbies, community involvement, networking",..._,rows:3})}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"categoryKnowledge",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Category Knowledge"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Expertise in specific product/service categories",..._,rows:3})}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"decisionInfluences",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Decision Influences"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"What factors most influence their decisions",..._,rows:3})}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"painPoints",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Pain Points"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Common challenges and friction points",..._,rows:3})}),a.jsx(vt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(yt,{control:p.control,name:"journeyContext",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Journey Context"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Current life stage and contextual factors",..._,rows:3})}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"keyTouchpoints",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Key Touchpoints"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Important interaction points and channels",..._,rows:3})}),a.jsx(vt,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsx(yt,{control:p.control,name:"selfDeterminationNeeds.autonomy",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Autonomy"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Need for independence and self-direction",..._,rows:2})}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"selfDeterminationNeeds.competence",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Competence"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Need to feel capable and effective",..._,rows:2})}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"selfDeterminationNeeds.relatedness",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Relatedness"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Need for connection and belonging",..._,rows:2})}),a.jsx(vt,{})]})})]})]})]})]})}),a.jsx(lt,{children:a.jsx(Ot,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Fears & Concerns"}),(p.watch("fears")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("fears",A,j.target.value),placeholder:"Enter a fear or concern"}),a.jsx(X,{variant:"ghost",size:"icon",type:"button",onClick:()=>v("fears",A),children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(X,{variant:"outline",size:"sm",type:"button",onClick:()=>g("fears"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsx(yt,{control:p.control,name:"narrative",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Personal Narrative"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Personal story, background, key life experiences",..._,rows:4})}),a.jsx(Mn,{children:"A brief narrative that captures their personal story"}),a.jsx(vt,{})]})}),a.jsx(yt,{control:p.control,name:"additionalInformation",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Additional Information"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Any other relevant details or context",..._,rows:4})}),a.jsx(Mn,{children:"Additional context or details not covered elsewhere"}),a.jsx(vt,{})]})})]})})})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(X,{variant:"outline",type:"button",onClick:()=>p.reset(),children:"Reset"}),a.jsxs(X,{type:"submit",disabled:i,children:[i?a.jsx(nZ,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(LE,{className:"mr-2 h-4 w-4"}),i?"Creating...":`Create ${n>1?`${n} Users`:"User"}`]})]})]})})]})}var kA=["Enter"," "],sle=["ArrowDown","PageUp","Home"],fH=["ArrowUp","PageDown","End"],ole=[...sle,...fH],ale={ltr:[...kA,"ArrowRight"],rtl:[...kA,"ArrowLeft"]},cle={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Tg="Menu",[wm,lle,ule]=Y0(Tg),[Iu,hH]=Ui(Tg,[ule,$f,Yf]),iw=$f(),pH=Yf(),[dle,Ru]=Iu(Tg),[fle,Pg]=Iu(Tg),mH=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=t,c=iw(e),[l,u]=y.useState(null),d=y.useRef(!1),f=Ar(s),h=Ou(i);return y.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),a.jsx(O4,{...c,children:a.jsx(dle,{scope:e,open:n,onOpenChange:f,content:l,onContentChange:u,children:a.jsx(fle,{scope:e,onClose:y.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:o,children:r})})})};mH.displayName=Tg;var hle="MenuAnchor",AT=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=iw(n);return a.jsx(SE,{...i,...r,ref:e})});AT.displayName=hle;var jT="MenuPortal",[ple,gH]=Iu(jT,{forceMount:void 0}),vH=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,s=Ru(jT,e);return a.jsx(ple,{scope:e,forceMount:n,children:a.jsx(Yr,{present:n||s.open,children:a.jsx(f0,{asChild:!0,container:i,children:r})})})};vH.displayName=jT;var As="MenuContent",[mle,ET]=Iu(As),yH=y.forwardRef((t,e)=>{const n=gH(As,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=Ru(As,t.__scopeMenu),o=Pg(As,t.__scopeMenu);return a.jsx(wm.Provider,{scope:t.__scopeMenu,children:a.jsx(Yr,{present:r||s.open,children:a.jsx(wm.Slot,{scope:t.__scopeMenu,children:o.modal?a.jsx(gle,{...i,ref:e}):a.jsx(vle,{...i,ref:e})})})})}),gle=y.forwardRef((t,e)=>{const n=Ru(As,t.__scopeMenu),r=y.useRef(null),i=Pt(e,r);return y.useEffect(()=>{const s=r.current;if(s)return uT(s)},[]),a.jsx(NT,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ne(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),vle=y.forwardRef((t,e)=>{const n=Ru(As,t.__scopeMenu);return a.jsx(NT,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),NT=y.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:g,...m}=t,v=Ru(As,n),b=Pg(As,n),x=iw(n),w=pH(n),S=lle(n),[C,_]=y.useState(null),A=y.useRef(null),j=Pt(e,A,v.onContentChange),T=y.useRef(0),k=y.useRef(""),I=y.useRef(0),E=y.useRef(null),O=y.useRef("right"),M=y.useRef(0),U=g?J0:y.Fragment,D=g?{as:Go,allowPinchZoom:!0}:void 0,B=L=>{var le,ke;const Y=k.current+L,q=S().filter(ue=>!ue.disabled),J=document.activeElement,me=(le=q.find(ue=>ue.ref.current===J))==null?void 0:le.textValue,F=q.map(ue=>ue.textValue),oe=Tle(F,Y,me),se=(ke=q.find(ue=>ue.textValue===oe))==null?void 0:ke.ref.current;(function ue(we){k.current=we,window.clearTimeout(T.current),we!==""&&(T.current=window.setTimeout(()=>ue(""),1e3))})(Y),se&&setTimeout(()=>se.focus())};y.useEffect(()=>()=>window.clearTimeout(T.current),[]),lT();const R=y.useCallback(L=>{var q,J;return O.current===((q=E.current)==null?void 0:q.side)&&kle(L,(J=E.current)==null?void 0:J.area)},[]);return a.jsx(mle,{scope:n,searchRef:k,onItemEnter:y.useCallback(L=>{R(L)&&L.preventDefault()},[R]),onItemLeave:y.useCallback(L=>{var Y;R(L)||((Y=A.current)==null||Y.focus(),_(null))},[R]),onTriggerLeave:y.useCallback(L=>{R(L)&&L.preventDefault()},[R]),pointerGraceTimerRef:I,onPointerGraceIntentChange:y.useCallback(L=>{E.current=L},[]),children:a.jsx(U,{...D,children:a.jsx(Q0,{asChild:!0,trapped:i,onMountAutoFocus:Ne(s,L=>{var Y;L.preventDefault(),(Y=A.current)==null||Y.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:a.jsx(pg,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:a.jsx(wT,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:_,onEntryFocus:Ne(l,L=>{b.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(CE,{role:"menu","aria-orientation":"vertical","data-state":RH(v.open),"data-radix-menu-content":"",dir:b.dir,...x,...m,ref:j,style:{outline:"none",...m.style},onKeyDown:Ne(m.onKeyDown,L=>{const q=L.target.closest("[data-radix-menu-content]")===L.currentTarget,J=L.ctrlKey||L.altKey||L.metaKey,me=L.key.length===1;q&&(L.key==="Tab"&&L.preventDefault(),!J&&me&&B(L.key));const F=A.current;if(L.target!==F||!ole.includes(L.key))return;L.preventDefault();const se=S().filter(le=>!le.disabled).map(le=>le.ref.current);fH.includes(L.key)&&se.reverse(),Ele(se)}),onBlur:Ne(t.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(T.current),k.current="")}),onPointerMove:Ne(t.onPointerMove,Sm(L=>{const Y=L.target,q=M.current!==L.clientX;if(L.currentTarget.contains(Y)&&q){const J=L.clientX>M.current?"right":"left";O.current=J,M.current=L.clientX}}))})})})})})})});yH.displayName=As;var yle="MenuGroup",TT=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(it.div,{role:"group",...r,ref:e})});TT.displayName=yle;var xle="MenuLabel",xH=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(it.div,{...r,ref:e})});xH.displayName=xle;var kx="MenuItem",jR="menu.itemSelect",sw=y.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,s=y.useRef(null),o=Pg(kx,t.__scopeMenu),c=ET(kx,t.__scopeMenu),l=Pt(e,s),u=y.useRef(!1),d=()=>{const f=s.current;if(!n&&f){const h=new CustomEvent(jR,{bubbles:!0,cancelable:!0});f.addEventListener(jR,p=>r==null?void 0:r(p),{once:!0}),d4(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return a.jsx(bH,{...i,ref:l,disabled:n,onClick:Ne(t.onClick,d),onPointerDown:f=>{var h;(h=t.onPointerDown)==null||h.call(t,f),u.current=!0},onPointerUp:Ne(t.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:Ne(t.onKeyDown,f=>{const h=c.searchRef.current!=="";n||h&&f.key===" "||kA.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});sw.displayName=kx;var bH=y.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=t,o=ET(kx,n),c=pH(n),l=y.useRef(null),u=Pt(e,l),[d,f]=y.useState(!1),[h,p]=y.useState("");return y.useEffect(()=>{const g=l.current;g&&p((g.textContent??"").trim())},[s.children]),a.jsx(wm.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:a.jsx(ST,{asChild:!0,...c,focusable:!r,children:a.jsx(it.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:Ne(t.onPointerMove,Sm(g=>{r?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ne(t.onPointerLeave,Sm(g=>o.onItemLeave(g))),onFocus:Ne(t.onFocus,()=>f(!0)),onBlur:Ne(t.onBlur,()=>f(!1))})})})}),ble="MenuCheckboxItem",wH=y.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return a.jsx(jH,{scope:t.__scopeMenu,checked:n,children:a.jsx(sw,{role:"menuitemcheckbox","aria-checked":Ox(n)?"mixed":n,...i,ref:e,"data-state":kT(n),onSelect:Ne(i.onSelect,()=>r==null?void 0:r(Ox(n)?!0:!n),{checkForDefaultPrevented:!1})})})});wH.displayName=ble;var SH="MenuRadioGroup",[wle,Sle]=Iu(SH,{value:void 0,onValueChange:()=>{}}),CH=y.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,s=Ar(r);return a.jsx(wle,{scope:t.__scopeMenu,value:n,onValueChange:s,children:a.jsx(TT,{...i,ref:e})})});CH.displayName=SH;var _H="MenuRadioItem",AH=y.forwardRef((t,e)=>{const{value:n,...r}=t,i=Sle(_H,t.__scopeMenu),s=n===i.value;return a.jsx(jH,{scope:t.__scopeMenu,checked:s,children:a.jsx(sw,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":kT(s),onSelect:Ne(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});AH.displayName=_H;var PT="MenuItemIndicator",[jH,Cle]=Iu(PT,{checked:!1}),EH=y.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,s=Cle(PT,n);return a.jsx(Yr,{present:r||Ox(s.checked)||s.checked===!0,children:a.jsx(it.span,{...i,ref:e,"data-state":kT(s.checked)})})});EH.displayName=PT;var _le="MenuSeparator",NH=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(it.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});NH.displayName=_le;var Ale="MenuArrow",TH=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=iw(n);return a.jsx(_E,{...i,...r,ref:e})});TH.displayName=Ale;var jle="MenuSub",[mFe,PH]=Iu(jle),Yh="MenuSubTrigger",kH=y.forwardRef((t,e)=>{const n=Ru(Yh,t.__scopeMenu),r=Pg(Yh,t.__scopeMenu),i=PH(Yh,t.__scopeMenu),s=ET(Yh,t.__scopeMenu),o=y.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=s,u={__scopeMenu:t.__scopeMenu},d=y.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return y.useEffect(()=>d,[d]),y.useEffect(()=>{const f=c.current;return()=>{window.clearTimeout(f),l(null)}},[c,l]),a.jsx(AT,{asChild:!0,...u,children:a.jsx(bH,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":RH(n.open),...t,ref:c0(e,i.onTriggerChange),onClick:f=>{var h;(h=t.onClick)==null||h.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ne(t.onPointerMove,Sm(f=>{s.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Ne(t.onPointerLeave,Sm(f=>{var p,g;d();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const m=(g=n.content)==null?void 0:g.dataset.side,v=m==="right",b=v?-5:5,x=h[v?"left":"right"],w=h[v?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+b,y:f.clientY},{x,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x,y:h.bottom}],side:m}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Ne(t.onKeyDown,f=>{var p;const h=s.searchRef.current!=="";t.disabled||h&&f.key===" "||ale[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});kH.displayName=Yh;var OH="MenuSubContent",IH=y.forwardRef((t,e)=>{const n=gH(As,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=Ru(As,t.__scopeMenu),o=Pg(As,t.__scopeMenu),c=PH(OH,t.__scopeMenu),l=y.useRef(null),u=Pt(e,l);return a.jsx(wm.Provider,{scope:t.__scopeMenu,children:a.jsx(Yr,{present:r||s.open,children:a.jsx(wm.Slot,{scope:t.__scopeMenu,children:a.jsx(NT,{id:c.contentId,"aria-labelledby":c.triggerId,...i,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;o.isUsingKeyboardRef.current&&((f=l.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Ne(t.onFocusOutside,d=>{d.target!==c.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Ne(t.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:Ne(t.onKeyDown,d=>{var p;const f=d.currentTarget.contains(d.target),h=cle[o.dir].includes(d.key);f&&h&&(s.onOpenChange(!1),(p=c.trigger)==null||p.focus(),d.preventDefault())})})})})})});IH.displayName=OH;function RH(t){return t?"open":"closed"}function Ox(t){return t==="indeterminate"}function kT(t){return Ox(t)?"indeterminate":t?"checked":"unchecked"}function Ele(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Nle(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function Tle(t,e,n){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=Nle(t,Math.max(s,0));i.length===1&&(o=o.filter(u=>u!==n));const l=o.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Ple(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;sr!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function kle(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Ple(n,e)}function Sm(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Ole=mH,Ile=AT,Rle=vH,Mle=yH,Dle=TT,$le=xH,Lle=sw,Fle=wH,Ule=CH,Ble=AH,Hle=EH,zle=NH,Vle=TH,Gle=kH,Kle=IH,OT="DropdownMenu",[Wle,gFe]=Ui(OT,[hH]),_i=hH(),[qle,MH]=Wle(OT),DH=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:c=!0}=t,l=_i(e),u=y.useRef(null),[d=!1,f]=lo({prop:i,defaultProp:s,onChange:o});return a.jsx(qle,{scope:e,triggerId:Zs(),triggerRef:u,contentId:Zs(),open:d,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(h=>!h),[f]),modal:c,children:a.jsx(Ole,{...l,open:d,onOpenChange:f,dir:r,modal:c,children:n})})};DH.displayName=OT;var $H="DropdownMenuTrigger",LH=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,s=MH($H,n),o=_i(n);return a.jsx(Ile,{asChild:!0,...o,children:a.jsx(it.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:c0(e,s.triggerRef),onPointerDown:Ne(t.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:Ne(t.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});LH.displayName=$H;var Yle="DropdownMenuPortal",FH=t=>{const{__scopeDropdownMenu:e,...n}=t,r=_i(e);return a.jsx(Rle,{...r,...n})};FH.displayName=Yle;var UH="DropdownMenuContent",BH=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=MH(UH,n),s=_i(n),o=y.useRef(!1);return a.jsx(Mle,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:e,onCloseAutoFocus:Ne(t.onCloseAutoFocus,c=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,c.preventDefault()}),onInteractOutside:Ne(t.onInteractOutside,c=>{const l=c.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,d=l.button===2||u;(!i.modal||d)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});BH.displayName=UH;var Qle="DropdownMenuGroup",Xle=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Dle,{...i,...r,ref:e})});Xle.displayName=Qle;var Jle="DropdownMenuLabel",HH=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx($le,{...i,...r,ref:e})});HH.displayName=Jle;var Zle="DropdownMenuItem",zH=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Lle,{...i,...r,ref:e})});zH.displayName=Zle;var eue="DropdownMenuCheckboxItem",VH=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Fle,{...i,...r,ref:e})});VH.displayName=eue;var tue="DropdownMenuRadioGroup",nue=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Ule,{...i,...r,ref:e})});nue.displayName=tue;var rue="DropdownMenuRadioItem",GH=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Ble,{...i,...r,ref:e})});GH.displayName=rue;var iue="DropdownMenuItemIndicator",KH=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Hle,{...i,...r,ref:e})});KH.displayName=iue;var sue="DropdownMenuSeparator",WH=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(zle,{...i,...r,ref:e})});WH.displayName=sue;var oue="DropdownMenuArrow",aue=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Vle,{...i,...r,ref:e})});aue.displayName=oue;var cue="DropdownMenuSubTrigger",qH=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Gle,{...i,...r,ref:e})});qH.displayName=cue;var lue="DropdownMenuSubContent",YH=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Kle,{...i,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});YH.displayName=lue;var uue=DH,due=LH,fue=FH,QH=BH,XH=HH,JH=zH,ZH=VH,ez=GH,tz=KH,nz=WH,rz=qH,iz=YH;const OA=uue,IA=due,hue=y.forwardRef(({className:t,inset:e,children:n,...r},i)=>a.jsxs(rz,{ref:i,className:Pe("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",e&&"pl-8",t),...r,children:[n,a.jsx(fs,{className:"ml-auto h-4 w-4"})]}));hue.displayName=rz.displayName;const pue=y.forwardRef(({className:t,...e},n)=>a.jsx(iz,{ref:n,className:Pe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));pue.displayName=iz.displayName;const Ix=y.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(fue,{children:a.jsx(QH,{ref:r,sideOffset:e,className:Pe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));Ix.displayName=QH.displayName;const oc=y.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(JH,{ref:r,className:Pe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));oc.displayName=JH.displayName;const mue=y.forwardRef(({className:t,children:e,checked:n,...r},i)=>a.jsxs(ZH,{ref:i,className:Pe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(tz,{children:a.jsx(uo,{className:"h-4 w-4"})})}),e]}));mue.displayName=ZH.displayName;const gue=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(ez,{ref:r,className:Pe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(tz,{children:a.jsx(DE,{className:"h-2 w-2 fill-current"})})}),e]}));gue.displayName=ez.displayName;const vue=y.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(XH,{ref:r,className:Pe("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));vue.displayName=XH.displayName;const yue=y.forwardRef(({className:t,...e},n)=>a.jsx(nz,{ref:n,className:Pe("-mx-1 my-1 h-px bg-muted",t),...e}));yue.displayName=nz.displayName;var IT="Dialog",[sz,oz]=Ui(IT),[xue,yo]=sz(IT),az=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,c=y.useRef(null),l=y.useRef(null),[u=!1,d]=lo({prop:r,defaultProp:i,onChange:s});return a.jsx(xue,{scope:e,triggerRef:c,contentRef:l,contentId:Zs(),titleId:Zs(),descriptionId:Zs(),open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};az.displayName=IT;var cz="DialogTrigger",lz=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=yo(cz,n),s=Pt(e,i.triggerRef);return a.jsx(it.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":DT(i.open),...r,ref:s,onClick:Ne(t.onClick,i.onOpenToggle)})});lz.displayName=cz;var RT="DialogPortal",[bue,uz]=sz(RT,{forceMount:void 0}),dz=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=yo(RT,e);return a.jsx(bue,{scope:e,forceMount:n,children:y.Children.map(r,o=>a.jsx(Yr,{present:n||s.open,children:a.jsx(f0,{asChild:!0,container:i,children:o})}))})};dz.displayName=RT;var Rx="DialogOverlay",fz=y.forwardRef((t,e)=>{const n=uz(Rx,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=yo(Rx,t.__scopeDialog);return s.modal?a.jsx(Yr,{present:r||s.open,children:a.jsx(wue,{...i,ref:e})}):null});fz.displayName=Rx;var wue=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=yo(Rx,n);return a.jsx(J0,{as:Go,allowPinchZoom:!0,shards:[i.contentRef],children:a.jsx(it.div,{"data-state":DT(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Su="DialogContent",hz=y.forwardRef((t,e)=>{const n=uz(Su,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=yo(Su,t.__scopeDialog);return a.jsx(Yr,{present:r||s.open,children:s.modal?a.jsx(Sue,{...i,ref:e}):a.jsx(Cue,{...i,ref:e})})});hz.displayName=Su;var Sue=y.forwardRef((t,e)=>{const n=yo(Su,t.__scopeDialog),r=y.useRef(null),i=Pt(e,n.contentRef,r);return y.useEffect(()=>{const s=r.current;if(s)return uT(s)},[]),a.jsx(pz,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ne(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Ne(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&s.preventDefault()}),onFocusOutside:Ne(t.onFocusOutside,s=>s.preventDefault())})}),Cue=y.forwardRef((t,e)=>{const n=yo(Su,t.__scopeDialog),r=y.useRef(!1),i=y.useRef(!1);return a.jsx(pz,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,u;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),pz=y.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,c=yo(Su,n),l=y.useRef(null),u=Pt(e,l);return lT(),a.jsxs(a.Fragment,{children:[a.jsx(Q0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:a.jsx(pg,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":DT(c.open),...o,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(Aue,{titleId:c.titleId}),a.jsx(Eue,{contentRef:l,descriptionId:c.descriptionId})]})]})}),MT="DialogTitle",mz=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=yo(MT,n);return a.jsx(it.h2,{id:i.titleId,...r,ref:e})});mz.displayName=MT;var gz="DialogDescription",vz=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=yo(gz,n);return a.jsx(it.p,{id:i.descriptionId,...r,ref:e})});vz.displayName=gz;var yz="DialogClose",xz=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=yo(yz,n);return a.jsx(it.button,{type:"button",...r,ref:e,onClick:Ne(t.onClick,()=>i.onOpenChange(!1))})});xz.displayName=yz;function DT(t){return t?"open":"closed"}var bz="DialogTitleWarning",[_ue,wz]=V9(bz,{contentName:Su,titleName:MT,docsSlug:"dialog"}),Aue=({titleId:t})=>{const e=wz(bz),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return y.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},jue="DialogDescriptionWarning",Eue=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wz(jue).contentName}}.`;return y.useEffect(()=>{var s;const i=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},Sz=az,Nue=lz,Cz=dz,$T=fz,LT=hz,FT=mz,UT=vz,BT=xz,_z="AlertDialog",[Tue,vFe]=Ui(_z,[oz]),Wa=oz(),Az=t=>{const{__scopeAlertDialog:e,...n}=t,r=Wa(e);return a.jsx(Sz,{...r,...n,modal:!0})};Az.displayName=_z;var Pue="AlertDialogTrigger",kue=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Wa(n);return a.jsx(Nue,{...i,...r,ref:e})});kue.displayName=Pue;var Oue="AlertDialogPortal",jz=t=>{const{__scopeAlertDialog:e,...n}=t,r=Wa(e);return a.jsx(Cz,{...r,...n})};jz.displayName=Oue;var Iue="AlertDialogOverlay",Ez=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Wa(n);return a.jsx($T,{...i,...r,ref:e})});Ez.displayName=Iue;var Nd="AlertDialogContent",[Rue,Mue]=Tue(Nd),Nz=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...i}=t,s=Wa(n),o=y.useRef(null),c=Pt(e,o),l=y.useRef(null);return a.jsx(_ue,{contentName:Nd,titleName:Tz,docsSlug:"alert-dialog",children:a.jsx(Rue,{scope:n,cancelRef:l,children:a.jsxs(LT,{role:"alertdialog",...s,...i,ref:c,onOpenAutoFocus:Ne(i.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=l.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[a.jsx(hE,{children:r}),a.jsx($ue,{contentRef:o})]})})})});Nz.displayName=Nd;var Tz="AlertDialogTitle",Pz=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Wa(n);return a.jsx(FT,{...i,...r,ref:e})});Pz.displayName=Tz;var kz="AlertDialogDescription",Oz=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Wa(n);return a.jsx(UT,{...i,...r,ref:e})});Oz.displayName=kz;var Due="AlertDialogAction",Iz=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Wa(n);return a.jsx(BT,{...i,...r,ref:e})});Iz.displayName=Due;var Rz="AlertDialogCancel",Mz=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:i}=Mue(Rz,n),s=Wa(n),o=Pt(e,i);return a.jsx(BT,{...s,...r,ref:o})});Mz.displayName=Rz;var $ue=({contentRef:t})=>{const e=`\`${Nd}\` requires a description for the component to be accessible for screen reader users. + +You can add a description to the \`${Nd}\` by passing a \`${kz}\` component as a child, which also benefits sighted users by adding visible context to the dialog. + +Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Nd}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. + +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return y.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Lue=Az,Fue=jz,Dz=Ez,$z=Nz,Lz=Iz,Fz=Mz,Uz=Pz,Bz=Oz;const RA=Lue,Uue=Fue,Hz=y.forwardRef(({className:t,...e},n)=>a.jsx(Dz,{className:Pe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));Hz.displayName=Dz.displayName;const Mx=y.forwardRef(({className:t,...e},n)=>a.jsxs(Uue,{children:[a.jsx(Hz,{}),a.jsx($z,{ref:n,className:Pe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));Mx.displayName=$z.displayName;const Dx=({className:t,...e})=>a.jsx("div",{className:Pe("flex flex-col space-y-2 text-center sm:text-left",t),...e});Dx.displayName="AlertDialogHeader";const $x=({className:t,...e})=>a.jsx("div",{className:Pe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});$x.displayName="AlertDialogFooter";const Lx=y.forwardRef(({className:t,...e},n)=>a.jsx(Uz,{ref:n,className:Pe("text-lg font-semibold",t),...e}));Lx.displayName=Uz.displayName;const Fx=y.forwardRef(({className:t,...e},n)=>a.jsx(Bz,{ref:n,className:Pe("text-sm text-muted-foreground",t),...e}));Fx.displayName=Bz.displayName;const Ux=y.forwardRef(({className:t,...e},n)=>a.jsx(Lz,{ref:n,className:Pe(eT(),t),...e}));Ux.displayName=Lz.displayName;const Bx=y.forwardRef(({className:t,...e},n)=>a.jsx(Fz,{ref:n,className:Pe(eT({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Bx.displayName=Fz.displayName;const eu=Sz,Bue=Cz,zz=y.forwardRef(({className:t,...e},n)=>a.jsx($T,{ref:n,className:Pe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));zz.displayName=$T.displayName;const Lc=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(Bue,{children:[a.jsx(zz,{}),a.jsxs(LT,{ref:r,className:Pe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,a.jsxs(BT,{className:"absolute right-4 top-4 z-[100] rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(Mi,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Lc.displayName=LT.displayName;const Fc=({className:t,...e})=>a.jsx("div",{className:Pe("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Fc.displayName="DialogHeader";const Uc=({className:t,...e})=>a.jsx("div",{className:Pe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Uc.displayName="DialogFooter";const Bc=y.forwardRef(({className:t,...e},n)=>a.jsx(FT,{ref:n,className:Pe("text-lg font-semibold leading-none tracking-tight",t),...e}));Bc.displayName=FT.displayName;const tu=y.forwardRef(({className:t,...e},n)=>a.jsx(UT,{ref:n,className:Pe("text-sm text-muted-foreground",t),...e}));tu.displayName=UT.displayName;var HT="Radio",[Hue,Vz]=Ui(HT),[zue,Vue]=Hue(HT),Gz=y.forwardRef((t,e)=>{const{__scopeRadio:n,name:r,checked:i=!1,required:s,disabled:o,value:c="on",onCheck:l,form:u,...d}=t,[f,h]=y.useState(null),p=Pt(e,v=>h(v)),g=y.useRef(!1),m=f?u||!!f.closest("form"):!0;return a.jsxs(zue,{scope:n,checked:i,disabled:o,children:[a.jsx(it.button,{type:"button",role:"radio","aria-checked":i,"data-state":qz(i),"data-disabled":o?"":void 0,disabled:o,value:c,...d,ref:p,onClick:Ne(t.onClick,v=>{i||l==null||l(),m&&(g.current=v.isPropagationStopped(),g.current||v.stopPropagation())})}),m&&a.jsx(Gue,{control:f,bubbles:!g.current,name:r,value:c,checked:i,required:s,disabled:o,form:u,style:{transform:"translateX(-100%)"}})]})});Gz.displayName=HT;var Kz="RadioIndicator",Wz=y.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:r,...i}=t,s=Vue(Kz,n);return a.jsx(Yr,{present:r||s.checked,children:a.jsx(it.span,{"data-state":qz(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:e})})});Wz.displayName=Kz;var Gue=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,s=y.useRef(null),o=Cg(n),c=gg(e);return y.useEffect(()=>{const l=s.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==n&&f){const h=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(h)}},[o,n,r]),a.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...t.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function qz(t){return t?"checked":"unchecked"}var Kue=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],zT="RadioGroup",[Wue,yFe]=Ui(zT,[Yf,Vz]),Yz=Yf(),Qz=Vz(),[que,Yue]=Wue(zT),Xz=y.forwardRef((t,e)=>{const{__scopeRadioGroup:n,name:r,defaultValue:i,value:s,required:o=!1,disabled:c=!1,orientation:l,dir:u,loop:d=!0,onValueChange:f,...h}=t,p=Yz(n),g=Ou(u),[m,v]=lo({prop:s,defaultProp:i,onChange:f});return a.jsx(que,{scope:n,name:r,required:o,disabled:c,value:m,onValueChange:v,children:a.jsx(wT,{asChild:!0,...p,orientation:l,dir:g,loop:d,children:a.jsx(it.div,{role:"radiogroup","aria-required":o,"aria-orientation":l,"data-disabled":c?"":void 0,dir:g,...h,ref:e})})})});Xz.displayName=zT;var Jz="RadioGroupItem",Zz=y.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:r,...i}=t,s=Yue(Jz,n),o=s.disabled||r,c=Yz(n),l=Qz(n),u=y.useRef(null),d=Pt(e,u),f=s.value===i.value,h=y.useRef(!1);return y.useEffect(()=>{const p=m=>{Kue.includes(m.key)&&(h.current=!0)},g=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",g),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",g)}},[]),a.jsx(ST,{asChild:!0,...c,focusable:!o,active:f,children:a.jsx(Gz,{disabled:o,required:s.required,checked:f,...l,...i,name:s.name,ref:d,onCheck:()=>s.onValueChange(i.value),onKeyDown:Ne(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:Ne(i.onFocus,()=>{var p;h.current&&((p=u.current)==null||p.click())})})})});Zz.displayName=Jz;var Que="RadioGroupIndicator",eV=y.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...r}=t,i=Qz(n);return a.jsx(Wz,{...i,...r,ref:e})});eV.displayName=Que;var tV=Xz,nV=Zz,Xue=eV;const MA=y.forwardRef(({className:t,...e},n)=>a.jsx(tV,{className:Pe("grid gap-2",t),...e,ref:n}));MA.displayName=tV.displayName;const Qh=y.forwardRef(({className:t,...e},n)=>a.jsx(nV,{ref:n,className:Pe("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:a.jsx(Xue,{className:"flex items-center justify-center",children:a.jsx(DE,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Qh.displayName=nV.displayName;var VT="Checkbox",[Jue,xFe]=Ui(VT),[Zue,ede]=Jue(VT),rV=y.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:s,required:o,disabled:c,value:l="on",onCheckedChange:u,form:d,...f}=t,[h,p]=y.useState(null),g=Pt(e,S=>p(S)),m=y.useRef(!1),v=h?d||!!h.closest("form"):!0,[b=!1,x]=lo({prop:i,defaultProp:s,onChange:u}),w=y.useRef(b);return y.useEffect(()=>{const S=h==null?void 0:h.form;if(S){const C=()=>x(w.current);return S.addEventListener("reset",C),()=>S.removeEventListener("reset",C)}},[h,x]),a.jsxs(Zue,{scope:n,state:b,disabled:c,children:[a.jsx(it.button,{type:"button",role:"checkbox","aria-checked":Hc(b)?"mixed":b,"aria-required":o,"data-state":oV(b),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:g,onKeyDown:Ne(t.onKeyDown,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Ne(t.onClick,S=>{x(C=>Hc(C)?!0:!C),v&&(m.current=S.isPropagationStopped(),m.current||S.stopPropagation())})}),v&&a.jsx(tde,{control:h,bubbles:!m.current,name:r,value:l,checked:b,required:o,disabled:c,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Hc(s)?!1:s})]})});rV.displayName=VT;var iV="CheckboxIndicator",sV=y.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...i}=t,s=ede(iV,n);return a.jsx(Yr,{present:r||Hc(s.state)||s.state===!0,children:a.jsx(it.span,{"data-state":oV(s.state),"data-disabled":s.disabled?"":void 0,...i,ref:e,style:{pointerEvents:"none",...t.style}})})});sV.displayName=iV;var tde=t=>{const{control:e,checked:n,bubbles:r=!0,defaultChecked:i,...s}=t,o=y.useRef(null),c=Cg(n),l=gg(e);y.useEffect(()=>{const d=o.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==n&&p){const g=new Event("click",{bubbles:r});d.indeterminate=Hc(n),p.call(d,Hc(n)?!1:n),d.dispatchEvent(g)}},[c,n,r]);const u=y.useRef(Hc(n)?!1:n);return a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...s,tabIndex:-1,ref:o,style:{...t.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Hc(t){return t==="indeterminate"}function oV(t){return Hc(t)?"indeterminate":t?"checked":"unchecked"}var aV=rV,nde=sV;const Fl=y.forwardRef(({className:t,...e},n)=>a.jsx(aV,{ref:n,className:Pe("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:a.jsx(nde,{className:Pe("flex items-center justify-center text-current"),children:a.jsx(uo,{className:"h-4 w-4"})})}));Fl.displayName=aV.displayName;const GT=({isActive:t,isComplete:e,hasError:n,label:r,onComplete:i,className:s})=>{const[o,c]=y.useState(0),[l,u]=y.useState("progressing"),[d,f]=y.useState(!1),h=y.useRef(null),p=y.useRef(null),g=()=>{h.current&&(clearInterval(h.current),h.current=null),p.current&&(clearTimeout(p.current),p.current=null)},m=()=>{g(),c(0),u("progressing"),f(!1)},v=S=>{g(),u("completing");const C=100-S,_=50,A=500/_,j=C/A;let T=0;h.current=setInterval(()=>{T++;const k=S+j*T;k>=100||T>=A?(c(100),u("completed"),g(),p.current=setTimeout(()=>{u("hiding"),setTimeout(()=>{m(),i==null||i()},300)},2e3)):c(k)},_)},b=()=>{l==="progressing"&&v(o)},x=()=>{l==="waiting"&&v(90)},w=()=>{g()};return y.useEffect(()=>{if(t&&!d){f(!0),c(0),u("progressing");const S=90/540;let C=0;h.current=setInterval(()=>{C+=S,C>=90?(c(90),u("waiting"),g()):c(C)},100)}return e&&l==="progressing"&&b(),e&&l==="waiting"&&x(),n&&(l==="progressing"||l==="waiting")&&w(),!t&&d&&m(),()=>{t||g()}},[t,e,n,l,d]),y.useEffect(()=>()=>{g()},[]),d?a.jsxs("div",{className:Pe("w-full space-y-2",s),children:[r&&a.jsxs("div",{className:"flex justify-between items-center text-sm text-muted-foreground",children:[a.jsx("span",{children:l==="waiting"?`${r} - finalizing...`:r}),a.jsxs("span",{children:[Math.round(o),"%"]})]}),a.jsx($l,{value:o,className:Pe("w-full transition-all duration-200",n&&"opacity-75",l==="completed"&&"bg-green-100")}),n&&a.jsx("div",{className:"text-sm text-red-600",children:"Generation failed. Please try again."}),l==="completed"&&!n&&a.jsx("div",{className:"text-sm text-green-600",children:"Generation completed successfully!"})]}):null},rr="all",rde=()=>{var Je,fn,Is,ra;const t=y.useCallback(()=>{document.body.style.pointerEvents==="none"&&(console.log("ensureBodyInteractive: Fixing body pointer-events..."),document.body.style.pointerEvents="auto")},[]),e=lr(),[n]=FJ(),{loadPersonas:r}=E6(),[i,s]=y.useState("view"),[o,c]=y.useState("ai"),[l,u]=y.useState("");y.useState(null);const[d,f]=y.useState(rr),[h,p]=y.useState(!1),[g,m]=y.useState("");y.useEffect(()=>{const W=n.get("mode");(W==="view"||W==="create")&&s(W)},[n]);const[v,b]=y.useState([]),[x,w]=y.useState([]),[S,C]=y.useState(!0);y.useState(null);const[_,A]=y.useState(new Set),[j,T]=y.useState(!1),[k,I]=y.useState(null),[E,O]=y.useState(""),[M,U]=y.useState(!1),[D,B]=y.useState(null),[R,L]=y.useState(!1),[Y,q]=y.useState(null),[J,me]=y.useState(!1),[F,oe]=y.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[se,le]=y.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[ke,ue]=y.useState(!1),[we,Ae]=y.useState(!1),[ee,wt]=y.useState(!1),[et,Ct]=y.useState(!1),[Xe,nn]=y.useState("gemini-2.5-pro"),N=()=>{ue(!1),Ae(!1),wt(!1)},$=W=>{const Ie={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return W.forEach(Ve=>{if(Ve.age&&Ie.age.add(Ve.age),Ve.gender&&Ie.gender.add(Ve.gender),Ve.occupation&&Ie.occupation.add(Ve.occupation),Ve.location&&Ie.location.add(Ve.location),Ve.techSavviness!==void 0){const ut=Ve.techSavviness<30?"Low (0-30)":Ve.techSavviness<70?"Medium (31-70)":"High (71-100)";Ie.techSavviness.add(ut)}Ve.ethnicity&&Ie.ethnicity.add(Ve.ethnicity)}),{age:Array.from(Ie.age).sort(),gender:Array.from(Ie.gender).sort(),occupation:Array.from(Ie.occupation).sort(),location:Array.from(Ie.location).sort(),techSavviness:Array.from(Ie.techSavviness).sort((Ve,ut)=>{const tt=["Low (0-30)","Medium (31-70)","High (71-100)"];return tt.indexOf(Ve)-tt.indexOf(ut)}),ethnicity:Array.from(Ie.ethnicity).sort()}},z=()=>{me(!1),setTimeout(()=>{oe({...se})},0)},G=()=>{le({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]})},Q=(W,Ie)=>{le(Ve=>{const ut={...Ve};return ut[W].includes(Ie)?ut[W]=ut[W].filter(tt=>tt!==Ie):ut[W]=[...ut[W],Ie],ut})},H=async()=>{try{const Ve=(await Po.getAll()).data.map(ut=>({...ut,id:ut._id}));return w(Ve),Ve}catch(W){return console.error("Error fetching folders:",W),Fe.error("Failed to load folders"),w([]),[]}},Z=async()=>{C(!0);try{const Ve=(await $r.getAll()).data;{const tt=[...Ve.map(St=>({...St,id:St.id||St._id}))];try{(async()=>{const on=await r();console.log("Loaded stored personas (for debugging only):",on?on.length:0)})()}catch(St){console.warn("Error loading stored personas:",St)}b(tt)}}catch(Ie){console.error("Error fetching personas:",Ie),Fe.error("Failed to load personas"),b([])}finally{C(!1)}};y.useEffect(()=>((async()=>{try{const[,]=await Promise.all([H(),Z()])}catch(Ie){console.error("Error loading data:",Ie)}})(),()=>{}),[t]),y.useEffect(()=>{var W;if(i==="view")Z();else if(i==="create"&&(console.log(`Switching to create mode with folder: ${d}, ${d!==rr?"NOT default":"IS default"}`),d!==rr)){const Ie=(W=x.find(Ve=>Ve.id===d))==null?void 0:W.name;console.log(`Selected folder for creation: ${d} (${Ie})`)}},[i]),y.useEffect(()=>{Z();const W=()=>{window.location.pathname.includes("/synthetic-users")&&!window.location.pathname.includes("/synthetic-users/")&&(console.log("Navigation to synthetic users page detected, refreshing data"),Z())},Ie=()=>{console.log("Synthetic users navigation event detected, refreshing data"),Z()};console.log("Setting up MutationObserver for body style");const Ve=new MutationObserver(ut=>{ut.forEach(tt=>{tt.type==="attributes"&&tt.attributeName==="style"&&document.body.style.pointerEvents==="none"&&(console.log("MutationObserver detected pointer-events: none, fixing..."),t())})});return Ve.observe(document.body,{attributes:!0,attributeFilter:["style"]}),t(),window.addEventListener("popstate",W),window.addEventListener("syntheticUsersNavigation",Ie),()=>{window.removeEventListener("popstate",W),window.removeEventListener("syntheticUsersNavigation",Ie),console.log("Disconnecting MutationObserver"),Ve.disconnect()}},[]);const he=async()=>{if(!g.trim()){Fe.error("Please enter a folder name");return}try{const W=await Po.create({name:g.trim(),persona_ids:[]});await H(),m(""),p(!1),Fe.success(`Folder "${g}" created`)}catch(W){console.error("Error creating folder:",W),Fe.error("Failed to create folder")}},xe=()=>{m(""),p(!1)},Oe=W=>{I(W),O(W.name)},be=async()=>{if(!k||!E.trim()){I(null);return}try{await Po.update(k._id,{name:E.trim()}),await H(),I(null),Fe.success(`Folder renamed to "${E}"`)}catch(W){console.error("Error renaming folder:",W),Fe.error("Failed to rename folder"),I(null)}},We=()=>{I(null),O("")},ot=W=>{B(W),U(!0)},Rt=async()=>{if(D)try{await Po.delete(D._id),await H(),(d===D._id||d===D.id)&&f(rr),U(!1),B(null),Fe.success(`Folder "${D.name}" deleted`)}catch(W){console.error("Error deleting folder:",W),Fe.error("Failed to delete folder")}},Ke=async(W,Ie)=>{var on;const Ve=W||_,ut=Ie||Y;if(!ut||Ve.size===0)return;const tt=Array.from(Ve),St=tt.map(dt=>{const _n=v.find(an=>an.id===dt);return(_n==null?void 0:_n._id)||(_n==null?void 0:_n.id)||dt}).filter(Boolean);try{const dt=[],_n=[];if(ut!==rr)try{await Po.addPersonasBatch(ut,St),dt.push(...tt)}catch(rn){console.error("Error adding personas to folder:",rn),_n.push(...tt)}else dt.push(...tt);await Promise.all([H(),Z()]);const an=ut===rr?"All Personas":((on=x.find(rn=>rn._id===ut||rn.id===ut))==null?void 0:on.name)||"folder";return dt.length>0&&Fe.success(`Added ${dt.length} persona${dt.length!==1?"s":""} to ${an}`),_n.length>0&&Fe.error(`Failed to add ${_n.length} persona${_n.length!==1?"s":""} to ${an}.`),W||A(new Set),{success:dt.length>0,successCount:dt.length,failureCount:_n.length}}catch(dt){return console.error("Error moving personas to folder:",dt),Fe.error("An unexpected error occurred while adding personas to folder."),{success:!1,error:dt}}},Ze=async()=>{var Ve,ut,tt;if(_.size===0||d===rr)return;const W=Array.from(_),Ie=W.map(St=>{const on=v.find(dt=>dt.id===St);return(on==null?void 0:on._id)||(on==null?void 0:on.id)||St}).filter(Boolean);console.log("Removing personas from folder:",{selectedFolder:d,selectedIds:W,mongoIds:Ie,folderName:(Ve=x.find(St=>St._id===d))==null?void 0:Ve.name});try{await Po.removePersonasBatch(d,Ie),await Promise.all([H(),Z()]);const St=((ut=x.find(on=>on._id===d))==null?void 0:ut.name)||"folder";Fe.success(`Removed ${W.length} persona${W.length!==1?"s":""} from ${St}`),A(new Set)}catch(St){console.error("Error removing personas from folder:",St),console.error("Error details:",((tt=St.response)==null?void 0:tt.data)||St.message),Fe.error("Failed to remove personas from folder")}},_t=W=>{A(Ie=>{const Ve=new Set(Ie);return Ve.has(W)?Ve.delete(W):Ve.add(W),Ve})},Kt=()=>{_.size===Xt.length?A(new Set):A(new Set(Xt.map(W=>W.id)))},Qn=async()=>{if(_.size===0)return;const W=Array.from(_);A(new Set),T(!1),C(!0);const Ie=[],Ve=[];for(const ut of W)try{const tt=v.find(on=>on.id===ut);if(!tt){console.error(`Could not find persona with id: ${ut}`),Ve.push(ut);continue}let St=ut;tt._id&&(St=tt._id.toString()),console.log(`Attempting to delete persona: ${St}`),await $r.delete(St),Ie.push(ut)}catch(tt){console.error(`Failed to delete persona ${ut}:`,tt),Ve.push(ut)}b(ut=>ut.filter(tt=>!Ie.includes(tt.id))),await H(),C(!1),setTimeout(()=>{Ie.length>0&&Fe.success(`Successfully deleted ${Ie.length} persona${Ie.length!==1?"s":""}`),Ve.length>0&&Fe.error(`Failed to delete ${Ve.length} persona${Ve.length!==1?"s":""}`),(Ie.length>0||Ve.length>0)&&Z()},50)},Xt=v.filter(W=>{const Ie=W.name.toLowerCase().includes(l.toLowerCase())||W.occupation.toLowerCase().includes(l.toLowerCase())||W.location.toLowerCase().includes(l.toLowerCase()),Ve=(F.age.length===0||F.age.includes(W.age))&&(F.gender.length===0||F.gender.includes(W.gender))&&(F.occupation.length===0||F.occupation.includes(W.occupation))&&(F.location.length===0||F.location.includes(W.location))&&(F.ethnicity.length===0||W.ethnicity&&F.ethnicity.includes(W.ethnicity))&&(F.techSavviness.length===0||W.techSavviness!==void 0&&F.techSavviness.includes(W.techSavviness<30?"Low (0-30)":W.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&(F.folderStatus.length===0||F.folderStatus.includes("hasFolder")&&F.folderStatus.includes("noFolder")||F.folderStatus.includes("hasFolder")&&!F.folderStatus.includes("noFolder")&&W.folderId&&W.folderId!==rr||F.folderStatus.includes("noFolder")&&!F.folderStatus.includes("hasFolder")&&(!W.folderId||W.folderId===rr));return d===rr||W.folder_ids&&Array.isArray(W.folder_ids)&&W.folder_ids.includes(d)||W.folder_id===d||W.folderId===d?Ie&&Ve:!1}),at=(W,Ie)=>{const Ve=new Date().toISOString().split("T")[0],ut=W.length;let tt=`# Persona Summary Report + +`;return tt+=`**Folder:** ${Ie} +`,tt+=`**Date:** ${Ve} +`,tt+=`**Total Personas:** ${ut} + +`,ut===0?(tt+=`No personas found in this folder. +`,tt):(W.forEach((St,on)=>{tt+=`## ${St.name} + +`,tt+=`### Demographics +`,tt+=`- **Age:** ${St.age} +`,tt+=`- **Gender:** ${St.gender} +`,tt+=`- **Occupation:** ${St.occupation} +`,tt+=`- **Location:** ${St.location} + +`,St.aiSynthesizedBio&&(tt+=`### AI-Synthesized Bio +`,tt+=`${St.aiSynthesizedBio} + +`),St.qualitativeAttributes&&St.qualitativeAttributes.length>0&&(tt+=`### Key Attributes +`,St.qualitativeAttributes.forEach(dt=>{tt+=`- šŸ·ļø ${dt} +`}),tt+=` +`),St.topPersonalityTraits&&St.topPersonalityTraits.length>0&&(tt+=`### Top Personality Traits +`,St.topPersonalityTraits.forEach(dt=>{tt+=`- 🧠 ${dt} +`}),tt+=` +`),on{if(Xt.length===0){Fe.error("No personas to download");return}Ct(!0)},st=async()=>{var Ve,ut,tt,St,on;const W=d===rr?"All Personas":((Ve=x.find(dt=>dt.id===d))==null?void 0:Ve.name)||"Unknown Folder",Ie=Xt.map(dt=>dt._id||dt.id);console.log(`šŸ¤– Frontend: User selected ${Xe} for persona summary download`),Ct(!1),ue(!0),Ae(!1),wt(!1),C(!0);try{Fe.info("Generating persona summaries...",{description:`Processing ${Xt.length} persona${Xt.length!==1?"s":""} with AI`});const dt=await da.batchGenerateSummaries(Ie,.7,Xe),{summaries:_n,summary_stats:an,errors:rn}=dt.data,yr=new Date().toISOString().split("T")[0],Rs=`persona-summary-${W.toLowerCase().replace(/\s+/g,"-")}-${yr}.md`;let Xn=`# Persona Summary Report + +`;Xn+=`**Folder:** ${W} +`,Xn+=`**Date:** ${yr} +`,Xn+=`**Total Personas:** ${an.total_requested} +`,Xn+=`**Successfully Processed:** ${an.total_successful} +`,an.total_failed>0&&(Xn+=`**Failed to Process:** ${an.total_failed} +`),Xn+=` +--- + +`,_n.length===0?Xn+=`No persona summaries could be generated. +`:_n.forEach((Ee,jt)=>{Xn+=`# ${Ee.persona_name} + +`,Xn+=`${Ee.summary} + +`,jt<_n.length-1&&(Xn+=`--- + +`)}),rn&&(((ut=rn.failed_summaries)==null?void 0:ut.length)>0||((tt=rn.missing_personas)==null?void 0:tt.length)>0)&&(Xn+=` +--- + +## Processing Errors + +`,((St=rn.failed_summaries)==null?void 0:St.length)>0&&(Xn+=`### Failed to Generate Summaries +`,rn.failed_summaries.forEach(Ee=>{Xn+=`- **${Ee.persona_name}** (ID: ${Ee.persona_id}): ${Ee.error} +`}),Xn+=` +`),((on=rn.missing_personas)==null?void 0:on.length)>0&&(Xn+=`### Missing Personas +`,rn.missing_personas.forEach(Ee=>{Xn+=`- ID: ${Ee} +`})));const V=document.createElement("a"),ve=new Blob([Xn],{type:"text/markdown"});V.href=URL.createObjectURL(ve),V.download=Rs,document.body.appendChild(V),V.click(),document.body.removeChild(V),Ae(!0);const de=Xe==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro";an.total_successful===an.total_requested?Fe.success("Persona summary downloaded",{description:`Successfully processed all ${an.total_successful} persona${an.total_successful!==1?"s":""} from "${W}" using ${de}`}):Fe.success("Persona summary downloaded with warnings",{description:`Processed ${an.total_successful} of ${an.total_requested} personas from "${W}" using ${de}`})}catch(dt){console.error("Error generating persona summaries:",dt),dt.response?(console.error("Error response data:",dt.response.data),console.error("Error response status:",dt.response.status),console.error("Error response headers:",dt.response.headers)):dt.request?console.error("Error request:",dt.request):console.error("Error message:",dt.message),wt(!0),Fe.error("AI summary generation failed, creating basic summary",{description:"Using simplified format due to processing error"});try{const _n=new Date().toISOString().split("T")[0],an=`persona-summary-basic-${W.toLowerCase().replace(/\s+/g,"-")}-${_n}.md`,rn=at(Xt,W),yr=document.createElement("a"),Rs=new Blob([rn],{type:"text/markdown"});yr.href=URL.createObjectURL(Rs),yr.download=an,document.body.appendChild(yr),yr.click(),document.body.removeChild(yr)}catch{Fe.error("Failed to create persona summary",{description:"Unable to generate summary in any format"})}}finally{C(!1)}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(ja,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:"Synthetic Personas"}),a.jsx("p",{className:"text-slate-600 mt-1",children:"Create and manage AI-generated research participants"})]}),a.jsx("div",{className:"mt-4 sm:mt-0 flex flex-col items-end gap-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[i==="view"&&Xt.length>0&&a.jsxs(X,{variant:"outline",onClick:Wt,disabled:ke,className:"flex items-center gap-2 hover-transition",children:[a.jsx(Jc,{className:"h-4 w-4"}),ke?"Generating Summary...":"Download Persona Summary"]}),a.jsx(X,{onClick:()=>s(i==="view"?"create":"view"),className:"hover-transition",children:i==="view"?"Create New Personas":"View All Personas"})]})})]}),i==="view"&&Xt.length>0&&ke&&a.jsx("div",{className:"mb-6",children:a.jsx(GT,{isActive:ke,isComplete:we,hasError:ee,label:"Generating comprehensive persona summaries",onComplete:N,className:"max-w-4xl mx-auto"})}),i==="view"?a.jsx(a.Fragment,{children:a.jsxs("div",{className:"flex flex-col md:flex-row gap-6 mb-6",children:[a.jsxs("div",{className:"w-full md:w-64 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium",children:"Folders"}),a.jsx(X,{variant:"ghost",size:"sm",onClick:()=>p(!0),className:"h-7 w-7 p-0",children:a.jsx(f5,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>f(rr),className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${d===rr?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(hs,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),x.map(W=>a.jsx("div",{className:"flex items-center justify-between group",children:k&&k._id===W._id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(hs,{className:"h-4 w-4"}),a.jsx(Ht,{value:E,onChange:Ie=>O(Ie.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:Ie=>{Ie.key==="Enter"?be():Ie.key==="Escape"&&We()}}),a.jsx(X,{size:"sm",variant:"ghost",onClick:be,className:"h-7 w-7 p-0",children:a.jsx(uo,{className:"h-4 w-4"})}),a.jsx(X,{size:"sm",variant:"ghost",onClick:We,className:"h-7 w-7 p-0",children:a.jsx(Mi,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>f(W._id),className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${d===W._id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(hs,{className:"h-4 w-4"}),a.jsx("span",{children:W.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:v.filter(Ie=>Ie.folder_ids&&Ie.folder_ids.includes(W._id)).length})]}),a.jsxs(OA,{children:[a.jsx(IA,{asChild:!0,children:a.jsx(X,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(z_,{className:"h-4 w-4"})})}),a.jsxs(Ix,{align:"end",children:[a.jsx(oc,{onClick:()=>Oe(W),children:"Rename"}),a.jsx(oc,{className:"text-red-600",onClick:()=>ot(W),children:"Delete"})]})]})]})},W._id)),h&&a.jsxs("div",{className:"flex items-center px-3 py-2 space-x-2",children:[a.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[a.jsx(hs,{className:"h-4 w-4"}),a.jsx(Ht,{value:g,onChange:W=>m(W.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:W=>{W.key==="Enter"?he():W.key==="Escape"&&xe()}})]}),a.jsx(X,{size:"sm",variant:"ghost",onClick:he,className:"h-7 w-7 p-0",children:a.jsx(uo,{className:"h-4 w-4"})}),a.jsx(X,{size:"sm",variant:"ghost",onClick:xe,className:"h-7 w-7 p-0",children:a.jsx(Mi,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(FE,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Ht,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:l,onChange:W=>u(W.target.value)})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[_.size>0&&a.jsxs(OA,{children:[a.jsx(IA,{asChild:!0,children:a.jsxs(X,{variant:"outline",size:"sm",className:"flex items-center gap-2",onClick:W=>{W.stopPropagation()},children:[a.jsxs("span",{children:["Actions (",_.size,")"]}),a.jsx(z_,{className:"h-4 w-4"})]})}),a.jsxs(Ix,{align:"end",onCloseAutoFocus:W=>{W.preventDefault()},children:[a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:W=>{W.preventDefault(),W.stopPropagation();const Ie=Array.from(_);e("/focus-groups",{state:{mode:"create",preSelectedParticipants:Ie}})},children:[a.jsx(Wo,{className:"h-4 w-4"}),"Create Focus Group with selected Personas"]}),a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:W=>{W.preventDefault(),W.stopPropagation(),T(!0)},children:[a.jsx(ir,{className:"h-4 w-4"}),"Delete"]}),a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:W=>{W.preventDefault(),W.stopPropagation(),L(!0)},children:[a.jsx(hs,{className:"h-4 w-4"}),"Move to folder"]}),d!==rr&&a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:W=>{W.preventDefault(),W.stopPropagation(),Ze()},children:[a.jsx(Mi,{className:"h-4 w-4"}),"Remove from ",((Je=x.find(W=>W._id===d))==null?void 0:Je.name)||"folder"]})]})]}),a.jsxs(X,{variant:"outline",className:"flex items-center gap-2",onClick:()=>me(!0),children:[a.jsx($E,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(F).some(W=>W.length>0)?` (${Object.values(F).reduce((W,Ie)=>W+Ie.length,0)})`:""]})]})]})]}),a.jsxs("div",{className:"glass-panel rounded-xl p-6 mb-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Fr,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:d===rr?"Your Synthetic Persona Library":((fn=x.find(W=>W._id===d))==null?void 0:fn.name)||"Personas"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",Xt.length,")"]})]}),Xt.length>0&&a.jsxs("div",{className:"flex items-center",children:[a.jsx(Fl,{id:"select-all",checked:Xt.length>0&&_.size===Xt.length,onCheckedChange:Kt,className:"mr-2"}),a.jsx("label",{htmlFor:"select-all",className:"text-sm cursor-pointer",children:"Select All"})]})]}),Xt.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-1 lg:grid-cols-2 xl:grid-cols-2 gap-4",children:Xt.map(W=>a.jsx("div",{className:"relative group",children:a.jsx(pT,{user:W,selected:_.has(W.id),onClick:()=>e(`/synthetic-users/${W._id||W.id}`),onSelectionToggle:Ie=>{Ie.stopPropagation(),_t(W.id)},showAddToFolderButton:!1,folders:x})},W.id))}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No personas found matching your criteria."})})]}),a.jsx(RA,{open:j,onOpenChange:W=>{T(W||!1)},children:a.jsxs(Mx,{onInteractOutside:W=>{W.preventDefault()},children:[a.jsxs(Dx,{children:[a.jsx(Lx,{children:"Delete Personas"}),a.jsxs(Fx,{children:["Are you sure you want to delete ",_.size," selected persona",_.size!==1?"s":"","? This action cannot be undone."]})]}),a.jsxs($x,{children:[a.jsx(Bx,{onClick:()=>{setTimeout(()=>A(new Set),50)},children:"Cancel"}),a.jsx(Ux,{onClick:Qn,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(RA,{open:M,onOpenChange:W=>{U(W||!1)},children:a.jsxs(Mx,{children:[a.jsxs(Dx,{children:[a.jsx(Lx,{children:"Delete Folder"}),a.jsxs(Fx,{children:['Are you sure you want to delete the folder "',D==null?void 0:D.name,'"?',a.jsx("br",{}),a.jsx("br",{}),a.jsx("strong",{children:"Note:"})," Any personas in this folder will not be deleted - they will still be available under 'All Personas' after folder deletion."]})]}),a.jsxs($x,{children:[a.jsx(Bx,{children:"Cancel"}),a.jsx(Ux,{onClick:Rt,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(eu,{open:R,onOpenChange:W=>{L(W||!1)},children:a.jsxs(Lc,{className:"z-50",children:[a.jsxs(Fc,{children:[a.jsx(Bc,{children:"Move to Folder"}),a.jsxs(tu,{children:["Choose a folder to move ",_.size," selected persona",_.size!==1?"s":""," to."]})]}),a.jsx("div",{className:"py-4",children:a.jsxs(MA,{value:Y||"",onValueChange:q,className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:rr,id:"folder-all"}),a.jsxs(ms,{htmlFor:"folder-all",className:"flex items-center gap-2",children:[a.jsx(hs,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas (Remove from folders)"})]})]}),x.map(W=>a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:W._id,id:`folder-${W._id}`}),a.jsxs(ms,{htmlFor:`folder-${W._id}`,className:"flex items-center gap-2",children:[a.jsx(hs,{className:"h-4 w-4"}),a.jsx("span",{children:W.name})]})]},W._id))]})}),a.jsxs(Uc,{children:[a.jsx(X,{variant:"outline",onClick:W=>{W.preventDefault(),W.stopPropagation(),L(!1),q(null)},children:"Cancel"}),a.jsx(X,{onClick:async W=>{if(W.preventDefault(),W.stopPropagation(),!Y)return;const Ie=new Set(_),Ve=Y;if(L(!1),q(null),Ve&&Ie.size>0){C(!0);try{await Ke(Ie,Ve)}finally{C(!1),A(new Set)}}},disabled:!Y,children:"Move"})]})]})}),a.jsx(eu,{open:J,onOpenChange:W=>{W?(me(W),le({...F})):(_.size>0&&A(new Set),me(!1))},children:a.jsxs(Lc,{className:"max-w-4xl max-h-[80vh] flex flex-col",onInteractOutside:W=>{W.preventDefault()},children:[a.jsx("div",{className:"sticky top-0 bg-background border-b shadow-sm pb-4 z-10",children:a.jsxs(Fc,{children:[a.jsx(Bc,{children:"Filter Personas"}),a.jsx(tu,{children:"Select attributes to filter personas by. Multiple selections within a category use OR logic, different categories use AND logic. Filter options dynamically update to show only relevant values."})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-1 py-4 space-y-6",children:[Object.values(se).some(W=>W.length>0)&&a.jsx("div",{className:"bg-muted/30 p-3 rounded-md",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[Object.values(se).reduce((W,Ie)=>W+Ie.length,0)," active filters"]})}),a.jsx("div",{className:"space-y-4",children:(()=>{const W=tt=>{const St={...se};St[tt]=[];const on=v.filter(dt=>Object.entries(St).every(([_n,an])=>{if(an.length===0)return!0;const rn=_n;if(rn==="techSavviness"&&dt.techSavviness!==void 0){const yr=dt.techSavviness<30?"Low (0-30)":dt.techSavviness<70?"Medium (31-70)":"High (71-100)";return an.includes(yr)}else{if(rn==="age"&&dt.age)return an.includes(dt.age);if(rn==="gender"&&dt.gender)return an.includes(dt.gender);if(rn==="occupation"&&dt.occupation)return an.includes(dt.occupation);if(rn==="location"&&dt.location)return an.includes(dt.location);if(rn==="ethnicity"&&dt.ethnicity)return an.includes(dt.ethnicity)}return!0}));return $(on)},Ie=Object.values(se).every(tt=>tt.length===0),Ve=$(v),ut=(tt,St,on,dt=1)=>{const _n=se[St],an=[...new Set([...on,..._n])].sort();return an.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:tt}),a.jsx("div",{className:`grid grid-cols-1 ${dt===2?"sm:grid-cols-2":dt===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:an.map(rn=>{const yr=se[St].includes(rn),Rs=on.includes(rn);return a.jsxs("div",{className:`flex items-center space-x-2 ${!Rs&&!yr?"opacity-50":""}`,children:[a.jsx(Fl,{id:`${St}-${rn}`,checked:yr,onCheckedChange:()=>Q(St,rn),disabled:!Rs&&!yr}),a.jsxs(ms,{htmlFor:`${St}-${rn}`,className:"truncate overflow-hidden",children:[rn,yr&&!Rs&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},rn)})})]})};return a.jsxs(a.Fragment,{children:[ut("Gender","gender",Ie?Ve.gender:W("gender").gender,3),ut("Age","age",Ie?Ve.age:W("age").age,3),ut("Ethnicity","ethnicity",Ie?Ve.ethnicity:W("ethnicity").ethnicity,2),ut("Location","location",Ie?Ve.location:W("location").location,2),ut("Occupation","occupation",Ie?Ve.occupation:W("occupation").occupation,2),ut("Tech Savviness","techSavviness",Ie?Ve.techSavviness:W("techSavviness").techSavviness,3),a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:"Folder Assignment"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Fl,{id:"folderStatus-hasFolder",checked:se.folderStatus.includes("hasFolder"),onCheckedChange:()=>Q("folderStatus","hasFolder")}),a.jsx(ms,{htmlFor:"folderStatus-hasFolder",className:"truncate overflow-hidden",children:"Has folder assignment"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Fl,{id:"folderStatus-noFolder",checked:se.folderStatus.includes("noFolder"),onCheckedChange:()=>Q("folderStatus","noFolder")}),a.jsx(ms,{htmlFor:"folderStatus-noFolder",className:"truncate overflow-hidden",children:"No folder assignment"})]})]})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()})]}),a.jsx("div",{className:"sticky bottom-0 bg-background border-t shadow-[0_-2px_4px_rgba(0,0,0,0.05)] pt-4 z-10",children:a.jsxs(Uc,{children:[a.jsx(X,{variant:"outline",onClick:G,children:"Reset"}),a.jsx(X,{onClick:z,children:"Apply Filters"})]})})]})}),a.jsx(eu,{open:et,onOpenChange:Ct,children:a.jsxs(Lc,{children:[a.jsxs(Fc,{children:[a.jsx(Bc,{children:"Select AI Model for Summary Generation"}),a.jsx(tu,{children:"Choose which AI model to use for generating persona summaries"})]}),a.jsx("div",{className:"py-4",children:a.jsxs(MA,{value:Xe,onValueChange:nn,className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:"gemini-2.5-pro",id:"download-gemini"}),a.jsx(ms,{htmlFor:"download-gemini",className:"text-sm font-medium",children:"Gemini 2.5 Pro"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:"gpt-4.1",id:"download-gpt"}),a.jsx(ms,{htmlFor:"download-gpt",className:"text-sm font-medium",children:"GPT-4.1"})]})]})}),a.jsxs(Uc,{children:[a.jsx(X,{variant:"outline",onClick:()=>Ct(!1),children:"Cancel"}),a.jsx(X,{onClick:st,children:"Generate Summary"})]})]})})]})]})}):a.jsxs(hl,{defaultValue:"ai",onValueChange:W=>c(W),children:[a.jsxs(Ka,{className:"grid w-full grid-cols-2 mb-6",children:[a.jsx(gn,{value:"ai",children:"AI Recruiter"}),a.jsx(gn,{value:"manual",children:"Manual Creation"})]}),a.jsxs(vn,{value:"ai",children:[console.log(`Rendering AIRecruiter with targetFolderId: ${d!==rr?d:"null"}`),console.log("Current folders:",x.map(W=>({id:W.id,name:W.name}))),a.jsx(pce,{targetFolderId:d!==rr?d:null,targetFolderName:d!==rr?(Is=x.find(W=>W.id===d))==null?void 0:Is.name:null})]}),a.jsx(vn,{value:"manual",children:a.jsx(ile,{targetFolderId:d!==rr?d:null,targetFolderName:d!==rr?(ra=x.find(W=>W.id===d))==null?void 0:ra.name:null})})]})]})]})},cV=y.createContext(void 0),nC="synthetic-society-navigation-state",ide=({children:t})=>{const[e,n]=y.useState(()=>{try{const s=localStorage.getItem(nC);return s?JSON.parse(s):{}}catch{return{}}});y.useEffect(()=>{localStorage.setItem(nC,JSON.stringify(e))},[e]);const r=(s,o)=>{n({...e,previousRoute:s,...o})},i=()=>{n({}),localStorage.removeItem(nC)};return a.jsx(cV.Provider,{value:{navigationState:e,setNavigationState:n,clearNavigationState:i,setPreviousRoute:r},children:t})},ow=()=>{const t=y.useContext(cV);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t},sde=ZN("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function _r({className:t,variant:e,...n}){return a.jsx("div",{className:Pe(sde({variant:e}),t),...n})}const KT=P.memo(t=>{const{discussionGuide:e,moderatorStatus:n,onSectionSelect:r,onSetPosition:i,onSave:s,showProgress:o=!0,collapsible:c=!0,defaultExpanded:l=!1,className:u,onDownload:d,isDownloading:f=!1,focusGroupId:h,onEditingChange:p}=t,g=typeof e=="string",m=y.useMemo(()=>g?null:e,[e,g]),[v,b]=y.useState(new Set),[x,w]=y.useState(null),[S,C]=y.useState(null),[_,A]=y.useState(!1),[j,T]=y.useState(null),[k,I]=y.useState("");y.useEffect(()=>{p&&p(!!x)},[x,p]),y.useEffect(()=>{if(x&&m){const N=m.sections.find($=>$.id===x);N&&!S&&C({...N})}},[m,x,S]);const E=N=>{w(N.id),C({...N}),b($=>new Set($).add(N.id))},O=()=>{w(null),C(null)},M=y.useCallback(N=>{C($=>$&&{...$,...N})},[]),U=y.useCallback((N,$,z)=>{C(G=>{if(!G)return G;const Q={...G};if(z==="question"&&Q.questions){if(Q.questions.findIndex(Z=>Z.id===N)!==-1)return Q.questions=Q.questions.map(Z=>Z.id===N?{...Z,...$}:Z),Q}else if(z==="activity"&&Q.activities&&Q.activities.findIndex(Z=>Z.id===N)!==-1)return Q.activities=Q.activities.map(Z=>Z.id===N?{...Z,...$}:Z),Q;return Q.subsections&&(Q.subsections=Q.subsections.map(H=>{const Z={...H};return z==="question"&&Z.questions?Z.questions.findIndex(xe=>xe.id===N)!==-1&&(Z.questions=Z.questions.map(xe=>xe.id===N?{...xe,...$}:xe)):z==="activity"&&Z.activities&&Z.activities.findIndex(xe=>xe.id===N)!==-1&&(Z.activities=Z.activities.map(xe=>xe.id===N?{...xe,...$}:xe)),Z})),Q})},[]),D=N=>{if(!S)return;const $={id:`${N}-${Date.now()}`,content:`New ${N}`,type:N==="question"?"open_ended":"discussion",time_limit:void 0},z={...S};N==="question"?z.questions=[...z.questions||[],$]:z.activities=[...z.activities||[],$],C(z)},B=(N,$)=>{if(!S||!S.subsections)return;const z={id:`${$}-${Date.now()}`,content:`New ${$}`,type:$==="question"?"open_ended":"discussion",time_limit:void 0},G=[...S.subsections],Q={...G[N]};$==="question"?Q.questions=[...Q.questions||[],z]:Q.activities=[...Q.activities||[],z],G[N]=Q,C(H=>H&&{...H,subsections:G})},R=()=>{if(!S)return;const N={id:`subsection-${Date.now()}`,title:"New Subsection",questions:[],activities:[]},$=[...S.subsections||[],N];C(z=>z&&{...z,subsections:$})},L=N=>{if(!S||!S.subsections)return;const $=S.subsections.filter((z,G)=>G!==N);C(z=>z&&{...z,subsections:$})},Y=(N,$)=>{var G,Q;if(!S)return;const z={...S};$==="question"?z.questions=(G=z.questions)==null?void 0:G.filter(H=>H.id!==N):z.activities=(Q=z.activities)==null?void 0:Q.filter(H=>H.id!==N),C(z)},q=async()=>{if(!(!S||!m||!s)){A(!0);try{const N={...m,sections:m.sections.map($=>$.id===x?S:$)};await s(N),O(),ne.success("Section updated successfully")}catch(N){console.error("Error saving section:",N),ne.error("Failed to save section")}finally{A(!1)}}},J=N=>{b($=>{const z=new Set($);return z.has(N)?z.delete(N):z.add(N),z})};y.useEffect(()=>{m&&m.sections.length>0&&b(l?new Set(m.sections.map(N=>N.id)):new Set)},[l,m]);const me=(N,$,z,G)=>{if(!n||n.legacy_format)return null;const Q=n.moderator_position;if(Q.section_index!==N)return Q.section_index>N?"completed":null;if(G!==void 0){if(Q.subsection_index===void 0)return null;if(Q.subsection_index!==G)return Q.subsection_index>G?"completed":null}else if(Q.subsection_index!==void 0)return"completed";return Q.item_type!==z?z==="activity"&&Q.item_type==="question"?"completed":null:Q.item_index===$?"current":Q.item_index>$?"completed":null},F=(N,$)=>N===`New ${$}`,oe=y.useCallback((N,$,z)=>{if($<0||$>=N.length||z<0||z>=N.length)return N;const G=[...N],[Q]=G.splice($,1);return G.splice(z,0,Q),G},[]),se=y.useCallback((N,$)=>$>0,[]),le=y.useCallback((N,$)=>${if(!S||!S.subsections)return;const $=S.subsections;if(se($,N)){const z=oe($,N,N-1);C(G=>G&&{...G,subsections:z})}},[S,se,oe]),ue=y.useCallback(N=>{if(!S||!S.subsections)return;const $=S.subsections;if(le($,N)){const z=oe($,N,N+1);C(G=>G&&{...G,subsections:z})}},[S,le,oe]),we=y.useCallback((N,$)=>{T(N),I($)},[]),Ae=y.useCallback(()=>{T(null),I("")},[]),ee=y.useCallback(()=>{if(!j||!S||!S.subsections)return;const N=S.subsections.map($=>$.id===j?{...$,title:k.trim()}:$);C($=>$&&{...$,subsections:N}),Ae()},[j,S,k,Ae]),wt=y.useCallback((N,$,z,G)=>{if(!S)return;const Q=$==="question"?"questions":"activities";if(G!==void 0){const H=S.subsections||[];if(G>=0&&Gbe&&{...be,subsections:Oe})}}}else{const H=S[Q]||[];if(se(H,z)){const Z=oe(H,z,z-1);C(he=>he&&{...he,[Q]:Z})}}},[S,se,oe]),et=y.useCallback((N,$,z,G)=>{if(!S)return;const Q=$==="question"?"questions":"activities";if(G!==void 0){const H=S.subsections||[];if(G>=0&&Gbe&&{...be,subsections:Oe})}}}else{const H=S[Q]||[];if(le(H,z)){const Z=oe(H,z,z+1);C(he=>he&&{...he,[Q]:Z})}}},[S,le,oe]),Ct=(N,$,z,G,Q)=>{var Rt,Ke,Ze,_t,Kt,Qn,Xt,at,Wt;const H=m==null?void 0:m.sections[$],Z=x===(H==null?void 0:H.id),he=me($,z,G,Q),xe=he==="current",Oe=he==="completed",We=(st=>{var Je,fn;return((fn=(Je=st.metadata)==null?void 0:Je.visual_asset)==null?void 0:fn.filename)||null})(N),ot=F(N.content,G);return Z?a.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-white border-blue-200",children:[a.jsxs("div",{className:"flex-shrink-0 flex flex-col gap-1",children:[a.jsx(X,{size:"sm",variant:"ghost",onClick:()=>wt(N.id,G,z,Q),disabled:(()=>{if(Q!==void 0){const Je=((S==null?void 0:S.subsections)||[])[Q],fn=(Je==null?void 0:Je[G==="question"?"questions":"activities"])||[];return!se(fn,z)}else{const st=(S==null?void 0:S[G==="question"?"questions":"activities"])||[];return!se(st,z)}})(),className:"h-6 w-6 p-0",title:"Move item up",children:a.jsx(fu,{className:"h-3 w-3"})}),a.jsx(X,{size:"sm",variant:"ghost",onClick:()=>et(N.id,G,z,Q),disabled:(()=>{if(Q!==void 0){const Je=((S==null?void 0:S.subsections)||[])[Q],fn=(Je==null?void 0:Je[G==="question"?"questions":"activities"])||[];return!le(fn,z)}else{const st=(S==null?void 0:S[G==="question"?"questions":"activities"])||[];return!le(st,z)}})(),className:"h-6 w-6 p-0",title:"Move item down",children:a.jsx(Da,{className:"h-3 w-3"})})]}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_r,{variant:"outline",className:"text-xs",children:G==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(ma,{className:"h-3 w-3 mr-1"}),typeof N.type=="string"?N.type.replace("_"," "):String(N.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(To,{className:"h-3 w-3 mr-1"}),typeof N.type=="string"?N.type.replace("_"," "):String(N.type||"unknown")]})}),N.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500",children:[a.jsx(qp,{className:"h-3 w-3"}),a.jsx(Ht,{type:"number",value:N.time_limit,onChange:st=>U(N.id,{time_limit:parseInt(st.target.value)||void 0},G),className:"w-16 h-6 text-xs",placeholder:"min"}),"min"]})]}),a.jsx(ht,{value:ot?"":N.content,onChange:st=>U(N.id,{content:st.target.value},G),placeholder:ot?N.content:"Enter content...",className:"min-h-[60px]"}),G==="question"&&a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Probe Questions (one per line)"}),a.jsx(ht,{value:((Rt=N.probes)==null?void 0:Rt.join(` +`))||"",onChange:st=>{const Je=st.target.value.trim()?st.target.value.split(` +`).filter(fn=>fn.trim()):[];U(N.id,{probes:Je},G)},placeholder:"Enter probe questions, one per line...",className:"min-h-[40px]"})]}),(((Ke=N.metadata)==null?void 0:Ke.image_url)||((Ze=N.metadata)==null?void 0:Ze.image_id)||We)&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(cp,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),(_t=N.metadata)!=null&&_t.image_url?a.jsx("img",{src:N.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(Kt=N.metadata)!=null&&Kt.image_id&&h?a.jsx("img",{src:bt.getAssetUrl(h,N.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):We&&h?a.jsx("img",{src:bt.getAssetUrl(h,We),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]}),a.jsx("div",{className:"flex-shrink-0",children:a.jsx(X,{size:"sm",variant:"ghost",onClick:()=>Y(N.id,G),className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:a.jsx(ir,{className:"h-3 w-3"})})})]},`edit-item-${N.id}`):a.jsxs("div",{className:Pe("flex items-start gap-3 p-3 rounded-lg border transition-colors",xe&&"bg-blue-50 border-blue-200",Oe&&"bg-green-50 border-green-200",!xe&&!Oe&&"bg-slate-50 border-slate-200",r&&"cursor-pointer hover:bg-slate-100"),onClick:()=>r==null?void 0:r(m.sections[$].id,N.id),children:[a.jsx("div",{className:"flex-shrink-0 mt-1",children:Oe?a.jsx(ME,{className:"h-4 w-4 text-green-600"}):xe?a.jsx(d5,{className:"h-4 w-4 text-blue-600"}):a.jsx(DE,{className:"h-4 w-4 text-slate-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[a.jsx(_r,{variant:"outline",className:"text-xs whitespace-nowrap",children:G==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(ma,{className:"h-3 w-3 mr-1"}),typeof N.type=="string"?N.type.replace("_"," "):String(N.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(To,{className:"h-3 w-3 mr-1"}),typeof N.type=="string"?N.type.replace("_"," "):String(N.type||"unknown")]})}),N.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500 whitespace-nowrap",children:[a.jsx(qp,{className:"h-3 w-3"}),N.time_limit," min"]}),i&&a.jsxs(X,{size:"sm",variant:"ghost",onClick:st=>{st.stopPropagation();const Je=m.sections[$],fn=G==="activity"?`Activity ${z+1}`:`Question ${z+1}`;i(Je.id,N.id,N.content,Je.title,fn,G,N.metadata)},className:"h-6 px-2 ml-auto",children:[a.jsx(Xv,{className:"h-3 w-3 mr-1"}),"Set Position"]})]}),a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:N.content}),N.probes&&N.probes.length>0&&a.jsxs("div",{className:"mt-2 pl-4 border-l-2 border-slate-200",children:[a.jsx("p",{className:"text-xs font-medium text-slate-600 mb-1",children:"Probe Questions:"}),a.jsx("ul",{className:"space-y-1",children:N.probes.map((st,Je)=>a.jsxs("li",{className:"text-xs text-slate-600",children:["• ",st]},Je))})]}),(((Qn=N.metadata)==null?void 0:Qn.image_url)||((Xt=N.metadata)==null?void 0:Xt.image_id)||We)&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(cp,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),(at=N.metadata)!=null&&at.image_url?a.jsx("img",{src:N.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(Wt=N.metadata)!=null&&Wt.image_id&&h?a.jsx("img",{src:bt.getAssetUrl(h,N.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):We&&h?a.jsx("img",{src:bt.getAssetUrl(h,We),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},N.id)},Xe=(N,$)=>{var Z,he,xe,Oe;const z=v.has(N.id),G=x===N.id,Q=G?S:N,H=(n==null?void 0:n.moderator_position.section_index)===$;return a.jsxs("div",{className:Pe("border rounded-lg overflow-hidden transition-colors",H&&"border-blue-500 shadow-md",!H&&"border-slate-200"),children:[a.jsxs("div",{className:Pe("px-4 py-3 flex items-center justify-between cursor-pointer hover:bg-slate-50 transition-colors",H&&"bg-blue-50"),onClick:()=>!G&&J(N.id),children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"transition-transform",style:{transform:z?"rotate(90deg)":"rotate(0deg)"},children:a.jsx(fs,{className:"h-5 w-5 text-slate-500"})}),a.jsx("h3",{className:"font-semibold text-slate-800",children:G?a.jsx(Ht,{value:Q.title,onChange:be=>M({title:be.target.value}),onClick:be=>be.stopPropagation(),className:"font-semibold"}):Q.title}),H&&a.jsx(_r,{variant:"default",className:"text-xs",children:"Current"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[s&&!G&&a.jsx(X,{size:"sm",variant:"ghost",onClick:be=>{be.stopPropagation(),E(N)},className:"h-8 px-2",children:a.jsx(K_,{className:"h-3 w-3"})}),G&&a.jsxs("div",{className:"flex items-center gap-2",onClick:be=>be.stopPropagation(),children:[a.jsxs(X,{size:"sm",variant:"default",onClick:q,disabled:_,className:"h-8",children:[_?a.jsx(eo,{className:"h-3 w-3 animate-spin"}):a.jsx(LE,{className:"h-3 w-3"}),a.jsx("span",{className:"ml-1",children:"Save"})]}),a.jsxs(X,{size:"sm",variant:"ghost",onClick:O,disabled:_,className:"h-8",children:[a.jsx(Mi,{className:"h-3 w-3"}),a.jsx("span",{className:"ml-1",children:"Cancel"})]})]})]})]}),z&&a.jsxs("div",{className:"px-4 py-3 border-t border-slate-200 space-y-4",children:[Q.content&&a.jsx("div",{className:"prose prose-sm max-w-none",children:G?a.jsx(ht,{value:Q.content,onChange:be=>M({content:be.target.value}),placeholder:"Section introduction or context...",className:"min-h-[80px] w-full"}):a.jsx("p",{className:"text-slate-700",children:Q.content})}),Q.activities&&Q.activities.length>0||G?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(ma,{className:"h-4 w-4"}),"Activities"]}),G&&a.jsxs(X,{size:"sm",variant:"outline",onClick:()=>D("activity"),className:"h-7",children:[a.jsx(ma,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx("div",{className:"space-y-2",children:(Z=Q.activities)==null?void 0:Z.map((be,We)=>Ct(be,$,We,"activity"))})]}):null,Q.questions&&Q.questions.length>0||G?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(To,{className:"h-4 w-4"}),"Questions"]}),G&&a.jsxs(X,{size:"sm",variant:"outline",onClick:()=>D("question"),className:"h-7",children:[a.jsx(To,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx("div",{className:"space-y-2",children:(he=Q.questions)==null?void 0:he.map((be,We)=>Ct(be,$,We,"question"))})]}):null,G&&a.jsx("div",{className:"space-y-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(Xv,{className:"h-4 w-4"}),"Subsections"]}),a.jsxs(X,{size:"sm",variant:"outline",onClick:R,className:"h-7",children:[a.jsx(Xv,{className:"h-3 w-3 mr-1"}),"Add Subsection"]})]})}),Q.subsections&&Q.subsections.length>0&&a.jsx("div",{className:"space-y-3 ml-4",children:Q.subsections.map((be,We)=>{var ot,Rt;return a.jsxs("div",{className:"border-l-2 border-slate-200 pl-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[G&&a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(X,{size:"sm",variant:"ghost",onClick:()=>ke(We),disabled:!se(Q.subsections||[],We),className:"h-7 w-7 p-0",title:"Move subsection up",children:a.jsx(fu,{className:"h-4 w-4"})}),a.jsx(X,{size:"sm",variant:"ghost",onClick:()=>ue(We),disabled:!le(Q.subsections||[],We),className:"h-7 w-7 p-0",title:"Move subsection down",children:a.jsx(Da,{className:"h-4 w-4"})})]}),G&&j===be.id?a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx(Ht,{value:k,onChange:Ke=>I(Ke.target.value),className:"flex-1",onKeyDown:Ke=>{Ke.key==="Enter"?ee():Ke.key==="Escape"&&Ae()},autoFocus:!0}),a.jsx(X,{size:"sm",onClick:ee,children:a.jsx(uo,{className:"h-3 w-3"})}),a.jsx(X,{size:"sm",variant:"outline",onClick:Ae,children:a.jsx(Mi,{className:"h-3 w-3"})})]}):a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx("h5",{className:Pe("font-medium text-slate-700",G&&"cursor-pointer hover:text-blue-600"),onClick:()=>G&&we(be.id,be.title),children:be.title}),G&&a.jsxs(a.Fragment,{children:[a.jsx(X,{size:"sm",variant:"ghost",onClick:()=>we(be.id,be.title),className:"h-6 w-6 p-0 opacity-60 hover:opacity-100",children:a.jsx(K_,{className:"h-3 w-3"})}),a.jsx(X,{size:"sm",variant:"ghost",onClick:()=>L(We),className:"h-6 w-6 p-0 opacity-60 hover:opacity-100 text-red-600 hover:text-red-700",title:"Delete subsection",children:a.jsx(ir,{className:"h-3 w-3"})})]})]})]}),be.questions&&be.questions.length>0||G?a.jsxs("div",{className:"space-y-2 mb-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h6",{className:"text-sm font-medium text-slate-600 flex items-center gap-1",children:[a.jsx(To,{className:"h-3 w-3"}),"Questions"]}),G&&a.jsxs(X,{size:"sm",variant:"outline",onClick:()=>B(We,"question"),className:"h-6",children:[a.jsx(To,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx("div",{className:"space-y-2",children:(ot=be.questions)==null?void 0:ot.map((Ke,Ze)=>Ct(Ke,$,Ze,"question",We))})]}):null,be.activities&&be.activities.length>0||G?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h6",{className:"text-sm font-medium text-slate-600 flex items-center gap-1",children:[a.jsx(ma,{className:"h-3 w-3"}),"Activities"]}),G&&a.jsxs(X,{size:"sm",variant:"outline",onClick:()=>B(We,"activity"),className:"h-6",children:[a.jsx(ma,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx("div",{className:"space-y-2",children:(Rt=be.activities)==null?void 0:Rt.map((Ke,Ze)=>Ct(Ke,$,Ze,"activity",We))})]}):null]},be.id)})}),(((xe=N.metadata)==null?void 0:xe.image_url)||((Oe=N.metadata)==null?void 0:Oe.image_id))&&a.jsxs("div",{className:"mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(cp,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),N.metadata.image_url?a.jsx("img",{src:N.metadata.image_url,alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):N.metadata.image_id&&h?a.jsx("img",{src:bt.getAssetUrl(h,N.metadata.image_id),alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},N.id)};if(g)return a.jsxs("div",{className:Pe("space-y-4",u),children:[o&&n&&a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-600 mb-2",children:[a.jsx("span",{children:"Progress"}),a.jsxs("span",{children:[Math.round(n.progress),"%"]})]}),a.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all",style:{width:`${n.progress}%`}})})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h2",{className:"text-xl font-semibold text-slate-800",children:"Discussion Guide"}),d&&a.jsxs(X,{size:"sm",variant:"outline",onClick:d,disabled:f,children:[f?a.jsx(eo,{className:"h-4 w-4 animate-spin mr-2"}):a.jsx(Jc,{className:"h-4 w-4 mr-2"}),"Download"]})]}),a.jsx("div",{className:"prose prose-sm max-w-none",children:a.jsx("pre",{className:"whitespace-pre-wrap text-sm text-slate-700 font-sans",children:e})}),n&&a.jsxs("div",{className:"mt-6 p-4 bg-blue-50 rounded-lg border border-blue-200",children:[a.jsx("h3",{className:"font-medium text-blue-900 mb-2",children:"Current Position"}),a.jsx("p",{className:"text-sm text-blue-800",children:n.current_section}),n.current_item&&a.jsx("p",{className:"text-sm text-blue-700 mt-1",children:n.current_item})]})]})]});if(!m)return a.jsx("div",{className:Pe("bg-slate-50 rounded-lg p-8 text-center",u),children:a.jsx("p",{className:"text-slate-600",children:"No discussion guide available"})});const nn=a.jsxs("div",{className:"space-y-4",children:[o&&n&&a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-600 mb-2",children:[a.jsx("span",{children:"Overall Progress"}),a.jsxs("span",{children:[Math.round(n.progress),"%"]})]}),a.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all",style:{width:`${n.progress}%`}})}),a.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-500 mt-2",children:[a.jsxs("span",{children:["Section ",n.moderator_position.section_index+1," of ",n.total_sections]}),a.jsxs("span",{children:[Math.round(n.section_progress),"% of current section"]})]})]}),a.jsx("div",{className:"space-y-3",children:m.sections.map((N,$)=>Xe(N,$))})]});return c?a.jsxs(jg,{defaultOpen:l,className:u,children:[a.jsx(Eg,{asChild:!0,children:a.jsxs("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-slate-200 cursor-pointer hover:bg-slate-50 transition-colors",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(fs,{className:"h-5 w-5 text-slate-500 transition-transform data-[state=open]:rotate-90"}),a.jsx("h2",{className:"text-lg font-semibold text-slate-800",children:m.title||"Discussion Guide"}),a.jsxs(_r,{variant:"outline",className:"text-xs",children:[m.total_duration," min"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[n&&a.jsxs(_r,{variant:n.progress===100?"success":"default",className:"text-xs",children:[Math.round(n.progress),"% Complete"]}),d&&a.jsx(X,{size:"sm",variant:"outline",onClick:N=>{N.stopPropagation(),d()},disabled:f,children:f?a.jsx(eo,{className:"h-4 w-4 animate-spin"}):a.jsx(Jc,{className:"h-4 w-4"})})]})]})}),a.jsx(Ng,{className:"mt-4",children:nn})]}):a.jsx("div",{className:u,children:nn})});KT.displayName="DiscussionGuideViewer";function ode({onAssetsChange:t,onUploadComplete:e,onUploadError:n,focusGroupId:r,disabled:i=!1,maxAssets:s=10,allowedTypes:o=["image/*","application/pdf","video/*"],label:c="Upload Assets",description:l="Upload creative assets for testing"}){const[u,d]=y.useState([]),[f,h]=y.useState([]),[p,g]=y.useState(null),[m,v]=y.useState("");y.useEffect(()=>{r&&b()},[r]);const b=async()=>{if(r)try{const M=(await bt.getAssets(r)).data.assets||[];h(M),t&&t(M)}catch(O){console.error("Error fetching backend assets:",O)}},x=async O=>{if(!O||O.length===0||!r)return;if(u.length+f.length+O.length>s){ne.error(`You can only upload up to ${s} assets`);return}const U=Array.from(O).map(D=>{const B=D.type.startsWith("image/")?URL.createObjectURL(D):void 0;return{id:`local-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,file:D,previewUrl:B,status:"uploading"}});d(D=>[...D,...U]);for(const D of U)try{const B=new FormData;if(B.append("assets",D.file),(await bt.uploadAssets(r,B,!1)).data.uploaded_assets>0)d(Y=>Y.map(q=>q.id===D.id?{...q,status:"uploaded"}:q)),await b(),ne.success(`${D.file.name} uploaded successfully`);else throw new Error("Upload failed")}catch(B){console.error(`Upload failed for ${D.file.name}:`,B),d(R=>R.map(L=>{var Y,q;return L.id===D.id?{...L,status:"failed",error:((q=(Y=B.response)==null?void 0:Y.data)==null?void 0:q.error)||"Upload failed"}:L})),n&&n(B)}e&&setTimeout(()=>{e(f)},500)},w=async O=>{if(r)try{await bt.deleteAsset(r,O),await b(),ne.info("Asset removed")}catch(M){console.error("Error removing asset:",M),ne.error("Failed to remove asset")}},S=O=>{const M=u.find(U=>U.id===O);M!=null&&M.previewUrl&&URL.revokeObjectURL(M.previewUrl),d(U=>U.filter(D=>D.id!==O))},C=async O=>{if(r){d(M=>M.map(U=>U.id===O.id?{...U,status:"uploading",error:void 0}:U));try{const M=new FormData;if(M.append("assets",O.file),(await bt.uploadAssets(r,M,!1)).data.uploaded_assets>0)d(B=>B.map(R=>R.id===O.id?{...R,status:"uploaded"}:R)),await b(),ne.success(`${O.file.name} uploaded successfully`);else throw new Error("Upload failed")}catch(M){d(U=>U.map(D=>{var B,R;return D.id===O.id?{...D,status:"failed",error:((R=(B=M.response)==null?void 0:B.data)==null?void 0:R.error)||"Upload failed"}:D})),ne.error(`Failed to upload ${O.file.name}`)}}},_=O=>{g(O.filename),v(O.user_assigned_name||"")},A=async O=>{if(!r||!m.trim()){j();return}try{await bt.updateAssetName(r,O,m.trim()),h(M=>M.map(U=>U.filename===O?{...U,user_assigned_name:m.trim()}:U)),t&&t(f),g(null),v(""),ne.success("Asset name updated")}catch(M){console.error("Error updating asset name:",M),ne.error("Failed to update asset name")}},j=()=>{g(null),v("")},T=O=>O.startsWith("image/")?a.jsx(cp,{className:"h-8 w-8 text-slate-400"}):O.startsWith("video/")?a.jsx(XJ,{className:"h-8 w-8 text-slate-400"}):O==="application/pdf"?a.jsx(Yp,{className:"h-8 w-8 text-slate-400"}):a.jsx(Yp,{className:"h-8 w-8 text-slate-400"}),k=(O,M)=>O.user_assigned_name||`Asset ${M+1}`,I=u.length+f.length,E=s-I;return a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:`border-2 border-dashed rounded-lg p-6 flex flex-col items-center justify-center transition ${i?"border-slate-100 bg-slate-25 cursor-not-allowed":"border-slate-200 bg-slate-50 hover:bg-slate-100 cursor-pointer"}`,children:i?a.jsxs(a.Fragment,{children:[a.jsx(H_,{className:"h-10 w-10 text-slate-300 mb-2"}),a.jsx("p",{className:"text-sm text-slate-400 mb-1",children:"Asset Upload Disabled"}),a.jsx("p",{className:"text-xs text-slate-400 mb-3",children:"Complete focus group details above to enable asset uploads"})]}):a.jsxs(a.Fragment,{children:[a.jsx(H_,{className:"h-10 w-10 text-slate-400 mb-2"}),a.jsx("p",{className:"text-sm text-slate-600 mb-1",children:c}),a.jsx("p",{className:"text-xs text-slate-500 mb-3",children:l}),a.jsx("input",{type:"file",accept:o.join(","),multiple:!0,onChange:O=>x(O.target.files),className:"hidden",id:"asset-uploader-input",disabled:i}),a.jsxs(X,{type:"button",variant:"outline",size:"sm",onClick:()=>{var O;return(O=document.getElementById("asset-uploader-input"))==null?void 0:O.click()},disabled:i||E<=0,children:[a.jsx(h5,{className:"mr-2 h-4 w-4"}),"Select Files"]}),a.jsxs("p",{className:"text-xs text-slate-500 mt-2",children:[E," of ",s," uploads remaining"]})]})}),(f.length>0||u.length>0)&&a.jsxs(lt,{className:"p-4",children:[a.jsxs("h4",{className:"text-sm font-medium mb-3",children:["Uploaded Assets (",f.length+u.filter(O=>O.status==="uploaded").length,")"]}),a.jsxs("div",{className:"space-y-3",children:[f.map((O,M)=>{var U;return a.jsxs("div",{className:"flex items-center gap-4 p-3 border rounded-lg bg-white",children:[a.jsx("div",{className:"w-12 h-12 bg-slate-100 rounded flex items-center justify-center flex-shrink-0",children:(U=O.mime_type)!=null&&U.startsWith("image/")?a.jsx("img",{src:bt.getAssetUrl(r,O.filename),alt:k(O,M),className:"max-h-full max-w-full object-contain rounded"}):T(O.mime_type)}),a.jsx("div",{className:"flex-grow min-w-0",children:p===O.filename?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ht,{value:m,onChange:D=>v(D.target.value),placeholder:`Asset ${M+1}`,className:"flex-1",autoFocus:!0,onKeyDown:D=>{D.key==="Enter"?(D.preventDefault(),A(O.filename)):D.key==="Escape"&&j()}}),a.jsx(X,{size:"sm",variant:"outline",type:"button",onClick:()=>A(O.filename),children:a.jsx(uo,{className:"h-4 w-4"})}),a.jsx(X,{size:"sm",variant:"outline",type:"button",onClick:j,children:a.jsx(Mi,{className:"h-4 w-4"})})]}):a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:"font-medium text-sm truncate",children:k(O,M)}),a.jsx(X,{size:"sm",variant:"ghost",type:"button",onClick:()=>_(O),className:"h-6 w-6 p-0",children:a.jsx(K_,{className:"h-3 w-3"})})]}),a.jsxs("p",{className:"text-xs text-slate-500 truncate",children:["Original: ",O.original_name]})]})}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsxs("div",{className:"text-right",children:[a.jsx("div",{className:"text-xs text-slate-500 mb-1",children:"Will appear as:"}),a.jsxs("div",{className:"text-sm font-medium text-primary",children:['"',k(O,M),'"']})]}),a.jsx(X,{size:"sm",variant:"ghost",type:"button",onClick:()=>w(O.filename),className:"h-8 w-8 p-0 text-slate-400 hover:text-red-500",children:a.jsx(Mi,{className:"h-4 w-4"})})]})]},O.filename)}),u.map(O=>a.jsxs("div",{className:"flex items-center gap-4 p-3 border rounded-lg bg-slate-50",children:[a.jsx("div",{className:"w-12 h-12 bg-slate-100 rounded flex items-center justify-center flex-shrink-0",children:O.previewUrl?a.jsx("img",{src:O.previewUrl,alt:O.file.name,className:"max-h-full max-w-full object-contain rounded"}):T(O.file.type)}),a.jsxs("div",{className:"flex-grow min-w-0",children:[a.jsx("p",{className:"font-medium text-sm truncate",children:O.file.name}),a.jsxs("p",{className:"text-xs text-slate-500",children:[(O.file.size/1024).toFixed(1)," KB"]}),O.error&&a.jsx("p",{className:"text-xs text-red-500 truncate",children:O.error})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[O.status==="uploading"&&a.jsxs("div",{className:"flex items-center gap-2 text-blue-600",children:[a.jsx(eo,{className:"h-4 w-4 animate-spin"}),a.jsx("span",{className:"text-xs",children:"Uploading..."})]}),O.status==="failed"&&a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs(X,{size:"sm",variant:"outline",type:"button",onClick:()=>C(O),className:"h-7 text-xs",children:[a.jsx(Xl,{className:"h-3 w-3 mr-1"}),"Retry"]})}),a.jsx(X,{size:"sm",variant:"ghost",type:"button",onClick:()=>S(O.id),className:"h-8 w-8 p-0 text-slate-400 hover:text-red-500",children:a.jsx(Mi,{className:"h-4 w-4"})})]})]},O.id))]}),f.length>0&&a.jsx("div",{className:"mt-4 p-3 bg-blue-50 border border-blue-200 rounded-lg",children:a.jsxs("p",{className:"text-sm text-blue-800",children:[a.jsx("strong",{children:"Asset Names:"})," Click the edit icon to customize how assets will be referenced in the discussion guide. Leave blank to use default numbering."]})})]})]})}const bl="all",ade=Re.object({researchBrief:Re.string().min(10,{message:"Research brief must be at least 10 characters."}),focusGroupName:Re.string().min(3,{message:"Focus group name must be at least 3 characters."}),discussionTopics:Re.string().min(10,{message:"Discussion topics are required."}),duration:Re.string().min(1,{message:"Duration is required."}),llm_model:Re.string().optional(),reasoning_effort:Re.string().optional(),verbosity:Re.string().optional()});function cde({draftToEdit:t,onDraftSaved:e,preSelectedParticipants:n=[]}={}){console.log("FocusGroupModerator component rendering, draftToEdit:",t);const r=lr();Bi();const{setPreviousRoute:i,navigationState:s,clearNavigationState:o}=ow(),[c,l]=y.useState("setup"),[u,d]=y.useState(!1),[f,h]=y.useState(!1),[p,g]=y.useState(!1),[m,v]=y.useState(null),[b,x]=y.useState(null),[w,S]=y.useState(!1),C=y.useRef(m);C.current=m;const _=y.useRef(!1),A=V=>V&&typeof V=="object"&&V.title&&V.sections,[j,T]=y.useState([]),[k,I]=y.useState([]),[E,O]=y.useState(!1),[M,U]=y.useState([]),[D,B]=y.useState(!1),[R,L]=y.useState(!1),[Y,q]=y.useState([]),[J,me]=y.useState(bl),[F,oe]=y.useState(!1),[se,le]=y.useState(""),[ke,ue]=y.useState(null),[we,Ae]=y.useState(""),[ee,wt]=y.useState(""),[et,Ct]=y.useState(!1),[Xe,nn]=y.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[N,$]=y.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[z,G]=y.useState("idle"),[Q,H]=y.useState(null),[Z,he]=y.useState(0),xe=y.useRef(null),Oe=y.useRef(!1),be=y.useRef(!1),We=V=>{i("/focus-groups",{focusGroupId:b,focusGroupTab:"participants",isNewFocusGroup:!t,focusGroupData:{name:Je.getValues("name"),description:Je.getValues("description"),selectedParticipants:j,discussionGuide:m}}),r(`/synthetic-users/${V.id}`)},ot=V=>{const ve={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return V.forEach(de=>{if(de.age&&ve.age.add(de.age),de.gender&&ve.gender.add(de.gender),de.occupation&&ve.occupation.add(de.occupation),de.location&&ve.location.add(de.location),de.techSavviness!==void 0){const Ee=de.techSavviness<30?"Low (0-30)":de.techSavviness<70?"Medium (31-70)":"High (71-100)";ve.techSavviness.add(Ee)}de.ethnicity&&ve.ethnicity.add(de.ethnicity)}),{age:Array.from(ve.age).sort(),gender:Array.from(ve.gender).sort(),occupation:Array.from(ve.occupation).sort(),location:Array.from(ve.location).sort(),techSavviness:Array.from(ve.techSavviness).sort((de,Ee)=>{const jt=["Low (0-30)","Medium (31-70)","High (71-100)"];return jt.indexOf(de)-jt.indexOf(Ee)}),ethnicity:Array.from(ve.ethnicity).sort()}},Rt=V=>{const ve={...N};ve[V]=[];const de=M.filter(Ee=>{let jt=!0;return J!==bl&&(jt=!1,Ee.folder_ids&&Array.isArray(Ee.folder_ids)&&(jt=Ee.folder_ids.includes(J)),!jt&&(Ee.folder_id===J||Ee.folderId===J)&&(jt=!0)),jt?Object.entries(ve).every(([Gn,as])=>{if(as.length===0)return!0;const te=Gn;if(te==="techSavviness"&&Ee.techSavviness!==void 0){const ae=Ee.techSavviness<30?"Low (0-30)":Ee.techSavviness<70?"Medium (31-70)":"High (71-100)";return as.includes(ae)}else{if(te==="age"&&Ee.age)return as.includes(Ee.age);if(te==="gender"&&Ee.gender)return as.includes(Ee.gender);if(te==="occupation"&&Ee.occupation)return as.includes(Ee.occupation);if(te==="location"&&Ee.location)return as.includes(Ee.location);if(te==="ethnicity"&&Ee.ethnicity)return as.includes(Ee.ethnicity)}return!0}):!1});return ot(de)},Ke=()=>{Ct(!1),setTimeout(()=>{nn({...N})},0)},Ze=()=>{$({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]})},_t=(V,ve)=>{$(de=>{const Ee={...de};return Ee[V].includes(ve)?Ee[V]=Ee[V].filter(jt=>jt!==ve):Ee[V]=[...Ee[V],ve],Ee})},Kt=async()=>{try{const de=(await Po.getAll()).data.map(Ee=>({...Ee,id:Ee._id}));return q(de),de}catch(V){return console.error("Error fetching folders:",V),ne.error("Failed to load folders"),q([]),[]}},Qn=async()=>{if(!se.trim()){ne.error("Please enter a folder name");return}try{const V=await Po.create({name:se.trim()});await Kt(),le(""),oe(!1),ne.success(`Folder "${se}" created`)}catch(V){console.error("Error creating folder:",V),ne.error("Failed to create folder")}},Xt=()=>{le(""),oe(!1)},at=V=>{ue(V),Ae(V.name)},Wt=async()=>{if(!ke||!we.trim()){ue(null);return}try{await Po.update(ke._id,{name:we.trim()}),await Kt(),ue(null),ne.success(`Folder renamed to "${we}"`)}catch(V){console.error("Error renaming folder:",V),ne.error("Failed to rename folder"),ue(null)}},st=()=>{ue(null),Ae("")};y.useEffect(()=>{const V=async()=>{B(!0);try{const de=await $r.getAll();console.log("Fetched personas for FocusGroupModerator:",de.data),Array.isArray(de.data)&&de.data.length>0?U(de.data):(console.warn("No personas returned from API or invalid format",de.data),ne.warning("No participants available"))}catch(de){console.error("Error fetching personas:",de),ne.error("Failed to load participants")}finally{B(!1)}};(async()=>{await Promise.all([Kt(),V()])})()},[]),console.log("About to initialize form with useForm hook");const Je=V0({resolver:G0(ade),defaultValues:{researchBrief:"",focusGroupName:"",discussionTopics:"",duration:"60",llm_model:"gemini-2.5-pro",reasoning_effort:"medium",verbosity:"medium"}});console.log("Form initialized successfully");const fn=()=>{c!=="setup"||be.current||(xe.current&&clearTimeout(xe.current),xe.current=setTimeout(async()=>{if(Oe.current)return;const V=Je.getValues(),ve={name:V.focusGroupName||"",description:V.researchBrief||"",objective:V.researchBrief||"",topic:V.discussionTopics||"",duration:V.duration?parseInt(V.duration):60,llm_model:V.llm_model||"gemini-2.5-pro",reasoning_effort:V.reasoning_effort||"medium",verbosity:V.verbosity||"medium",participants:j,participants_count:j.length,status:"draft",date:new Date().toISOString(),uploadedAssets:k.map(de=>de.filename||de.original_name||"unknown")};if(!(Q&&JSON.stringify(ve)===JSON.stringify(Q))&&!(!ve.name&&!ve.description&&!ve.topic)){Oe.current=!0,G("saving");try{let de=b||(t==null?void 0:t.id)||(t==null?void 0:t._id);if(console.log("Auto-save: draftFocusGroupId =",b),console.log("Auto-save: draftToEdit ID =",(t==null?void 0:t.id)||(t==null?void 0:t._id)),console.log("Auto-save: using focusGroupId =",de),console.log("Auto-save: llm_model in currentData =",ve.llm_model),console.log("Auto-save: duration in currentData =",ve.duration),de)console.log("Auto-save: Updating existing focus group:",de),await bt.update(de,ve),console.log("Auto-save: Updated existing draft:",de);else{console.log("Auto-save: Creating NEW focus group (no existing ID)");const Ee=await bt.create(ve);de=Ee.data.focus_group_id||Ee.data.id||Ee.data._id,x(de),console.log("Auto-save: Created new draft with ID:",de)}H(ve),G("saved"),he(0),setTimeout(()=>{G("idle")},2e3)}catch(de){if(console.error("Auto-save failed:",de),G("error"),he(Ee=>Ee+1),Z<3){const Ee=Math.pow(2,Z)*2e3;setTimeout(()=>{fn()},Ee)}else ne.error("Auto-save failed",{description:"Your changes may not be saved. Please check your connection."})}finally{Oe.current=!1}}},2e3))},Is=async V=>{try{O(!0);const ve=await bt.getAssets(V);I(ve.data.assets||[])}catch(ve){console.error("Error fetching backend assets:",ve),ne.error("Failed to load asset information")}finally{O(!1)}},ra=Je.watch(),W=y.useRef(""),Ie=y.useRef("");y.useEffect(()=>{const V=JSON.stringify(ra);c==="setup"&&V!==W.current&&(W.current=V,fn())},[ra,c]),y.useEffect(()=>{const V=JSON.stringify(j);c==="setup"&&V!==Ie.current&&(Ie.current=V,fn())},[j,c]),y.useEffect(()=>(c!=="setup"&&xe.current&&clearTimeout(xe.current),()=>{xe.current&&clearTimeout(xe.current)}),[c]),y.useEffect(()=>{if(console.log("Draft loading effect - draftToEdit:",t,"draftLoadedRef.current:",_.current),!t){_.current=!1;return}if(t&&!_.current){console.log("Loading draft focus group:",t),be.current=!0,_.current=!0;const V=t.id||t._id;x(V),console.log("Setting draft ID from draftToEdit:",V),V&&Is(V),t.name&&Je.setValue("focusGroupName",t.name),(t.description||t.objective)&&Je.setValue("researchBrief",t.description||t.objective||""),t.topic&&Je.setValue("discussionTopics",t.topic),t.duration&&Je.setValue("duration",t.duration.toString()),t.llm_model&&Je.setValue("llm_model",t.llm_model),t.reasoning_effort&&Je.setValue("reasoning_effort",t.reasoning_effort),t.verbosity&&Je.setValue("verbosity",t.verbosity),t.discussionGuide&&(v(t.discussionGuide),(!s.focusGroupTab||s.previousRoute!=="/focus-groups")&&l("review")),t.participants&&Array.isArray(t.participants)&&T(t.participants);const ve={name:t.name||"",description:t.description||t.objective||"",objective:t.description||t.objective||"",topic:t.topic||"",duration:t.duration||60,llm_model:t.llm_model||"gemini-2.5-pro",reasoning_effort:t.reasoning_effort||"medium",verbosity:t.verbosity||"medium",participants:t.participants||[],participants_count:(t.participants||[]).length,status:"draft",date:t.date||new Date().toISOString(),uploadedAssets:k.map(de=>de.filename||de.original_name||"unknown")};H(ve),console.log("Set lastSavedData to current draft:",ve),ne.success("Draft focus group loaded",{description:"Continue editing your focus group setup"}),setTimeout(()=>{be.current=!1;const de=JSON.stringify(Je.getValues());W.current=de},1e3)}},[t,Je]),y.useEffect(()=>{n.length>0&&(console.log("Pre-selected participants received:",n),T(n),l("participants"))},[n]),y.useEffect(()=>{s.focusGroupTab&&s.previousRoute==="/focus-groups"&&setTimeout(()=>{l(s.focusGroupTab),o()},0)},[s.focusGroupTab,t,o]),y.useEffect(()=>{t||setTimeout(()=>{be.current=!1;const V=JSON.stringify(Je.getValues());W.current=V},500)},[t,Je]);const Ve=()=>{if(z==="idle")return null;const ve={saving:{text:"Saving...",className:"text-blue-600 bg-blue-50"},saved:{text:"All changes saved",className:"text-green-600 bg-green-50"},error:{text:"Save failed - retrying...",className:"text-red-600 bg-red-50"}}[z];return a.jsx("div",{className:`fixed top-16 left-1/2 transform -translate-x-1/2 z-50 px-3 py-1 rounded-md text-sm font-medium border shadow-sm ${ve.className}`,children:ve.text})},ut=async(V,ve)=>{var de,Ee;d(!0),h(!1),g(!1);try{const jt={name:V.focusGroupName,description:V.researchBrief,objective:V.researchBrief,topic:V.discussionTopics,duration:parseInt(V.duration),llm_model:V.llm_model,reasoning_effort:V.reasoning_effort,verbosity:V.verbosity},Gn=ve?await bt.generateDiscussionGuideForGroup(ve,jt):await bt.generateDiscussionGuide(jt);if(Gn.data&&Gn.data.discussionGuide)return h(!0),Gn.data.discussionGuide;throw new Error("Failed to generate discussion guide")}catch(jt){console.error("Error generating discussion guide:",jt),g(!0);let Gn="Unknown error occurred";throw(Ee=(de=jt==null?void 0:jt.response)==null?void 0:de.data)!=null&&Ee.error?Gn=jt.response.data.error:jt!=null&&jt.message&&(Gn=jt.message),Gn.includes("500")||Gn.includes("internal error")||Gn.includes("Internal Server Error")?ne.error("AI service temporarily unavailable",{description:"The discussion guide generator is experiencing issues. Please try again in a few minutes.",action:{label:"Retry",onClick:()=>ut(V)}}):ne.error("Failed to generate discussion guide",{description:Gn,action:{label:"Retry",onClick:()=>ut(V)}}),jt}},tt=()=>{d(!1),h(!1),g(!1)};async function St(V){try{let ve=b;if(!ve){const de={name:V.focusGroupName,status:"draft",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(V.duration),topic:V.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:V.researchBrief,objective:V.researchBrief,llm_model:V.llm_model,reasoning_effort:V.reasoning_effort,verbosity:V.verbosity},Ee=await bt.create(de);ve=Ee.data.focus_group_id||Ee.data.id||Ee.data._id,x(ve),console.log("Draft focus group created for discussion guide generation:",Ee,"with ID:",ve)}if(ve)try{const de={name:V.focusGroupName,participants:j,participants_count:j.length,duration:parseInt(V.duration),topic:V.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:V.researchBrief,objective:V.researchBrief,llm_model:V.llm_model,reasoning_effort:V.reasoning_effort,verbosity:V.verbosity};await bt.update(ve,de),console.log("Focus group updated with latest form values before guide generation"),console.log(`šŸ”„ Updated focus group ${ve} with model: ${V.llm_model}`)}catch(de){console.error("Failed to update focus group before guide generation:",de)}try{const de=await ut(V,ve);v(de);try{const Ee={name:V.focusGroupName,status:"draft",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(V.duration),topic:V.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:V.researchBrief,objective:V.researchBrief,llm_model:V.llm_model,reasoning_effort:V.reasoning_effort,verbosity:V.verbosity,discussionGuide:de};await bt.update(ve,Ee),console.log("Focus group updated with discussion guide"),ne.success("Progress saved as draft",{description:"Your focus group setup has been automatically saved"})}catch(Ee){console.error("Failed to update focus group with discussion guide:",Ee),ne.error("Failed to save draft",{description:"Discussion guide generated, but draft save failed"})}l("review"),ne.success("Discussion guide generated",{description:"Review and edit before proceeding"})}catch(de){console.error("Discussion guide generation failed:",de),ne.error("Discussion guide generation failed",{description:"Please go back to the setup tab and try generating again. Check your inputs and try a different AI model if the issue persists.",duration:8e3});return}}catch(ve){console.error("Error in focus group creation flow:",ve),ne.error("Focus group creation failed",{description:ve.message||"An unexpected error occurred"})}}const on=(()=>{var ve;const V=M.filter(de=>{const Ee=de.name.toLowerCase().includes(ee.toLowerCase())||de.occupation&&de.occupation.toLowerCase().includes(ee.toLowerCase())||de.location&&de.location.toLowerCase().includes(ee.toLowerCase()),jt=(Xe.age.length===0||Xe.age.includes(de.age))&&(Xe.gender.length===0||Xe.gender.includes(de.gender))&&(Xe.occupation.length===0||Xe.occupation.includes(de.occupation))&&(Xe.location.length===0||Xe.location.includes(de.location))&&(Xe.ethnicity.length===0||de.ethnicity&&Xe.ethnicity.includes(de.ethnicity))&&(Xe.techSavviness.length===0||de.techSavviness!==void 0&&Xe.techSavviness.includes(de.techSavviness<30?"Low (0-30)":de.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&!0;let Gn=!0;return J!==bl&&(Gn=!1,de.folder_ids&&Array.isArray(de.folder_ids)&&(Gn=de.folder_ids.includes(J)),Gn||(de.folder_id===J||de.folderId===J)&&(Gn=!0)),Ee&&jt&&Gn});if(console.log(`Filtered personas: ${V.length}/${M.length}`),console.log(`Selected folder: ${J===bl?"All Personas":((ve=Y.find(de=>de._id===J||de.id===J))==null?void 0:ve.name)||J}`),J!==bl){const de=Y.find(Ee=>Ee._id===J||Ee.id===J);if(de){const Ee=M.filter(jt=>jt.folder_ids&&Array.isArray(jt.folder_ids)?jt.folder_ids.includes(J):jt.folder_id===J||jt.folderId===J);console.log(`Folder details: ${de.name}, ID: ${de._id}, Contains: ${Ee.length} personas`),console.log("Personas in this folder:",Ee.map(jt=>jt.name))}}return V})(),dt=V=>{console.log("Toggling selection for participant ID:",V),T(ve=>{const de=ve.includes(V);console.log("Current selection:",{id:V,isCurrentlySelected:de,currentSelections:[...ve]});const Ee=de?ve.filter(jt=>jt!==V):[...ve,V];return console.log("New selection:",Ee),Ee})},_n=async()=>{try{const V=Je.getValues(),ve={name:V.focusGroupName,status:"in-progress",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(V.duration),topic:V.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),discussionGuide:m},Ee=(await bt.create(ve)).data;return console.log("Focus group created successfully:",Ee),Ee.focus_group_id}catch(V){throw console.error("Error saving focus group:",V),V}},an=y.useCallback(async()=>{if(!C.current){ne.error("No discussion guide available",{description:"Please generate a discussion guide first"});return}L(!0);try{const{downloadDiscussionGuideAsMarkdown:V}=await Vie(async()=>{const{downloadDiscussionGuideAsMarkdown:de}=await import("./discussionGuideMarkdown-eMXneipz.js");return{downloadDiscussionGuideAsMarkdown:de}},[]),ve=Je.getValues();V(C.current,ve.focusGroupName),ne.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(V){console.error("Error downloading discussion guide:",V),ne.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{L(!1)}},[Je]),rn=y.useCallback(async V=>{console.log("šŸ“ handleSaveDiscussionGuide called with:",V),w?(C.current=V,console.log("šŸ“ Skipping discussionGuide state update during editing to preserve focus")):(v(V),ne.success("Discussion guide updated",{description:"Your changes have been saved."}))},[w]),yr=y.useCallback(V=>{console.log("šŸ“ Discussion guide editing state changed:",V),S(V),!V&&C.current&&(console.log("šŸ“ Updating discussionGuide state after editing ended"),v(C.current))},[]),Rs=y.useCallback(()=>{},[]),Xn=async()=>{if(!Je.getValues().focusGroupName){ne.error("Missing focus group name",{description:"Please provide a name for the focus group"});return}if(!m){ne.error("Missing discussion guide",{description:"Please generate a discussion guide first"});return}if(j.length<1){ne.error("Not enough participants",{description:"Please select at least one participant for the focus group"});return}console.log("Starting focus group with participants:",j);try{ne.loading("Creating focus group...");let V;if(b){const ve=Je.getValues(),de={name:ve.focusGroupName,status:"in-progress",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(ve.duration),topic:ve.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:ve.researchBrief,objective:ve.researchBrief,discussionGuide:m},Ee=await bt.update(b,de);V=b,console.log("Draft focus group updated to in-progress:",Ee),e&&e()}else V=await _n();ne.dismiss(),ne.success("Focus group created successfully",{description:"The AI moderator is now running the session"}),r(`/focus-groups/${V}`)}catch(V){ne.dismiss(),V!=null&&V.message,console.error("Failed to start focus group:",V),ne.error("Failed to create focus group",{description:"Please try again or check your connection"})}};return a.jsxs(a.Fragment,{children:[a.jsx(Ve,{}),a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[a.jsx(Wo,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Focus Group Moderator"})]}),u&&a.jsx("div",{className:"mb-6",children:a.jsx(GT,{isActive:u,isComplete:f,hasError:p,label:"Generating discussion guide",onComplete:tt})}),a.jsxs(hl,{value:c,onValueChange:l,children:[a.jsxs(Ka,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(gn,{value:"setup",children:"Setup"}),a.jsx(gn,{value:"review",children:"Review & Edit"}),a.jsx(gn,{value:"participants",children:"Participants"})]}),a.jsx(vn,{value:"setup",children:a.jsx(W0,{...Je,children:a.jsxs("form",{onSubmit:Je.handleSubmit(St),className:"space-y-6",children:[a.jsx(yt,{control:Je.control,name:"focusGroupName",render:({field:V})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Focus Group Name"}),a.jsx(gt,{children:a.jsx(Ht,{placeholder:"e.g., Mobile App UX Evaluation",...V})}),a.jsx(Mn,{children:"Give your focus group a descriptive name"}),a.jsx(vt,{})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(yt,{control:Je.control,name:"researchBrief",render:({field:V})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Research Brief"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"Describe your research objectives...",className:"h-36",...V})}),a.jsx(Mn,{children:"Provide context about what you want to learn"}),a.jsx(vt,{})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(yt,{control:Je.control,name:"discussionTopics",render:({field:V})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Discussion Topics"}),a.jsx(gt,{children:a.jsx(ht,{placeholder:"List main topics to cover, separated by commas",className:"h-24",...V})}),a.jsx(Mn,{children:"E.g., User experience, feature preferences, pain points"}),a.jsx(vt,{})]})}),a.jsx(yt,{control:Je.control,name:"duration",render:({field:V})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Duration (minutes)"}),a.jsxs(Bn,{onValueChange:V.onChange,value:V.value,children:[a.jsx(gt,{children:a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select duration"})})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"30",children:"30 minutes"}),a.jsx(ie,{value:"45",children:"45 minutes"}),a.jsx(ie,{value:"60",children:"60 minutes"}),a.jsx(ie,{value:"90",children:"90 minutes"}),a.jsx(ie,{value:"120",children:"120 minutes"})]})]}),a.jsx(Mn,{children:"How long should the focus group session last?"}),a.jsx(vt,{})]})}),a.jsx(yt,{control:Je.control,name:"llm_model",render:({field:V})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"AI Model"}),a.jsxs(Bn,{onValueChange:V.onChange,value:V.value,children:[a.jsx(gt,{children:a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select AI model"})})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(ie,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(ie,{value:"gpt-5",children:"GPT-5"})]})]}),a.jsx(Mn,{children:"Choose which AI model to use for generating responses and discussion guides"}),a.jsx(vt,{})]})}),Je.watch("llm_model")==="gpt-5"&&a.jsxs(a.Fragment,{children:[a.jsx(yt,{control:Je.control,name:"reasoning_effort",render:({field:V})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Reasoning Effort"}),a.jsxs(Bn,{onValueChange:V.onChange,value:V.value,children:[a.jsx(gt,{children:a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select reasoning effort"})})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"minimal",children:"Minimal - Fast responses"}),a.jsx(ie,{value:"low",children:"Low - Quick thinking"}),a.jsx(ie,{value:"medium",children:"Medium - Balanced (default)"}),a.jsx(ie,{value:"high",children:"High - Deep reasoning"})]})]}),a.jsx(Mn,{children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx("div",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx(vt,{})]})}),a.jsx(yt,{control:Je.control,name:"verbosity",render:({field:V})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Response Verbosity"}),a.jsxs(Bn,{onValueChange:V.onChange,value:V.value,children:[a.jsx(gt,{children:a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select verbosity level"})})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"low",children:"Low - Concise responses"}),a.jsx(ie,{value:"medium",children:"Medium - Balanced length (default)"}),a.jsx(ie,{value:"high",children:"High - Detailed responses"})]})]}),a.jsx(Mn,{children:"Controls how detailed and lengthy GPT-5's responses will be"}),a.jsx("div",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx(vt,{})]})})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 mb-2 block",children:"Creative Assets (Optional)"}),a.jsx(ode,{focusGroupId:b,disabled:!b,onUploadComplete:V=>{I(V)},onUploadError:V=>{console.error("Asset upload error:",V)},onAssetsChange:V=>{I(V)},maxAssets:10,allowedTypes:["image/*","application/pdf","video/*"],label:"Upload Creative Assets",description:"Upload images, mockups, or product designs for testing"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Upload visuals that you want feedback on during the session"})]}),a.jsx("div",{className:"space-y-3",children:a.jsx("div",{className:"flex justify-end",children:a.jsxs(X,{type:"submit",disabled:u,className:"min-w-32",children:[a.jsx(Wo,{className:"mr-2 h-4 w-4"}),u?"Generating...":"Generate Discussion Guide"]})})})]})})}),a.jsx(vn,{value:"review",children:a.jsxs("div",{className:"space-y-6",children:[a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("div",{className:"flex items-center justify-between mb-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"AI-Generated Discussion Guide"}),m&&a.jsx(_r,{variant:"outline",className:"text-xs",children:A(m)?"Structured JSON":"Legacy Text"})]})}),a.jsx("div",{className:"prose max-w-none",children:m?a.jsx(KT,{discussionGuide:m,showProgress:!1,collapsible:!0,defaultExpanded:!0,className:"border-0",onSave:rn,onDownload:an,onSectionSelect:Rs,isDownloading:R,focusGroupId:b,onEditingChange:yr}):a.jsx("div",{className:"bg-slate-50 p-4 rounded border text-center text-slate-600",children:p?a.jsxs("div",{children:[a.jsx("p",{className:"mb-2",children:"Discussion guide generation failed."}),a.jsxs("p",{className:"text-sm",children:["Go back to the ",a.jsx("strong",{children:"Setup"})," tab and try generating again. Check your inputs and try a different AI model if the issue persists."]})]}):a.jsx("p",{children:'No discussion guide generated yet. Complete the setup and click "Generate Discussion Guide" to create one.'})})})]})}),k.length>0&&a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Creative Assets"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"text-sm text-slate-600",children:"Assets that will be referenced in the discussion guide:"}),a.jsx("div",{className:"space-y-2",children:k.map((V,ve)=>{var Ee;const de=V.user_assigned_name||`Asset ${ve+1}`;return a.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-lg bg-slate-50",children:[a.jsx("div",{className:"w-10 h-10 bg-slate-200 rounded flex items-center justify-center flex-shrink-0",children:(Ee=V.mime_type)!=null&&Ee.startsWith("image/")?a.jsx("img",{src:bt.getAssetUrl(b,V.filename),alt:de,className:"max-h-full max-w-full object-contain rounded"}):a.jsx(Yp,{className:"h-6 w-6 text-slate-600"})}),a.jsxs("div",{className:"flex-grow",children:[a.jsxs("p",{className:"font-medium text-sm",children:['"',de,'"']}),a.jsx("p",{className:"text-xs text-slate-500",children:"Will appear in discussion guide"})]})]},V.filename)})}),a.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:a.jsxs("p",{className:"text-sm text-blue-700",children:[a.jsx("strong",{children:"Note:"})," To rename assets, go back to the Setup tab and click the edit icon next to each asset."]})})]})]})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(X,{variant:"outline",onClick:()=>l("setup"),children:"Back to Setup"}),a.jsxs(X,{onClick:()=>l("participants"),children:["Select Participants",a.jsx(Fr,{className:"ml-2 h-4 w-4"})]})]})]})}),a.jsxs(vn,{value:"participants",children:[a.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[a.jsxs("div",{className:"w-full md:w-64 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium",children:"Folders"}),a.jsx(X,{variant:"ghost",size:"sm",onClick:()=>{console.log("Clicked 'Create new folder' button"),oe(!0)},className:"h-7 w-7 p-0",children:a.jsx(f5,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>{console.log("Clicked 'All Personas' folder"),console.log("All personas count:",M.length),me(bl),setTimeout(()=>{console.log(`Will show all ${M.length} personas`)},0)},className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${J===bl?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(hs,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),Y.map(V=>a.jsx("div",{className:"flex items-center justify-between group",children:ke&&ke._id===V._id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(hs,{className:"h-4 w-4"}),a.jsx(Ht,{value:we,onChange:ve=>Ae(ve.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:ve=>{ve.key==="Enter"?Wt():ve.key==="Escape"&&st()}}),a.jsx(X,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming folder rename: "${ke==null?void 0:ke.name}" to "${we}"`),Wt()},className:"h-7 w-7 p-0",children:a.jsx(uo,{className:"h-4 w-4"})}),a.jsx(X,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Cancelling rename of folder: "${ke==null?void 0:ke.name}"`),st()},className:"h-7 w-7 p-0",children:a.jsx(Mi,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>{console.log(`Clicked folder: ${V.name} (ID: ${V._id})`);const ve=M.filter(de=>de.folder_ids&&Array.isArray(de.folder_ids)?de.folder_ids.includes(V._id):de.folder_id===V._id||de.folderId===V._id);console.log(`Current persona count in folder: ${ve.length}`),console.log("All personas count:",M.length),me(V._id),setTimeout(()=>{console.log(`Will show ${ve.length} personas after filtering`),console.log("Filtered personas:",ve.map(de=>de.name))},0)},className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${J===V._id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(hs,{className:"h-4 w-4"}),a.jsx("span",{children:V.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:M.filter(ve=>ve.folder_ids&&Array.isArray(ve.folder_ids)?ve.folder_ids.includes(V._id):ve.folder_id===V._id||ve.folderId===V._id).length})]}),a.jsxs(OA,{children:[a.jsx(IA,{asChild:!0,children:a.jsx(X,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(z_,{className:"h-4 w-4"})})}),a.jsx(Ix,{align:"end",children:a.jsx(oc,{onClick:()=>{console.log(`Initiating rename for folder: ${V.name} (ID: ${V.id})`),at(V)},children:"Rename"})})]})]})},V._id)),F&&a.jsxs("div",{className:"flex items-center px-3 py-2 space-x-2",children:[a.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[a.jsx(hs,{className:"h-4 w-4"}),a.jsx(Ht,{value:se,onChange:V=>le(V.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:V=>{V.key==="Enter"?Qn():V.key==="Escape"&&Xt()}})]}),a.jsx(X,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming creation of new folder: "${se}"`),Qn()},className:"h-7 w-7 p-0",children:a.jsx(uo,{className:"h-4 w-4"})}),a.jsx(X,{size:"sm",variant:"ghost",onClick:()=>{console.log("Cancelling folder creation"),Xt()},className:"h-7 w-7 p-0",children:a.jsx(Mi,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx(lt,{className:"mb-4",children:a.jsx(Ot,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Select Participants"}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Fr,{className:"h-5 w-5 mr-2 text-muted-foreground"}),a.jsxs("span",{className:"text-sm font-medium",children:[j.length," of ",on.length," selected"]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(FE,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Ht,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:ee,onChange:V=>wt(V.target.value)})]}),a.jsxs(X,{variant:"outline",className:"flex items-center gap-2",onClick:()=>Ct(!0),children:[a.jsx($E,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(Xe).some(V=>V.length>0)?` (${Object.values(Xe).reduce((V,ve)=>V+ve.length,0)})`:""]})]})]}),D?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(eo,{className:"h-8 w-8 animate-spin text-primary"})}):on.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:on.map(V=>{const ve=V._id||V.id;return a.jsx(pT,{user:{id:ve,_id:V._id,name:V.name,age:V.age,gender:V.gender,occupation:V.occupation,location:V.location||"Unknown",techSavviness:V.techSavviness||50,personality:V.personality||"No description available",oceanTraits:V.oceanTraits,qualitativeAttributes:V.qualitativeAttributes,topPersonalityTraits:V.topPersonalityTraits,aiSynthesizedBio:V.aiSynthesizedBio},selected:j.includes(ve),onSelectionToggle:()=>dt(ve),onViewDetails:We},ve)})}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No personas available matching your criteria."})})]})})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(X,{variant:"outline",onClick:()=>l("review"),children:"Back to Review"}),a.jsxs(X,{onClick:Xn,disabled:j.length<1||!m,children:[a.jsx(aZ,{className:"mr-2 h-4 w-4"}),"Start Focus Group Session"]})]})]})]}),a.jsx(eu,{open:et,onOpenChange:V=>{V?(Ct(V),$({...Xe})):Ct(!1)},children:a.jsxs(Lc,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Fc,{children:[a.jsx(Bc,{children:"Filter Personas"}),a.jsx(tu,{children:"Select attributes to filter personas by. Multiple selections within a category use OR logic, different categories use AND logic."})]}),a.jsxs("div",{className:"py-4 space-y-6",children:[Object.values(N).some(V=>V.length>0)&&a.jsx("div",{className:"bg-muted/30 p-3 rounded-md",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[Object.values(N).reduce((V,ve)=>V+ve.length,0)," active filters"]})}),(()=>{const V=ot(M),ve=Object.values(N).every(Ee=>Ee.length===0),de=(Ee,jt,Gn=1)=>{const as=ve?V[jt]:Rt(jt)[jt],te=N[jt],ae=[...new Set([...as,...te])].sort();return ae.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:Ee}),a.jsx("div",{className:`grid grid-cols-1 ${Gn===2?"sm:grid-cols-2":Gn===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:ae.map(Te=>{const $e=N[jt].includes(Te),Be=as.includes(Te);return a.jsxs("div",{className:`flex items-center space-x-2 ${!Be&&!$e?"opacity-50":""}`,children:[a.jsx(Fl,{id:`${jt}-${Te}`,checked:$e,onCheckedChange:()=>_t(jt,Te),disabled:!Be&&!$e}),a.jsxs(ms,{htmlFor:`${jt}-${Te}`,className:"truncate overflow-hidden",children:[Te,$e&&!Be&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},Te)})})]})};return a.jsxs(a.Fragment,{children:[de("Gender","gender",3),de("Age","age",3),de("Ethnicity","ethnicity",2),de("Location","location",2),de("Occupation","occupation",2),de("Tech Savviness","techSavviness",3),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()]}),a.jsxs(Uc,{children:[a.jsx(X,{variant:"outline",onClick:Ze,children:"Reset"}),a.jsx(X,{onClick:Ke,children:"Apply Filters"})]})]})})]})]})]})]})}const lde=[{id:"1",name:"Mobile App UX Evaluation",status:"completed",participants:6,date:"2023-06-10T14:00:00Z",duration:60,topic:"user-experience"},{id:"2",name:"Product Feature Feedback",status:"scheduled",participants:8,date:"2023-06-15T10:00:00Z",duration:90,topic:"product-feedback"},{id:"3",name:"Marketing Campaign Testing",status:"in-progress",participants:5,date:"2023-06-12T15:30:00Z",duration:45,topic:"creative-testing"},{id:"4",name:"Website Navigation Study",status:"scheduled",participants:7,date:"2023-06-18T13:00:00Z",duration:60,topic:"user-experience"}],ude={completed:"bg-green-100 text-green-800 border-green-200",scheduled:"bg-blue-100 text-blue-800 border-blue-200","in-progress":"bg-amber-100 text-amber-800 border-amber-200",active:"bg-amber-100 text-amber-800 border-amber-200",paused:"bg-purple-100 text-purple-800 border-purple-200",new:"bg-slate-100 text-slate-800 border-slate-200",ai_mode:"bg-amber-100 text-amber-800 border-amber-200",draft:"bg-gray-100 text-gray-800 border-gray-200"},dde=()=>{console.log("FocusGroups component rendering");const[t,e]=y.useState("view"),[n,r]=y.useState(""),[i,s]=y.useState([]),[o,c]=y.useState(!0),[l,u]=y.useState([]),[d,f]=y.useState(!1),[h,p]=y.useState(!1),[g,m]=y.useState(null),v=lr(),b=Bi(),[x,w]=y.useState([]),S=y.useRef(!0),C=async(E=!0)=>{if(console.log("fetchFocusGroups called with isMountedCheck:",E),console.log("isMounted.current:",S.current),E&&!S.current){console.log("Exiting early: component not mounted");return}console.log("Setting loading to true and making API call"),c(!0);try{console.log("Calling focusGroupsApi.getAll()");const O=await bt.getAll();if(console.log("API response received:",O),!E||S.current){const M=O.data.map(U=>({...U,id:U.id||U._id,participants_count:Array.isArray(U.participants)?U.participants.length:typeof U.participants=="number"?U.participants:0}));s(M)}}catch(O){console.error("Error fetching focus groups:",O),(!E||S.current)&&(Fe.error("Failed to load focus groups"),s(lde))}finally{(!E||S.current)&&c(!1)}},_=async E=>{try{const O=await bt.getById(E);O&&O.data&&(m(O.data),e("create"))}catch(O){console.error("Error fetching focus group for edit:",O),Fe.error("Failed to load focus group for editing")}};y.useEffect(()=>(console.log("useEffect running - about to fetch focus groups"),C(),()=>{console.log("useEffect cleanup - setting isMounted to false"),S.current=!1}),[]),y.useEffect(()=>{console.log("Mode change useEffect running, mode:",t),t==="view"&&(console.log("Mode is view, calling fetchFocusGroups"),C())},[t]),y.useEffect(()=>{const E=b.state;(E==null?void 0:E.mode)==="create"&&(E!=null&&E.preSelectedParticipants)&&(w(E.preSelectedParticipants),e("create"),v(b.pathname,{replace:!0,state:null}))},[b.state,b.pathname,v]),y.useEffect(()=>{const E=new URLSearchParams(b.search),O=E.get("mode"),M=E.get("id"),U=E.get("tab");if(O==="create")e("create"),m(null);else if(O==="edit"&&M){const D=i.find(B=>(B._id||B.id)===M);D?(m(D),e("create")):_(M)}if(O||M||U){const D=b.pathname;v(D,{replace:!0})}},[b.search,i,v,b.pathname]);const A=i.filter(E=>E.name.toLowerCase().includes(n.toLowerCase())||E.topic.toLowerCase().includes(n.toLowerCase())),j=E=>new Date(E).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),T=E=>new Date(E).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),k=E=>{u(O=>O.includes(E)?O.filter(M=>M!==E):[...O,E])},I=async()=>{if(l.length!==0){p(!0);try{const E=l.map(O=>bt.delete(O));await Promise.all(E),s(O=>O.filter(M=>!l.includes(M.id||M._id||""))),u([]),Fe.success(`${l.length} focus group${l.length>1?"s":""} deleted successfully`)}catch(E){console.error("Error deleting focus groups:",E),Fe.error("Failed to delete focus groups")}finally{p(!1),f(!1)}}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(ja,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:"Focus Groups"}),a.jsx("p",{className:"text-slate-600 mt-1",children:"Set up and manage AI-moderated research sessions"})]}),a.jsx("div",{className:"mt-4 sm:mt-0",children:a.jsx(X,{onClick:()=>{console.log("Create New Focus Group button clicked, current mode:",t);try{t==="view"?(console.log("Setting draft to null and switching to create mode"),m(null),e("create")):(console.log("Switching back to view mode"),e("view"))}catch(E){console.error("Error in Create New Focus Group onClick:",E)}},className:"hover-transition",children:t==="view"?"Create New Focus Group":"View All Focus Groups"})})]}),t==="view"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(FE,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Ht,{placeholder:"Search focus groups by name or topic...",className:"pl-10 bg-white",value:n,onChange:E=>r(E.target.value)})]}),a.jsxs(X,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx($E,{className:"h-4 w-4"}),a.jsx("span",{children:"Filter"})]})]}),a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Wo,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Your Focus Groups"})]}),l.length>0&&a.jsxs(X,{variant:"destructive",size:"sm",onClick:()=>f(!0),disabled:h,className:"flex items-center gap-2",children:[a.jsx(ir,{className:"h-4 w-4"}),"Delete Selected (",l.length,")"]})]}),o?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(eo,{className:"h-8 w-8 animate-spin text-primary"})}):A.length>0?a.jsx("div",{className:"space-y-4",children:A.map(E=>a.jsx("div",{className:"glass-card rounded-xl overflow-hidden hover:shadow-md button-transition",children:a.jsxs("div",{className:"flex flex-col md:flex-row",children:[a.jsxs("div",{className:"flex-1 p-6",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Fl,{id:`select-${E.id||E._id}`,checked:l.includes(E.id||E._id||""),onCheckedChange:()=>k(E.id||E._id||""),className:"mt-1"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:E.name}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(zJ,{className:"h-4 w-4 mr-1"}),j(E.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(qp,{className:"h-4 w-4 mr-1"}),T(E.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Fr,{className:"h-4 w-4 mr-1"}),E.participants_count||(Array.isArray(E.participants)?E.participants.length:0)," participant",E.participants_count>1||Array.isArray(E.participants)&&E.participants.length>1?"s":""]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(qp,{className:"h-4 w-4 mr-1"}),E.duration," min"]})]})]})]}),a.jsxs("div",{className:Pe("px-3 py-1 rounded-full text-xs font-medium border",ude[E.status]||"bg-gray-100 text-gray-800 border-gray-200"),children:[E.status==="completed"&&"Completed",E.status==="scheduled"&&"Scheduled",E.status==="in-progress"&&"In Progress",E.status==="active"&&"In Progress",E.status==="ai_mode"&&"In Progress",E.status==="paused"&&"Paused",E.status==="new"&&"Not Started",E.status==="draft"&&"Draft",!["completed","scheduled","in-progress","active","ai_mode","paused","new","draft"].includes(E.status)&&E.status]})]}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs("div",{className:"px-3 py-1 bg-slate-100 rounded-full text-xs font-medium text-slate-800",children:[E.topic==="user-experience"&&"User Experience",E.topic==="product-feedback"&&"Product Feedback",E.topic==="creative-testing"&&"Creative Testing",E.topic==="messaging-evaluation"&&"Messaging Evaluation",E.topic&&!["user-experience","product-feedback","creative-testing","messaging-evaluation"].includes(E.topic)&&E.topic.charAt(0).toUpperCase()+E.topic.slice(1).replace(/-/g," ")]}),a.jsx("div",{className:"px-3 py-1 bg-slate-100 rounded-full text-xs font-medium text-slate-800",children:"AI Moderated"})]})]}),a.jsx("div",{className:"bg-slate-50 p-6 flex flex-col justify-center items-center md:border-l border-slate-100",children:a.jsx(X,{variant:E.status==="in-progress"||E.status==="active"||E.status==="ai_mode"?"default":E.status==="new"||E.status==="draft"?"outline":"default",className:Pe("w-full hover-transition",E.status==="new"?"bg-slate-200 text-slate-700 hover:bg-slate-300 border-slate-300":"",E.status==="draft"?"bg-gray-200 text-gray-700 hover:bg-gray-300 border-gray-300":""),onClick:()=>{if(E.status==="draft")m(E),e("create");else{const O=E.id||E._id;console.log("Navigating to focus group:",O),v(`/focus-groups/${O}`)}},children:E.status==="completed"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(fs,{className:"ml-2 h-4 w-4"})]}):E.status==="in-progress"||E.status==="active"||E.status==="ai_mode"?a.jsxs(a.Fragment,{children:["Join Session",a.jsx(fs,{className:"ml-2 h-4 w-4"})]}):E.status==="paused"?a.jsxs(a.Fragment,{children:["Session Details",a.jsx(fs,{className:"ml-2 h-4 w-4"})]}):E.status==="scheduled"?a.jsxs(a.Fragment,{children:["View Details",a.jsx(fs,{className:"ml-2 h-4 w-4"})]}):E.status==="new"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(fs,{className:"ml-2 h-4 w-4"})]}):E.status==="draft"?a.jsxs(a.Fragment,{children:["Edit",a.jsx(fs,{className:"ml-2 h-4 w-4"})]}):a.jsxs(a.Fragment,{children:["View Session",a.jsx(fs,{className:"ml-2 h-4 w-4"})]})})})]})},E.id))}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No focus groups found matching your search criteria."})})]})]}):a.jsx(cde,{draftToEdit:g,preSelectedParticipants:x,onDraftSaved:()=>{m(null),e("view"),w([]),C()}})]}),a.jsx(RA,{open:d,onOpenChange:f,children:a.jsxs(Mx,{children:[a.jsxs(Dx,{children:[a.jsxs(Lx,{children:["Delete ",l.length," Focus Group",l.length!==1?"s":"","?"]}),a.jsxs(Fx,{children:["This action cannot be undone. This will permanently delete the selected focus group",l.length!==1?"s":""," and remove all data associated with ",l.length!==1?"them":"it","."]})]}),a.jsxs($x,{children:[a.jsx(Bx,{disabled:h,children:"Cancel"}),a.jsx(Ux,{onClick:E=>{E.preventDefault(),I()},disabled:h,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:h?a.jsxs(a.Fragment,{children:[a.jsx(eo,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):a.jsx(a.Fragment,{children:"Delete"})})]})]})})]})},fde=({participants:t,selectedParticipantIds:e,onToggleParticipantFilter:n})=>{const r=lr(),{id:i}=RE(),{setPreviousRoute:s}=ow(),o=l=>{const u=l.id||l._id;u&&i&&(s(`/focus-groups/${i}`,{focusGroupId:i}),r(`/personas/${u}`))},c=l=>{const u=l.id||l._id;u&&n(u)};return a.jsx("div",{className:"w-full lg:w-64 shrink-0",children:a.jsxs("div",{className:"glass-panel rounded-xl p-4",children:[a.jsxs("h2",{className:"font-sf text-lg font-semibold flex items-center mb-3",children:[a.jsx(Fr,{className:"h-5 w-5 text-primary mr-2"})," Participants"]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center p-2 bg-primary/5 rounded-lg",children:[a.jsx(xa,{className:"h-8 w-8 text-primary mr-3"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-primary",children:"AI Moderator"}),a.jsx("p",{className:"text-xs text-slate-500",children:"Session facilitator"})]})]}),t.map(l=>{const u=l.id||l._id,d=e.includes(u);return a.jsxs("div",{className:`flex items-center p-2 rounded-lg transition-colors ${d?"bg-blue-50 border border-blue-200":"hover:bg-slate-100"}`,children:[a.jsx("div",{className:"cursor-pointer mr-3",onClick:()=>o(l),title:`View ${l.name}'s profile`,children:a.jsx("img",{src:Ag(l),alt:l.name,className:"h-8 w-8 rounded-full object-cover"})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("p",{className:"font-medium cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>c(l),title:`Filter to show only ${l.name}'s messages`,children:l.name}),d&&a.jsx(uo,{className:"h-4 w-4 text-blue-600 ml-2"})]}),a.jsx("p",{className:"text-xs text-slate-500",children:l.occupation})]})]},l.id)})]})]})})};function hde(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var WT="ScrollArea",[lV,bFe]=Ui(WT),[pde,Ps]=lV(WT),uV=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:s=600,...o}=t,[c,l]=y.useState(null),[u,d]=y.useState(null),[f,h]=y.useState(null),[p,g]=y.useState(null),[m,v]=y.useState(null),[b,x]=y.useState(0),[w,S]=y.useState(0),[C,_]=y.useState(!1),[A,j]=y.useState(!1),T=Pt(e,I=>l(I)),k=Ou(i);return a.jsx(pde,{scope:n,type:r,dir:k,scrollHideDelay:s,scrollArea:c,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:_,scrollbarY:m,onScrollbarYChange:v,scrollbarYEnabled:A,onScrollbarYEnabledChange:j,onCornerWidthChange:x,onCornerHeightChange:S,children:a.jsx(it.div,{dir:k,...o,ref:T,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});uV.displayName=WT;var dV="ScrollAreaViewport",fV=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,asChild:i,nonce:s,...o}=t,c=Ps(dV,n),l=y.useRef(null),u=Pt(e,l,c.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:` +[data-radix-scroll-area-viewport] { + scrollbar-width: none; + -ms-overflow-style: none; + -webkit-overflow-scrolling: touch; +} +[data-radix-scroll-area-viewport]::-webkit-scrollbar { + display: none; +} +:where([data-radix-scroll-area-viewport]) { + display: flex; + flex-direction: column; + align-items: stretch; +} +:where([data-radix-scroll-area-content]) { + flex-grow: 1; +} +`},nonce:s}),a.jsx(it.div,{"data-radix-scroll-area-viewport":"",...o,asChild:i,ref:u,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...t.style},children:_de({asChild:i,children:r},d=>a.jsx("div",{"data-radix-scroll-area-content":"",ref:c.onContentChange,style:{minWidth:c.scrollbarXEnabled?"fit-content":void 0},children:d}))})]})});fV.displayName=dV;var ea="ScrollAreaScrollbar",qT=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Ps(ea,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,c=t.orientation==="horizontal";return y.useEffect(()=>(c?s(!0):o(!0),()=>{c?s(!1):o(!1)}),[c,s,o]),i.type==="hover"?a.jsx(mde,{...r,ref:e,forceMount:n}):i.type==="scroll"?a.jsx(gde,{...r,ref:e,forceMount:n}):i.type==="auto"?a.jsx(hV,{...r,ref:e,forceMount:n}):i.type==="always"?a.jsx(YT,{...r,ref:e}):null});qT.displayName=ea;var mde=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Ps(ea,t.__scopeScrollArea),[s,o]=y.useState(!1);return y.useEffect(()=>{const c=i.scrollArea;let l=0;if(c){const u=()=>{window.clearTimeout(l),o(!0)},d=()=>{l=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return c.addEventListener("pointerenter",u),c.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),c.removeEventListener("pointerenter",u),c.removeEventListener("pointerleave",d)}}},[i.scrollArea,i.scrollHideDelay]),a.jsx(Yr,{present:n||s,children:a.jsx(hV,{"data-state":s?"visible":"hidden",...r,ref:e})})}),gde=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Ps(ea,t.__scopeScrollArea),s=t.orientation==="horizontal",o=cw(()=>l("SCROLL_END"),100),[c,l]=hde("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return y.useEffect(()=>{if(c==="idle"){const u=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[c,i.scrollHideDelay,l]),y.useEffect(()=>{const u=i.viewport,d=s?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const p=u[d];f!==p&&(l("SCROLL"),o()),f=p};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[i.viewport,s,l,o]),a.jsx(Yr,{present:n||c!=="hidden",children:a.jsx(YT,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Ne(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Ne(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),hV=y.forwardRef((t,e)=>{const n=Ps(ea,t.__scopeScrollArea),{forceMount:r,...i}=t,[s,o]=y.useState(!1),c=t.orientation==="horizontal",l=cw(()=>{if(n.viewport){const u=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,i=Ps(ea,t.__scopeScrollArea),s=y.useRef(null),o=y.useRef(0),[c,l]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=yV(c.viewport,c.content),d={...r,sizes:c,onSizesChange:l,hasThumb:u>0&&u<1,onThumbChange:h=>s.current=h,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:h=>o.current=h};function f(h,p){return Sde(h,o.current,c,p)}return n==="horizontal"?a.jsx(vde,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollLeft,p=ER(h,c,i.dir);s.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollLeft=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollLeft=f(h,i.dir))}}):n==="vertical"?a.jsx(yde,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollTop,p=ER(h,c);s.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollTop=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollTop=f(h))}}):null}),vde=y.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=Ps(ea,t.__scopeScrollArea),[o,c]=y.useState(),l=y.useRef(null),u=Pt(e,l,s.onScrollbarXChange);return y.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),a.jsx(mV,{"data-orientation":"horizontal",...i,ref:u,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":aw(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(s.viewport){const h=s.viewport.scrollLeft+d.deltaX;t.onWheelScroll(h),bV(h,f)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:zx(o.paddingLeft),paddingEnd:zx(o.paddingRight)}})}})}),yde=y.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=Ps(ea,t.__scopeScrollArea),[o,c]=y.useState(),l=y.useRef(null),u=Pt(e,l,s.onScrollbarYChange);return y.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),a.jsx(mV,{"data-orientation":"vertical",...i,ref:u,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":aw(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(s.viewport){const h=s.viewport.scrollTop+d.deltaY;t.onWheelScroll(h),bV(h,f)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:zx(o.paddingTop),paddingEnd:zx(o.paddingBottom)}})}})}),[xde,pV]=lV(ea),mV=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:c,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=t,p=Ps(ea,n),[g,m]=y.useState(null),v=Pt(e,T=>m(T)),b=y.useRef(null),x=y.useRef(""),w=p.viewport,S=r.content-r.viewport,C=Ar(d),_=Ar(l),A=cw(f,10);function j(T){if(b.current){const k=T.clientX-b.current.left,I=T.clientY-b.current.top;u({x:k,y:I})}}return y.useEffect(()=>{const T=k=>{const I=k.target;(g==null?void 0:g.contains(I))&&C(k,S)};return document.addEventListener("wheel",T,{passive:!1}),()=>document.removeEventListener("wheel",T,{passive:!1})},[w,g,S,C]),y.useEffect(_,[r,_]),rf(g,A),rf(p.content,A),a.jsx(xde,{scope:n,scrollbar:g,hasThumb:i,onThumbChange:Ar(s),onThumbPointerUp:Ar(o),onThumbPositionChange:_,onThumbPointerDown:Ar(c),children:a.jsx(it.div,{...h,ref:v,style:{position:"absolute",...h.style},onPointerDown:Ne(t.onPointerDown,T=>{T.button===0&&(T.target.setPointerCapture(T.pointerId),b.current=g.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),j(T))}),onPointerMove:Ne(t.onPointerMove,j),onPointerUp:Ne(t.onPointerUp,T=>{const k=T.target;k.hasPointerCapture(T.pointerId)&&k.releasePointerCapture(T.pointerId),document.body.style.webkitUserSelect=x.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),Hx="ScrollAreaThumb",gV=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=pV(Hx,t.__scopeScrollArea);return a.jsx(Yr,{present:n||i.hasThumb,children:a.jsx(bde,{ref:e,...r})})}),bde=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...i}=t,s=Ps(Hx,n),o=pV(Hx,n),{onThumbPositionChange:c}=o,l=Pt(e,f=>o.onThumbChange(f)),u=y.useRef(),d=cw(()=>{u.current&&(u.current(),u.current=void 0)},100);return y.useEffect(()=>{const f=s.viewport;if(f){const h=()=>{if(d(),!u.current){const p=Cde(f,c);u.current=p,c()}};return c(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[s.viewport,d,c]),a.jsx(it.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ne(t.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),g=f.clientX-p.left,m=f.clientY-p.top;o.onThumbPointerDown({x:g,y:m})}),onPointerUp:Ne(t.onPointerUp,o.onThumbPointerUp)})});gV.displayName=Hx;var QT="ScrollAreaCorner",vV=y.forwardRef((t,e)=>{const n=Ps(QT,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(wde,{...t,ref:e}):null});vV.displayName=QT;var wde=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,i=Ps(QT,n),[s,o]=y.useState(0),[c,l]=y.useState(0),u=!!(s&&c);return rf(i.scrollbarX,()=>{var f;const d=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(d),l(d)}),rf(i.scrollbarY,()=>{var f;const d=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(d),o(d)}),u?a.jsx(it.div,{...r,ref:e,style:{width:s,height:c,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function zx(t){return t?parseInt(t,10):0}function yV(t,e){const n=t/e;return isNaN(n)?0:n}function aw(t){const e=yV(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function Sde(t,e,n,r="ltr"){const i=aw(n),s=i/2,o=e||s,c=i-o,l=n.scrollbar.paddingStart+o,u=n.scrollbar.size-n.scrollbar.paddingEnd-c,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return xV([l,u],f)(t)}function ER(t,e,n="ltr"){const r=aw(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-i,o=e.content-e.viewport,c=s-r,l=n==="ltr"?[0,o]:[o*-1,0],u=xm(t,l);return xV([0,o],[0,c])(u)}function xV(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function bV(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return function i(){const s={left:t.scrollLeft,top:t.scrollTop},o=n.left!==s.left,c=n.top!==s.top;(o||c)&&e(),n=s,r=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(r)};function cw(t,e){const n=Ar(t),r=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),y.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function rf(t,e){const n=Ar(e);qr(()=>{let r=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(t),()=>{window.cancelAnimationFrame(r),i.unobserve(t)}}},[t,n])}function _de(t,e){const{asChild:n,children:r}=t;if(!n)return typeof e=="function"?e(r):e;const i=y.Children.only(r);return y.cloneElement(i,{children:typeof e=="function"?e(i.props.children):e})}var wV=uV,Ade=fV,jde=vV;const lw=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(wV,{ref:r,className:Pe("relative overflow-hidden",t),...n,children:[a.jsx(Ade,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(SV,{}),a.jsx(jde,{})]}));lw.displayName=wV.displayName;const SV=y.forwardRef(({className:t,orientation:e="vertical",...n},r)=>a.jsx(qT,{ref:r,orientation:e,className:Pe("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:a.jsx(gV,{className:"relative flex-1 rounded-full bg-border"})}));SV.displayName=qT.displayName;const Ede=({participants:t,isVisible:e,selectedIndex:n,onSelect:r,onClose:i,position:s})=>{const o=y.useRef(null);return y.useEffect(()=>{const c=l=>{o.current&&!o.current.contains(l.target)&&i()};if(e)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[e,i]),y.useEffect(()=>{if(e&&n>=0&&o.current){const c=o.current.children[n];c&&c.scrollIntoView({block:"nearest",behavior:"smooth"})}},[n,e]),!e||t.length===0?null:a.jsxs("div",{ref:o,className:"absolute z-50 w-64 max-h-48 overflow-y-auto bg-white border border-slate-200 rounded-lg shadow-lg",style:{top:s.top,left:s.left},children:[t.map((c,l)=>{const u=c.id||c._id,d=l===n;return a.jsxs("div",{className:`flex items-center p-3 cursor-pointer transition-colors ${d?"bg-blue-50 border-l-4 border-blue-500":"hover:bg-slate-50"}`,onClick:()=>r(c),children:[a.jsx("img",{src:Ag(c),alt:c.name,className:"h-8 w-8 rounded-full object-cover mr-3 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:`font-medium truncate ${d?"text-blue-900":"text-slate-900"}`,children:c.name}),a.jsx("p",{className:`text-sm truncate ${d?"text-blue-600":"text-slate-500"}`,children:c.occupation})]})]},u)}),t.length===0&&a.jsx("div",{className:"p-3 text-center text-slate-500 text-sm",children:"No participants found"})]})};function DA(t,e){const n=[],r=[],i=/@(\w+(?:\s+\w+)*?)(?=\s+and\s|\s+or\s|\s*[^\w\s]|\s*$)/g;let s;for(;(s=i.exec(t))!==null;){const o=s[1],c=s.index,l=s.index+s[0].length,u=e.find(d=>d.name.toLowerCase()===o.toLowerCase());if(u){const d=u.id||u._id;d&&(n.push({id:d,name:u.name,startIndex:c,endIndex:l}),r.includes(d)||r.push(d))}}return{text:t,mentions:n,mentionedParticipantIds:r}}function Nde(t,e){if(e.length===0)return[t];const n=[];let r=0;return[...e].sort((s,o)=>s.startIndex-o.startIndex).forEach((s,o)=>{s.startIndex>r&&n.push(t.slice(r,s.startIndex)),n.push(P.createElement("span",{key:`mention-${o}`,className:"text-blue-600 bg-blue-50 px-1 rounded font-medium"},`@${s.name}`)),r=s.endIndex}),r=0;n--){const r=t[n];if(r==="@"){if(n===0||/\s/.test(t[n-1]))return n}else if(/\s/.test(r))break}return null}function kde(t,e,n){return t.slice(e+1,n).toLowerCase()}function Ode(t,e){return e?t.filter(n=>n.name.toLowerCase().includes(e)):t}const CV=y.forwardRef(({value:t,onChange:e,participants:n,placeholder:r="Ask a question or provide guidance...",className:i="",disabled:s=!1},o)=>{const[c,l]=y.useState(!1),[u,d]=y.useState(0),[f,h]=y.useState({top:0,left:0}),[p,g]=y.useState(null),[m,v]=y.useState([]),b=y.useRef(null),x=y.useRef(null);y.useEffect(()=>{o&&b.current&&(typeof o=="function"?o(b.current):o.current=b.current)},[o]);const w=()=>{if(b.current&&x.current&&p!==null){const j=b.current,T=x.current,k=document.createElement("div");k.style.position="absolute",k.style.visibility="hidden",k.style.whiteSpace="pre",k.style.font=window.getComputedStyle(j).font,k.textContent=t.slice(0,p),document.body.appendChild(k);const I=k.offsetWidth;document.body.removeChild(k);const E=T.getBoundingClientRect(),O=j.getBoundingClientRect();h({top:O.height+4,left:Math.min(I,E.width-280)})}},S=j=>{const T=j.target.value,k=j.target.selectionStart||0,I=Pde(T,k);if(I!==null&&n.length>0){const O=kde(T,I,k),M=Ode(n,O);g(I),v(M),d(0),l(!0)}else l(!1),g(null);const E=DA(T,n);e(T,E)},C=j=>{if(c&&m.length>0)switch(j.key){case"ArrowDown":j.preventDefault(),d(T=>TT>0?T-1:m.length-1);break;case"Enter":case"Tab":j.preventDefault(),m[u]&&_(m[u]);break;case"Escape":j.preventDefault(),l(!1);break}},_=j=>{if(p!==null&&b.current){const T=b.current.selectionStart||0,{newText:k,newCursorPosition:I}=Tde(t,T,j,p),E=DA(k,n);e(k,E),setTimeout(()=>{b.current&&(b.current.focus(),b.current.setSelectionRange(I,I))},0),l(!1),g(null)}},A=()=>{l(!1),g(null)};return y.useEffect(()=>{c&&p!==null&&w()},[c,p,t]),a.jsxs("div",{ref:x,className:`relative ${i}`,children:[a.jsx("input",{ref:b,type:"text",value:t,onChange:S,onKeyDown:C,placeholder:r,disabled:s,className:"flex h-10 w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm ring-offset-white file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx(Ede,{participants:m,isVisible:c,selectedIndex:u,onSelect:_,onClose:A,position:f})]})});CV.displayName="MentionInput";const Ide=({message:t,persona:e,toggleHighlight:n,participants:r=[],focusGroupId:i})=>{const[s,o]=y.useState(!1),c=t.senderId==="moderator",l=t.senderId==="facilitator",u=DA(t.text,r),d=Nde(t.text,u.mentions),f=(c||l)&&(t.visualAsset||g(t.text))&&i,p=(()=>{if(t.visualAsset)return{filename:t.visualAsset.filename,displayReference:t.visualAsset.displayReference};{const v=g(t.text);return v?{filename:v,displayReference:v}:null}})();function g(v){const b=[/titled\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/asset\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/(fg-[a-f0-9]+-[a-f0-9]{32}\.(jpg|jpeg|png))/i];for(const x of b){const w=v.match(x);if(w)return w[1]}return null}const m=()=>{n()};return a.jsxs("div",{id:`message-${t.id}`,className:Pe("flex items-start p-3 rounded-lg transition-colors",t.highlighted?"bg-amber-50 border border-amber-200":"hover:bg-slate-50",c?"border-l-4 border-l-primary pl-4":"",l?"border-l-4 border-l-green-500 pl-4":""),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),"data-highlighted":t.highlighted?"true":"false",children:[a.jsx("div",{className:"flex-shrink-0 mr-3",children:c?a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:a.jsx(xa,{className:"h-6 w-6 text-primary"})}):l?a.jsx("div",{className:"bg-green-100 p-2 rounded-full",children:a.jsx(Qp,{className:"h-6 w-6 text-green-600"})}):e?a.jsx("div",{className:"bg-slate-100 p-2 rounded-full",children:a.jsx("img",{src:Ag(e),alt:`${e.name} avatar`,className:"h-6 w-6 rounded-full object-cover"})}):a.jsx("div",{className:"bg-slate-100 p-2 rounded-full",children:a.jsx(WJ,{className:"h-6 w-6 text-slate-600"})})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center mb-1",children:[a.jsx("span",{className:"font-medium mr-2",children:c?"AI Moderator":l?"Human Facilitator":(e==null?void 0:e.name)||"Unknown"}),!c&&!l&&e&&a.jsx(_r,{variant:"outline",className:"text-xs font-normal",children:e.occupation}),a.jsx("span",{className:"text-xs text-slate-500 ml-auto",children:t.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("p",{className:"text-slate-700",children:!t.text||t.text.trim()===""||t.text==="..."?a.jsx("span",{className:"text-red-500 italic",children:"[No response content - AI generation may have failed]"}):d}),f&&p&&a.jsxs("div",{className:"mt-3 p-3 border rounded-lg bg-slate-50",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(cp,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Creative Asset"}),p.displayReference!==p.filename&&a.jsxs("span",{className:"text-xs text-slate-500",children:["(",p.displayReference,")"]})]}),a.jsx("img",{src:bt.getAssetUrl(i,p.filename),alt:"Creative asset for review",className:"max-w-full h-auto rounded border shadow-sm",style:{maxHeight:"300px"},onError:v=>{var x;console.error("Failed to load creative asset:",bt.getAssetUrl(i,p.filename)),v.currentTarget.style.display="none";const b=document.createElement("div");b.className="text-xs text-slate-500 italic p-2 border rounded bg-slate-100",b.textContent=`Creative asset not found: ${p.displayReference}`,(x=v.currentTarget.parentNode)==null||x.appendChild(b)}})]}),a.jsx("div",{className:Pe("flex mt-2 space-x-2",!s&&!t.highlighted&&"hidden"),children:a.jsxs(X,{variant:"ghost",size:"sm",onClick:m,className:"h-8 px-2 text-xs",children:[a.jsx(hZ,{className:Pe("h-3 w-3 mr-1",t.highlighted?"fill-amber-400 text-amber-400":"text-slate-400")}),t.highlighted?"Highlighted":"Highlight"]})})]})]})},Rde=({action:t})=>{switch(t){case"moderator_speak":return a.jsx(Wo,{className:"h-4 w-4 text-blue-500"});case"participant_respond":return a.jsx(Fr,{className:"h-4 w-4 text-green-500"});case"participant_interaction":return a.jsx(Fr,{className:"h-4 w-4 text-purple-500"});case"probe_trigger":return a.jsx(p5,{className:"h-4 w-4 text-orange-500"});case"end_session":return a.jsx(gZ,{className:"h-4 w-4 text-red-500"});default:return a.jsx(du,{className:"h-4 w-4 text-gray-500"})}},Mde=({status:t})=>{switch(t){case"success":return a.jsx(ME,{className:"h-3 w-3 text-green-500"});case"error":return a.jsx(qJ,{className:"h-3 w-3 text-red-500"});case"pending":return a.jsx(qp,{className:"h-3 w-3 text-yellow-500 animate-pulse"});default:return null}},Dde=({action:t})=>({moderator_speak:"Moderator",participant_respond:"Participant Response",participant_interaction:"Participant Interaction",probe_trigger:"Probe Question",end_session:"End Session"})[t]||t,$de=t=>{try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return t}},Lde=({entry:t,isLatest:e})=>{const[n,r]=y.useState(e);return a.jsx(lt,{className:`mb-2 ${e?"ring-2 ring-blue-200 bg-blue-50/50":""}`,children:a.jsxs(jg,{open:n,onOpenChange:r,children:[a.jsx(Eg,{asChild:!0,children:a.jsx(Ei,{className:"pb-2 cursor-pointer hover:bg-gray-50/50 transition-colors",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Rde,{action:t.action}),a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium text-sm",children:a.jsx(Dde,{action:t.action})}),a.jsx(Mde,{status:t.execution_status})]}),a.jsx("span",{className:"text-xs text-gray-500",children:$de(t.timestamp)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[e&&a.jsx(_r,{variant:"secondary",className:"text-xs",children:"Latest"}),n?a.jsx(fu,{className:"h-4 w-4 text-gray-400"}):a.jsx(Da,{className:"h-4 w-4 text-gray-400"})]})]})})}),a.jsx(Ng,{children:a.jsx(Ot,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"AI Reasoning:"}),a.jsxs("p",{className:"text-sm text-gray-600 bg-gray-50 p-2 rounded italic",children:['"',t.reasoning,'"']})]}),t.details&&Object.keys(t.details).length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"Details:"}),a.jsx("div",{className:"text-xs text-gray-600 bg-gray-50 p-2 rounded font-mono",children:JSON.stringify(t.details,null,2)})]}),t.execution_result&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"Execution Result:"}),a.jsx("div",{className:"text-xs text-gray-600 bg-gray-50 p-2 rounded",children:t.execution_result.error?a.jsxs("span",{className:"text-red-600",children:["Error: ",t.execution_result.error]}):a.jsx("span",{className:"text-green-600",children:t.execution_result.message||"Success"})})]})]})})})]})})},Fde=({reasoningHistory:t,isVisible:e,onToggle:n,isAiMode:r=!1})=>{const[i,s]=y.useState(!0);return y.useEffect(()=>{if(i&&t.length>0){const o=document.getElementById("reasoning-panel-content");o&&(o.scrollTop=0)}},[t.length,i]),a.jsx("div",{className:"border-t border-gray-200 bg-white",children:a.jsxs(jg,{open:e,onOpenChange:n,children:[a.jsx(Eg,{asChild:!0,children:a.jsxs("div",{className:"flex items-center justify-between p-3 cursor-pointer hover:bg-gray-50 transition-colors",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(du,{className:"h-4 w-4 text-purple-600"}),a.jsx("span",{className:"font-medium text-sm",children:r?"AI Decision Reasoning":"AI Moderator Logic"}),r&&t.length>0&&a.jsx(_r,{variant:"outline",className:"text-xs",children:t.length}),!r&&a.jsx(_r,{variant:"secondary",className:"text-xs",children:"Manual Mode"})]}),e?a.jsx(fu,{className:"h-4 w-4 text-gray-400"}):a.jsx(Da,{className:"h-4 w-4 text-gray-400"})]})}),a.jsx(Ng,{children:a.jsx("div",{className:"border-t border-gray-100",children:r?t.length===0?a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(du,{className:"h-8 w-8 mx-auto mb-2 text-gray-300"}),a.jsx("p",{className:"text-sm",children:"No AI decisions yet"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Reasoning will appear here when the AI makes decisions"})]}):a.jsx(lw,{id:"reasoning-panel-content",className:"h-[25vh] p-3",children:a.jsx("div",{className:"space-y-2",children:t.map((o,c)=>a.jsx(Lde,{entry:o,isLatest:c===0},`${o.timestamp}-${c}`))})}):a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(UE,{className:"h-8 w-8 mx-auto mb-2 text-gray-400"}),a.jsx("p",{className:"text-sm font-medium text-gray-700",children:"Manual Moderation Mode"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"You are currently moderating the discussion manually."}),a.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"Switch to AI Mode to see automated reasoning and decisions."})]})})})]})})},Ude=({modeEvent:t})=>{const e=i=>i.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=i=>{switch(i){case"ai_mode_started":return"AI Mode Started";case"manual_mode_started":return"Manual Moderation Enabled";case"ai_session_concluded":return"AI Discussion Concluded";default:return"Mode Changed"}},r=i=>{switch(i){case"ai_mode_started":return"text-blue-600";case"manual_mode_started":return"text-slate-600";case"ai_session_concluded":return"text-green-600";default:return"text-gray-600"}};return a.jsxs("div",{className:"flex items-center my-6 px-4",children:[a.jsx("div",{className:"flex-1 border-t border-gray-200"}),a.jsx("div",{className:`mx-4 px-3 py-1 bg-white border border-gray-200 rounded-full ${r(t.event_type)}`,children:a.jsxs("div",{className:"flex items-center space-x-2 text-xs font-medium",children:[a.jsx("span",{children:n(t.event_type)}),a.jsx("span",{className:"text-gray-400",children:"at"}),a.jsx("span",{children:e(t.timestamp)})]})}),a.jsx("div",{className:"flex-1 border-t border-gray-200"})]})},Bde=({messages:t,modeEvents:e,personas:n,isSpeaking:r,focusGroupId:i,isAiModeActive:s=!1,selectedParticipantIds:o,onToggleHighlight:c,onAdvanceDiscussion:l,onNewMessage:u,onStatusChange:d,isEditingDiscussionGuide:f=!1})=>{const[h,p]=y.useState(""),[g,m]=y.useState(null),[v,b]=y.useState(!1),[x,w]=y.useState(null),S=y.useRef(null),[C,_]=y.useState(-1),[A,j]=y.useState(!1),T=y.useRef(0),k=y.useRef(null),I=y.useRef(1e4),E=y.useRef(null),[O,M]=y.useState(!1),[U,D]=y.useState(!1),[B,R]=y.useState(!1),[L,Y]=y.useState(null),q=L!==null?L:s,[J,me]=y.useState([]),[F,oe]=y.useState(!1),se=F;y.useEffect(()=>{s&&i&&le()},[s,i]);const le=async()=>{if(i)try{s&&ke()}catch(H){console.error("Error checking autonomous status:",H)}},ke=async()=>{if(i)try{const H=await er.getReasoningHistory(i);me(H.data.reasoning_history||[])}catch(H){console.error("Error fetching reasoning history:",H)}};y.useEffect(()=>{O&&ee()},[t,O]),y.useEffect(()=>{let H;return s&&i&&(H=setInterval(()=>{ke(),le()},5e3)),()=>{H&&clearInterval(H)}},[s,i]),y.useEffect(()=>{T.current=t.length},[]),y.useEffect(()=>{const H=t.length,Z=T.current;if(A&&H>Z){const he=Date.now(),xe=k.current;if(xe&&he-xe>=I.current)b(!1),j(!1),k.current=null;else if(xe){const Oe=I.current-(he-xe);setTimeout(()=>{b(!1),j(!1),k.current=null},Math.max(0,Oe))}else b(!1),j(!1)}T.current=H},[t.length,A]);const ue=H=>n.find(Z=>Z.id===H||Z._id===H),we=o.length===0?t:t.filter(H=>H.senderId==="moderator"||H.senderId==="facilitator"||o.includes(H.senderId)),Ae=()=>{const H=[];return we.forEach(Z=>{H.push({type:"message",data:Z,timestamp:Z.timestamp})}),e.forEach(Z=>{H.push({type:"mode_event",data:Z,timestamp:Z.timestamp})}),H.sort((Z,he)=>Z.timestamp.getTime()-he.timestamp.getTime())},ee=()=>{if(!f&&E.current){const H=E.current.closest("[data-radix-scroll-area-viewport]");if(H){const Z=E.current.offsetTop-H.clientHeight+50,he=H.scrollTop,xe=Z-he,Oe=300;let be=null;const We=ot=>{be||(be=ot);const Rt=ot-be,Ke=Math.min(Rt/Oe,1),Ze=1-Math.pow(1-Ke,3);H.scrollTop=he+xe*Ze,Ke<1&&window.requestAnimationFrame(We)};window.requestAnimationFrame(We)}else E.current.scrollIntoView({behavior:"smooth",block:"end"})}},wt=async H=>{var be,We;if(H.preventDefault(),!h.trim())return;let Z=h,he=null,xe=null;const Oe=g;p(""),m(null),b(!0),j(!0),k.current=Date.now();try{if(x){try{ne.info("Uploading creative asset...",{description:"Please wait while we upload your image."});const Ke=new FormData;Ke.append("assets",x);const Ze=await bt.uploadAssets(i,Ke);console.log("Upload response:",Ze==null?void 0:Ze.data);const _t=Ze==null?void 0:Ze.data;if(_t&&_t.assets&&_t.assets.length>0?(he=_t.assets[0].filename,console.log("Successfully got filename from upload response:",he)):console.error("Invalid upload response structure:",_t),he){try{const Kt=await bt.getAssets(i),Qn=((be=Kt==null?void 0:Kt.data)==null?void 0:be.assets)||[],Xt=Qn.find(Wt=>Wt.filename===he);let at="the uploaded asset";Xt&&(Xt.user_assigned_name?at=Xt.user_assigned_name:at=`Asset ${Qn.findIndex(st=>st.filename===he)+1}`),xe={filename:he,displayReference:at},Z=`Please review ${at}. ${h}`,console.log("Using display reference in message:",at)}catch(Kt){console.error("Error fetching asset metadata:",Kt),Z=`Please review the uploaded asset. ${h}`,xe={filename:he,displayReference:"the uploaded asset"}}ne.success("Creative asset uploaded successfully",{description:"The image has been attached to your message."})}}catch(Ke){console.error("Error uploading file:",Ke),console.error("Upload error details:",(We=Ke.response)==null?void 0:We.data),ne.error("Failed to upload creative asset",{description:"Your message will be sent without the attachment."})}z()}const ot={text:Z,type:"question",senderId:"facilitator"};he&&(ot.attached_assets=[he],ot.activates_visual_context=!0,xe&&(ot.visualAsset=xe));const Rt=await bt.sendMessage(i,ot);console.log("Message sent to API:",Rt),setTimeout(()=>{ee()},100),Oe&&Oe.mentionedParticipantIds.length>0?setTimeout(()=>{G(Oe.mentionedParticipantIds,Z)},500):(b(!1),j(!1),k.current=null)}catch(ot){console.error("Error sending message:",ot),b(!1),j(!1),k.current=null;const Rt={id:`msg-${Date.now()}`,senderId:"facilitator",text:h,timestamp:new Date,type:"question"};u(Rt),setTimeout(()=>{ee()},100),ne.error("Failed to send message to server",{description:"Message will be shown locally but not saved."})}},et=()=>{for(let H=t.length-1;H>=0;H--)if(t[H].senderId==="moderator"&&t[H].type==="question")return t[H].text;for(let H=t.length-1;H>=0;H--)if(t[H].senderId==="moderator")return t[H].text;return"What are your thoughts on this topic?"},Ct=(H,Z)=>{if(!H||!H.sections||!Z)return null;const{section_index:he,subsection_index:xe,item_index:Oe,item_type:be}=Z,We=H.sections,ot=Ke=>{const Ze=[];return Ke.questions&&Ke.questions.forEach((_t,Kt)=>{Ze.push({..._t,type:"question",index:Kt})}),Ke.activities&&Ke.activities.forEach((_t,Kt)=>{Ze.push({..._t,type:"activity",index:Kt})}),Ze.sort((_t,Kt)=>_t.type!==Kt.type?_t.type==="question"?-1:1:_t.index-Kt.index)};if(he>=We.length)return{completed:!0};const Rt=We[he];if(xe!==void 0&&Rt.subsections){if(xe>=Rt.subsections.length)return Ct(H,{section_index:he+1,subsection_index:void 0,item_index:0,item_type:"question"});const Ke=Rt.subsections[xe],Ze=ot(Ke),_t=Ze.findIndex(Kt=>Kt.type===be&&Kt.index===Oe);if(_t0){const Ze=Ke.findIndex(_t=>_t.type===be&&_t.index===Oe);if(Ze0?Ct(H,{section_index:he,subsection_index:0,item_index:0,item_type:"question"}):Ct(H,{section_index:he+1,subsection_index:void 0,item_index:0,item_type:"question"})}},Xe=async()=>{var H,Z,he;if(i)try{b(!0),j(!0),k.current=Date.now(),ne.info("Advancing discussion...",{description:"Moving to the next question in the discussion guide."});const[xe,Oe]=await Promise.all([er.getModeratorStatus(i),bt.getById(i)]);if(!((H=xe==null?void 0:xe.data)!=null&&H.status)||!((Z=Oe==null?void 0:Oe.data)!=null&&Z.discussionGuide))throw new Error("Could not fetch moderator status or discussion guide");const be=xe.data.status,We=Oe.data.discussionGuide;if(!We.sections)throw new Error("Discussion guide does not have a structured format");const ot=Ct(We,be.moderator_position);if(!ot)throw new Error("Could not determine next discussion item");if(ot.completed){ne.success("Discussion guide completed",{description:"All sections of the discussion guide have been covered."});const Ke={id:`msg-${Date.now()}`,senderId:"moderator",text:"We have covered all the questions in our discussion guide. Thank you all for your valuable insights and participation in this focus group session.",timestamp:new Date,type:"system"};u(Ke),b(!1),j(!1),k.current=null;return}await er.setModeratorPosition(i,ot.sectionId,ot.itemId);const Rt={id:`msg-${Date.now()}`,senderId:"moderator",text:ot.content,timestamp:new Date,type:"question"};try{const Ke=await bt.sendMessage(i,{senderId:"moderator",text:Rt.text,type:"question"});(he=Ke==null?void 0:Ke.data)!=null&&he.message_id&&(Rt.id=Ke.data.message_id)}catch(Ke){console.warn("Failed to save message to API, showing locally:",Ke)}u(Rt),b(!1),j(!1),k.current=null,setTimeout(()=>{ee()},100),ne.success("Discussion advanced",{description:`Moved to: ${ot.section.title}${ot.subsection?` > ${ot.subsection.title}`:""}`}),d&&setTimeout(()=>d(),500)}catch(xe){console.error("Error advancing discussion:",xe),ne.error("Failed to advance discussion",{description:xe.message||"There was a problem advancing to the next question."}),b(!1),j(!1),k.current=null}},nn=async()=>{var H,Z,he,xe;if(i){console.log("Starting AI Mode: setting autonomousLoading to true"),R(!0);try{console.log("Starting AI Mode: calling API...");const be=await Promise.race([er.startAutonomousConversation(i),new Promise((We,ot)=>setTimeout(()=>ot(new Error("API call timeout after 30 seconds")),3e4))]);if(console.log("Starting AI Mode: API response received:",be),be.data.error){ne.error("Failed to start autonomous conversation",{description:be.data.error}),R(!1);return}ne.success("Autonomous conversation started",{description:"The AI is now managing the focus group conversation"}),Y(!0);try{console.log("Starting AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Starting AI Mode: onStatusChange completed successfully"))}catch(We){console.error("Starting AI Mode: onStatusChange failed:",We)}console.log("Starting AI Mode: resetting autonomousLoading to false"),R(!1),ke()}catch(Oe){console.error("Error starting autonomous conversation:",Oe),Oe.response&&Oe.response.data&&console.error("Backend error details:",Oe.response.data);const be=((Z=(H=Oe.response)==null?void 0:H.data)==null?void 0:Z.message)||((xe=(he=Oe.response)==null?void 0:he.data)==null?void 0:xe.error)||"Please check your connection and try again";ne.error("Failed to start autonomous conversation",{description:be}),R(!1)}}},N=async()=>{if(i){console.log("Stopping AI Mode: setting autonomousLoading to true"),R(!0);try{const H=await er.stopAutonomousConversation(i,"manual_stop");if(H.data.error){ne.error("Failed to stop autonomous conversation",{description:H.data.error}),R(!1);return}me([]),ne.success("Autonomous conversation stopped",{description:"You can now moderate the discussion manually"}),Y(!1);try{console.log("Stopping AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Stopping AI Mode: onStatusChange completed successfully"))}catch(Z){console.error("Stopping AI Mode: onStatusChange failed:",Z)}console.log("Stopping AI Mode: resetting autonomousLoading to false"),R(!1)}catch(H){console.error("Error stopping autonomous conversation:",H),ne.error("Failed to stop autonomous conversation"),R(!1)}}},$=H=>{var he;const Z=(he=H.target.files)==null?void 0:he[0];if(Z){if(!Z.type.startsWith("image/")){ne.error("Please select an image file",{description:"Only image files (JPG, PNG, etc.) are supported for creative review."});return}if(Z.size>10*1024*1024){ne.error("File too large",{description:"Please select an image smaller than 10MB."});return}w(Z),ne.success(`Image selected: ${Z.name}`,{description:"The image will be attached to your next message."})}},z=()=>{w(null),S.current&&(S.current.value="")},G=async(H,Z)=>{var he;if(!(!i||H.length===0))try{b(!0),j(!0),k.current=Date.now(),ne.info("Generating responses from mentioned participants...",{description:`Generating responses from ${H.length} mentioned participant(s).`});for(const xe of H){const Oe=n.find(be=>(be._id||be.id)===xe);if(!Oe){console.warn(`Mentioned participant ${xe} not found in focus group`);continue}try{const be=await er.generateResponse(i,xe,Z||"Continue the conversation based on the latest moderator message.");if((he=be==null?void 0:be.data)!=null&&he.response){console.log("Generated response from mentioned participant:",be.data);const We={id:be.data.message_id||`msg-${Date.now()}-${xe}`,senderId:xe,text:be.data.response,timestamp:new Date(be.data.timestamp||be.data.created_at||new Date),type:"response"};u(We),ne.success(`Response generated from ${Oe.name}`,{description:be.data.response.substring(0,100)+"..."})}}catch(be){console.error(`Error generating response from ${Oe.name}:`,be),ne.error(`Failed to generate response from ${Oe.name}`)}}b(!1),j(!1),k.current=null}catch(xe){console.error("Error generating mentioned responses:",xe),ne.error("Failed to generate responses from mentioned participants"),b(!1),j(!1),k.current=null}},Q=async()=>{var H,Z,he,xe;if(i){if(n.length===0){ne.error("No participants available",{description:"Add participants to the focus group before generating responses."});return}try{b(!0),j(!0),k.current=Date.now(),ne.info("AI is selecting participant...",{description:"Analyzing the conversation to choose the best respondent."});const Oe=await er.makeConversationDecision(i,.7,"manual");if(!Oe||!Oe.data||!Oe.data.decision)throw new Error("Empty decision response from AI");const be=Oe.data.decision;if(be.action==="participant_respond"){const We=be.details.participant_id,ot=be.details.topic_context,Rt=be.reasoning,Ke=n.find(_t=>(_t._id||_t.id)===We);if(!Ke)throw new Error(`Selected participant ${We} not found in focus group`);ne.info("Generating response...",{description:`AI selected ${Ke.name}: ${Rt.substring(0,100)}${Rt.length>100?"...":""}`});const Ze=await er.generateResponse(i,We,ot);if(!Ze||!Ze.data)throw new Error("Empty response from API");if((H=Ze==null?void 0:Ze.data)!=null&&H.message_id&&((Z=Ze==null?void 0:Ze.data)!=null&&Z.response)){const _t={id:Ze.data.message_id,senderId:We,text:Ze.data.response,timestamp:new Date(Ze.data.timestamp||Ze.data.created_at||new Date),type:"response",highlighted:!1};u(_t),b(!1),j(!1),k.current=null,setTimeout(()=>{ee()},100)}else throw new Error("Failed to generate or save AI response")}else{if(console.log("AI suggested different action:",be.action),be.action==="moderator_speak"){ne.info("AI suggests moderator intervention",{description:`AI reasoning: ${be.reasoning.substring(0,100)}${be.reasoning.length>100?"...":""}`}),b(!1),j(!1),k.current=null;return}ne.warning("Using fallback participant selection",{description:`AI suggested "${be.action}" but generating participant response anyway.`});const We=(C+1)%n.length,ot=n[We],Rt=et(),Ke=ot._id||ot.id,Ze=await er.generateResponse(i,Ke,Rt);if((he=Ze==null?void 0:Ze.data)!=null&&he.message_id&&((xe=Ze==null?void 0:Ze.data)!=null&&xe.response)){const _t={id:Ze.data.message_id,senderId:Ke,text:Ze.data.response,timestamp:new Date(Ze.data.timestamp||Ze.data.created_at||new Date),type:"response",highlighted:!1};u(_t),b(!1),j(!1),k.current=null,setTimeout(()=>{ee()},100),_(We)}}}catch(Oe){console.error("Error generating AI response:",Oe),ne.error("Failed to generate AI response",{description:"There was a problem connecting to the server."}),b(!1),j(!1),k.current=null}}};return a.jsxs("div",{className:"glass-panel rounded-xl p-4 flex flex-col h-full",children:[a.jsx("div",{className:"flex-1 min-h-0 mb-4",children:a.jsxs(lw,{className:"h-full pr-4",children:[a.jsxs("div",{className:"space-y-4",children:[Ae().map(H=>H.type==="message"?a.jsx(Ide,{message:H.data,persona:H.data.senderId!=="moderator"&&H.data.senderId!=="facilitator"?ue(H.data.senderId):null,toggleHighlight:()=>c(H.data.id),participants:n,focusGroupId:i},H.data.id):a.jsx(Ude,{modeEvent:H.data},H.data.id)),(v||s)&&a.jsxs("div",{className:"flex items-center space-x-2 text-sm text-slate-500 animate-pulse",children:[a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:s?a.jsx(xa,{className:"h-4 w-4 text-primary animate-spin"}):a.jsx(To,{className:"h-4 w-4 text-primary"})}),a.jsx("span",{children:s?"AI is generating next response...":"Generating AI response..."})]}),a.jsx("div",{className:"h-8"}),a.jsx("div",{ref:E,className:"h-1"})]}),!O&&we.length>6&&a.jsx("div",{className:"sticky bottom-5 ml-auto mr-5 z-10 w-fit",children:a.jsx(X,{size:"sm",className:"rounded-full shadow-md h-10 w-10 p-0",onClick:ee,title:"Scroll to bottom",children:a.jsx(QO,{className:"h-4 w-4"})})})]})}),a.jsx(Fde,{reasoningHistory:J,isVisible:se,onToggle:()=>oe(!F),isAiMode:s}),a.jsxs("div",{className:"pt-4 border-t border-slate-200 w-full",children:[x&&a.jsxs("div",{className:"mb-2 p-2 bg-blue-50 border border-blue-200 rounded-md flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(tI,{className:"h-4 w-4 text-blue-600"}),a.jsx("span",{className:"text-sm text-blue-700",children:x.name}),a.jsxs("span",{className:"text-xs text-blue-500",children:["(",(x.size/1024/1024).toFixed(1)," MB)"]})]}),a.jsx(X,{type:"button",variant:"ghost",size:"sm",onClick:z,className:"h-6 w-6 p-0 text-blue-600 hover:text-blue-800",children:"Ɨ"})]}),a.jsxs("form",{onSubmit:wt,className:"flex items-center gap-2 w-full",children:[a.jsx("input",{ref:S,type:"file",accept:"image/*",onChange:$,className:"hidden"}),a.jsx(CV,{value:h,onChange:(H,Z)=>{p(H),m(Z||null)},participants:n,placeholder:"Ask a question or provide guidance...",className:"flex-1 min-w-0",disabled:!1}),a.jsx(X,{type:"button",variant:"outline",size:"sm",onClick:()=>{var H;return(H=S.current)==null?void 0:H.click()},className:"hover-transition shrink-0 px-3",disabled:!1,title:"Attach image for creative review",children:a.jsx(tI,{className:"h-4 w-4"})}),a.jsxs(X,{type:"submit",variant:"default",className:"hover-transition shrink-0",disabled:!1,children:[a.jsx(Wo,{className:"mr-2 h-4 w-4"}),"Send"]})]}),a.jsxs("div",{className:"flex justify-between items-center mt-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("p",{className:"text-sm text-slate-500",children:r?"Speaking...":s?"AI mode active":"Manual moderation mode"}),a.jsx(X,{variant:"outline",size:"sm",onClick:q?N:nn,disabled:B,className:`hover-transition ${q?"bg-red-50 text-red-600 hover:bg-red-100":"bg-blue-50 text-blue-600 hover:bg-blue-100"}`,title:q?"Stop AI mode and return to manual":"Start autonomous AI conversation",children:B?a.jsxs(a.Fragment,{children:[a.jsx(xa,{className:"mr-1 h-3 w-3 animate-spin"}),s?"Stopping...":"Starting..."]}):q?a.jsxs(a.Fragment,{children:[a.jsx(xa,{className:"mr-1 h-3 w-3"}),"Stop AI Mode"]}):a.jsxs(a.Fragment,{children:[a.jsx(xa,{className:"mr-1 h-3 w-3"}),"Start AI Mode"]})}),a.jsxs(X,{variant:"outline",size:"sm",onClick:()=>{M(!O),O||ee()},className:`hover-transition ${O?"bg-blue-50 text-blue-600 hover:bg-blue-100":""}`,title:O?"Disable auto-scroll":"Enable auto-scroll",children:[a.jsx(QO,{className:"h-3 w-3 mr-1"}),"Auto-scroll"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!s&&a.jsxs(a.Fragment,{children:[a.jsxs(X,{variant:"outline",onClick:Xe,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:v,title:n.length===0?"Add participants to the focus group first":"Advance to the next part of the discussion guide",children:[a.jsx(Wo,{className:"mr-2 h-4 w-4"}),n.length===0?"No Participants":"Advance Discussion"]}),a.jsxs(X,{variant:"ghost",size:"sm",onClick:Q,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:v||n.length===0,title:"Generate a participant response to the current topic",children:[a.jsx(To,{className:"mr-1 h-3 w-3"}),"Get Response"]})]}),s&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1 text-sm text-slate-600",children:[a.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),a.jsx("span",{children:"AI Active"})]}),a.jsx(X,{variant:"outline",size:"sm",onClick:()=>D(!U),className:"hover-transition",title:"Show autonomous conversation controls",children:a.jsx(UE,{className:"h-3 w-3"})})]})]})]})]})]})},Hde=({themes:t,messages:e,personas:n=[],onThemeDelete:r,onQuoteClick:i})=>{const s=(d,f)=>{d.stopPropagation(),r&&(r(f),ne.success("Theme deleted successfully"))},o=d=>n.find(f=>f.id===d||f._id===d),c=d=>{let f=d;const h=d.match(/^\[MSG_ID:[^\]]+\]\s*(.*)$/);h&&(f=h[1]);const p=f.match(/^\[([^\]]+)\]:\s*(.*)$/);if(p)return{persona:p[1],text:p[2]};const g=f.match(/^([^:]+):\s*(.*)$/);return g&&g[1].trim()!==f.trim()?{persona:g[1].trim(),text:g[2]}:{persona:null,text:f}},l=t.filter(d=>"source"in d?d.source==="highlight":!0),u=t.filter(d=>"source"in d&&d.source==="generated");return a.jsxs("div",{className:"glass-panel rounded-xl p-6 h-[70vh] flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(hu,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Key Themes"})]}),a.jsxs("div",{className:"overflow-auto",children:[u.length>0&&a.jsxs("div",{className:"mb-8",children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(du,{className:"h-4 w-4 text-primary mr-2"}),a.jsx("h3",{className:"font-medium",children:"AI-Generated Themes"})]}),a.jsx("div",{className:"grid grid-cols-1 gap-4 mb-4",children:u.map(d=>a.jsxs(lt,{className:"hover:shadow-md transition-shadow relative group",children:[r&&a.jsx("button",{className:"absolute top-2 right-2 p-1 rounded-full bg-slate-200 opacity-0 group-hover:opacity-100 transition-opacity",onClick:f=>s(f,d.id),children:a.jsx(Mi,{className:"h-3 w-3 text-slate-700"})}),a.jsx(Ei,{className:"pb-2",children:a.jsx(Yi,{className:"text-base",children:d.title})}),a.jsxs(Ot,{children:[a.jsx("p",{className:"text-sm text-slate-600 mb-2",children:d.description}),d.quotes&&d.quotes.length>0&&a.jsxs("div",{className:"mt-3",children:[a.jsx("h4",{className:"text-xs font-medium text-slate-700 mb-2",children:"Supporting Quotes:"}),a.jsx("div",{className:"space-y-2",children:d.quotes.map((f,h)=>{const p=typeof f=="object"&&f!==null,g=p?f.text:f,m=p?f.speaker:c(f).persona,v=p?f.message_id:void 0,b=p?f.original:f;return a.jsxs("div",{className:"bg-slate-50 p-2 rounded text-xs text-slate-600 border-l-2 border-slate-200 cursor-pointer hover:bg-slate-100 transition-colors",onClick:x=>{x.stopPropagation(),i&&i(p?f:b,v)},title:v?`Message ID: ${v}`:"Click to find original message",children:[m&&a.jsxs("span",{className:"font-semibold text-slate-700 mr-1",children:[m,":"]}),'"',g,'"',v&&a.jsx("span",{className:"ml-2 text-xs text-green-600 opacity-70",children:"āœ“"})]},h)})})]})]})]},d.id))})]}),l.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(oZ,{className:"h-4 w-4 text-primary mr-2"}),a.jsx("h3",{className:"font-medium",children:"Highlighted Comments"})]}),a.jsx("div",{className:"grid grid-cols-1 gap-4 mb-4",children:l.map(d=>{const f=d.messages.length>0?e.find(v=>v.id===d.messages[0]):null,h=(f==null?void 0:f.text)||d.text,p=h.length>200?h.substring(0,200)+"...":h,g=f==null?void 0:f.senderId;let m="";if(g==="moderator")m="AI Moderator";else if(g==="facilitator")m="Human Facilitator";else if(g){const v=o(g);m=(v==null?void 0:v.name)||"Unknown Participant"}return a.jsxs(lt,{className:"hover:shadow-md hover:bg-slate-50 transition-all cursor-pointer relative group",onClick:v=>{v.stopPropagation(),i&&f&&i(f.text,f.id)},title:"Click to view in discussion",children:[r&&a.jsx("button",{className:"absolute top-2 right-2 p-1 rounded-full bg-slate-200 opacity-0 group-hover:opacity-100 transition-opacity z-10",onClick:v=>s(v,d.id),children:a.jsx(Mi,{className:"h-3 w-3 text-slate-700"})}),a.jsx(Ei,{className:"pb-2",children:a.jsx(Yi,{className:"text-sm font-medium text-slate-800 line-clamp-2",children:m&&a.jsx("span",{className:"text-primary font-semibold",children:m})})}),a.jsxs(Ot,{className:"pt-0",children:[a.jsxs("p",{className:"text-sm text-slate-600 leading-relaxed",children:['"',p,'"']}),a.jsxs("div",{className:"mt-2 flex items-center text-xs text-slate-400",children:[a.jsx(To,{className:"h-3 w-3 mr-1"}),"Click to view in discussion"]})]})]},d.id)})})]}),t.length===0&&a.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center bg-slate-50 rounded-lg",children:[a.jsx(hu,{className:"h-8 w-8 text-slate-400 mb-3"}),a.jsx("p",{className:"text-slate-600",children:"No themes have been identified yet."}),a.jsx("p",{className:"text-sm text-slate-500 mt-2",children:"Highlight important messages in the discussion or generate themes automatically."})]})]})]})},zde=({themes:t,messages:e,personas:n,focusGroupId:r,onThemesGenerated:i,onThemeDelete:s,onQuoteClick:o,onGenerateKeyThemes:c})=>{const l=()=>{if(!t||t.length===0){ne.warning("No themes to export",{description:"Generate some themes first before exporting."});return}let u=`# Key Themes Analysis + +`;const d=t.filter(g=>"source"in g&&g.source==="generated");if(d.length===0){ne.warning("No AI-generated themes to export",{description:"Only AI-generated themes are included in the export."});return}d.forEach((g,m)=>{u+=`## ${m+1}. ${g.title} + +`,u+=`${g.description} + +`,g.quotes&&g.quotes.length>0&&(u+=`**Supporting Quotes:** + +`,g.quotes.forEach(v=>{if(typeof v=="string")u+=`> ${v} + +`;else{let b="";v.speaker&&(b+=`**${v.speaker}:** `),b+=v.text,u+=`> ${b} + +`}})),u+=`--- + +`});const f=new Blob([u],{type:"text/markdown"}),h=URL.createObjectURL(f),p=document.createElement("a");p.href=h,p.download=`key-themes-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(h),ne.success("Themes exported successfully",{description:`Downloaded ${d.length} themes as markdown file.`})};return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"mb-4 space-y-2",children:[a.jsxs(X,{onClick:c,className:"w-full",children:[a.jsx(vZ,{className:"mr-2 h-4 w-4"}),"Analyze Discussion for Key Themes"]}),a.jsxs(X,{onClick:l,disabled:!t||t.length===0,variant:"outline",className:"w-full",children:[a.jsx(Jc,{className:"mr-2 h-4 w-4"}),"Export Themes"]})]}),a.jsx("div",{className:"flex-grow overflow-hidden",children:a.jsx(Hde,{themes:t,messages:e,personas:n,onThemeDelete:s,focusGroupId:r,onQuoteClick:o})})]})};var Vde=Array.isArray,Hi=Vde,Gde=typeof Hg=="object"&&Hg&&Hg.Object===Object&&Hg,_V=Gde,Kde=_V,Wde=typeof self=="object"&&self&&self.Object===Object&&self,qde=Kde||Wde||Function("return this")(),ta=qde,Yde=ta,Qde=Yde.Symbol,kg=Qde,NR=kg,AV=Object.prototype,Xde=AV.hasOwnProperty,Jde=AV.toString,Nh=NR?NR.toStringTag:void 0;function Zde(t){var e=Xde.call(t,Nh),n=t[Nh];try{t[Nh]=void 0;var r=!0}catch{}var i=Jde.call(t);return r&&(e?t[Nh]=n:delete t[Nh]),i}var efe=Zde,tfe=Object.prototype,nfe=tfe.toString;function rfe(t){return nfe.call(t)}var ife=rfe,TR=kg,sfe=efe,ofe=ife,afe="[object Null]",cfe="[object Undefined]",PR=TR?TR.toStringTag:void 0;function lfe(t){return t==null?t===void 0?cfe:afe:PR&&PR in Object(t)?sfe(t):ofe(t)}var qa=lfe;function ufe(t){return t!=null&&typeof t=="object"}var Ya=ufe,dfe=qa,ffe=Ya,hfe="[object Symbol]";function pfe(t){return typeof t=="symbol"||ffe(t)&&dfe(t)==hfe}var Qf=pfe,mfe=Hi,gfe=Qf,vfe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,yfe=/^\w*$/;function xfe(t,e){if(mfe(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||gfe(t)?!0:yfe.test(t)||!vfe.test(t)||e!=null&&t in Object(e)}var XT=xfe;function bfe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var pl=bfe;const Xf=dn(pl);var wfe=qa,Sfe=pl,Cfe="[object AsyncFunction]",_fe="[object Function]",Afe="[object GeneratorFunction]",jfe="[object Proxy]";function Efe(t){if(!Sfe(t))return!1;var e=wfe(t);return e==_fe||e==Afe||e==Cfe||e==jfe}var JT=Efe;const At=dn(JT);var Nfe=ta,Tfe=Nfe["__core-js_shared__"],Pfe=Tfe,rC=Pfe,kR=function(){var t=/[^.]+$/.exec(rC&&rC.keys&&rC.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function kfe(t){return!!kR&&kR in t}var Ofe=kfe,Ife=Function.prototype,Rfe=Ife.toString;function Mfe(t){if(t!=null){try{return Rfe.call(t)}catch{}try{return t+""}catch{}}return""}var jV=Mfe,Dfe=JT,$fe=Ofe,Lfe=pl,Ffe=jV,Ufe=/[\\^$.*+?()[\]{}|]/g,Bfe=/^\[object .+?Constructor\]$/,Hfe=Function.prototype,zfe=Object.prototype,Vfe=Hfe.toString,Gfe=zfe.hasOwnProperty,Kfe=RegExp("^"+Vfe.call(Gfe).replace(Ufe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Wfe(t){if(!Lfe(t)||$fe(t))return!1;var e=Dfe(t)?Kfe:Bfe;return e.test(Ffe(t))}var qfe=Wfe;function Yfe(t,e){return t==null?void 0:t[e]}var Qfe=Yfe,Xfe=qfe,Jfe=Qfe;function Zfe(t,e){var n=Jfe(t,e);return Xfe(n)?n:void 0}var Mu=Zfe,ehe=Mu,the=ehe(Object,"create"),uw=the,OR=uw;function nhe(){this.__data__=OR?OR(null):{},this.size=0}var rhe=nhe;function ihe(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var she=ihe,ohe=uw,ahe="__lodash_hash_undefined__",che=Object.prototype,lhe=che.hasOwnProperty;function uhe(t){var e=this.__data__;if(ohe){var n=e[t];return n===ahe?void 0:n}return lhe.call(e,t)?e[t]:void 0}var dhe=uhe,fhe=uw,hhe=Object.prototype,phe=hhe.hasOwnProperty;function mhe(t){var e=this.__data__;return fhe?e[t]!==void 0:phe.call(e,t)}var ghe=mhe,vhe=uw,yhe="__lodash_hash_undefined__";function xhe(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=vhe&&e===void 0?yhe:e,this}var bhe=xhe,whe=rhe,She=she,Che=dhe,_he=ghe,Ahe=bhe;function Jf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var Hhe=Bhe,zhe=dw;function Vhe(t,e){var n=this.__data__,r=zhe(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var Ghe=Vhe,Khe=Nhe,Whe=Dhe,qhe=Fhe,Yhe=Hhe,Qhe=Ghe;function Zf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e0?1:-1},Ul=function(e){return Og(e)&&e.indexOf("%")===e.length-1},je=function(e){return vme(e)&&!th(e)},Tr=function(e){return je(e)||Og(e)},wme=0,nh=function(e){var n=++wme;return"".concat(e||"").concat(n)},yi=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!je(e)&&!Og(e))return r;var s;if(Ul(e)){var o=e.indexOf("%");s=n*parseFloat(e.slice(0,o))/100}else s=+e;return th(s)&&(s=r),i&&s>n&&(s=n),s},hc=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},Sme=function(e){if(!Array.isArray(e))return!1;for(var n=e.length,r={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Nme(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function LA(t){"@babel/helpers - typeof";return LA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},LA(t)}var FR={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"},Ea=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},UR=null,sC=null,cP=function t(e){if(e===UR&&Array.isArray(sC))return sC;var n=[];return y.Children.forEach(e,function(r){Dt(r)||(MV.isFragment(r)?n=n.concat(t(r.props.children)):n.push(r))}),sC=n,UR=e,n};function js(t,e){var n=[],r=[];return Array.isArray(e)?r=e.map(function(i){return Ea(i)}):r=[Ea(e)],cP(t).forEach(function(i){var s=rs(i,"type.displayName")||rs(i,"type.name");r.indexOf(s)!==-1&&n.push(i)}),n}function qi(t,e){var n=js(t,e);return n&&n[0]}var BR=function(e){if(!e||!e.props)return!1;var n=e.props,r=n.width,i=n.height;return!(!je(r)||r<=0||!je(i)||i<=0)},Tme=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],Pme=function(e){return e&&e.type&&Og(e.type)&&Tme.indexOf(e.type)>=0},kme=function(e){return e&&LA(e)==="object"&&"clipDot"in e},Ome=function(e,n,r,i){var s,o=(s=iC==null?void 0:iC[i])!==null&&s!==void 0?s:[];return!At(e)&&(i&&o.includes(n)||_me.includes(n))||r&&aP.includes(n)},rt=function(e,n,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(y.isValidElement(e)&&(i=e.props),!Xf(i))return null;var s={};return Object.keys(i).forEach(function(o){var c;Ome((c=i)===null||c===void 0?void 0:c[o],o,n,r)&&(s[o]=i[o])}),s},FA=function t(e,n){if(e===n)return!0;var r=y.Children.count(e);if(r!==y.Children.count(n))return!1;if(r===0)return!0;if(r===1)return HR(Array.isArray(e)?e[0]:e,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function $me(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function BA(t){var e=t.children,n=t.width,r=t.height,i=t.viewBox,s=t.className,o=t.style,c=t.title,l=t.desc,u=Dme(t,Mme),d=i||{width:n,height:r,x:0,y:0},f=It("recharts-surface",s);return P.createElement("svg",UA({},rt(u,!0,"svg"),{className:f,width:n,height:r,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),P.createElement("title",null,c),P.createElement("desc",null,l),e)}var Lme=["children","className"];function HA(){return HA=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Ume(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var qt=P.forwardRef(function(t,e){var n=t.children,r=t.className,i=Fme(t,Lme),s=It("recharts-layer",r);return P.createElement("g",HA({className:s},rt(i,!0),{ref:e}),n)}),ro=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;si?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r=r?t:zme(t,e,n)}var Gme=Vme,Kme="\\ud800-\\udfff",Wme="\\u0300-\\u036f",qme="\\ufe20-\\ufe2f",Yme="\\u20d0-\\u20ff",Qme=Wme+qme+Yme,Xme="\\ufe0e\\ufe0f",Jme="\\u200d",Zme=RegExp("["+Jme+Kme+Qme+Xme+"]");function ege(t){return Zme.test(t)}var $V=ege;function tge(t){return t.split("")}var nge=tge,LV="\\ud800-\\udfff",rge="\\u0300-\\u036f",ige="\\ufe20-\\ufe2f",sge="\\u20d0-\\u20ff",oge=rge+ige+sge,age="\\ufe0e\\ufe0f",cge="["+LV+"]",zA="["+oge+"]",VA="\\ud83c[\\udffb-\\udfff]",lge="(?:"+zA+"|"+VA+")",FV="[^"+LV+"]",UV="(?:\\ud83c[\\udde6-\\uddff]){2}",BV="[\\ud800-\\udbff][\\udc00-\\udfff]",uge="\\u200d",HV=lge+"?",zV="["+age+"]?",dge="(?:"+uge+"(?:"+[FV,UV,BV].join("|")+")"+zV+HV+")*",fge=zV+HV+dge,hge="(?:"+[FV+zA+"?",zA,UV,BV,cge].join("|")+")",pge=RegExp(VA+"(?="+VA+")|"+hge+fge,"g");function mge(t){return t.match(pge)||[]}var gge=mge,vge=nge,yge=$V,xge=gge;function bge(t){return yge(t)?xge(t):vge(t)}var wge=bge,Sge=Gme,Cge=$V,_ge=wge,Age=PV;function jge(t){return function(e){e=Age(e);var n=Cge(e)?_ge(e):void 0,r=n?n[0]:e.charAt(0),i=n?Sge(n,1).join(""):e.slice(1);return r[t]()+i}}var Ege=jge,Nge=Ege,Tge=Nge("toUpperCase"),Pge=Tge;const Aw=dn(Pge);function Tn(t){return function(){return t}}const VV=Math.cos,Kx=Math.sin,xo=Math.sqrt,Wx=Math.PI,jw=2*Wx,GA=Math.PI,KA=2*GA,El=1e-6,kge=KA-El;function GV(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return GV;const n=10**e;return function(r){this._+=r[0];for(let i=1,s=r.length;iEl)if(!(Math.abs(f*l-u*d)>El)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let p=r-o,g=i-c,m=l*l+u*u,v=p*p+g*g,b=Math.sqrt(m),x=Math.sqrt(h),w=s*Math.tan((GA-Math.acos((m+h-v)/(2*b*x)))/2),S=w/x,C=w/b;Math.abs(S-1)>El&&this._append`L${e+S*d},${n+S*f}`,this._append`A${s},${s},0,0,${+(f*p>d*g)},${this._x1=e+C*l},${this._y1=n+C*u}`}}arc(e,n,r,i,s,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let c=r*Math.cos(i),l=r*Math.sin(i),u=e+c,d=n+l,f=1^o,h=o?i-s:s-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>El||Math.abs(this._y1-d)>El)&&this._append`L${u},${d}`,r&&(h<0&&(h=h%KA+KA),h>kge?this._append`A${r},${r},0,1,${f},${e-c},${n-l}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:h>El&&this._append`A${r},${r},0,${+(h>=GA)},${f},${this._x1=e+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function lP(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new Ige(e)}function uP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function KV(t){this._context=t}KV.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Ew(t){return new KV(t)}function WV(t){return t[0]}function qV(t){return t[1]}function YV(t,e){var n=Tn(!0),r=null,i=Ew,s=null,o=lP(c);t=typeof t=="function"?t:t===void 0?WV:Tn(t),e=typeof e=="function"?e:e===void 0?qV:Tn(e);function c(l){var u,d=(l=uP(l)).length,f,h=!1,p;for(r==null&&(s=i(p=o())),u=0;u<=d;++u)!(u=p;--g)c.point(w[g],S[g]);c.lineEnd(),c.areaEnd()}b&&(w[h]=+t(v,h,f),S[h]=+e(v,h,f),c.point(r?+r(v,h,f):w[h],n?+n(v,h,f):S[h]))}if(x)return c=null,x+""||null}function d(){return YV().defined(i).curve(o).context(s)}return u.x=function(f){return arguments.length?(t=typeof f=="function"?f:Tn(+f),r=null,u):t},u.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Tn(+f),u):t},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Tn(+f),u):r},u.y=function(f){return arguments.length?(e=typeof f=="function"?f:Tn(+f),n=null,u):e},u.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Tn(+f),u):e},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Tn(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(t).y(e)},u.lineY1=function(){return d().x(t).y(n)},u.lineX1=function(){return d().x(r).y(e)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Tn(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,s!=null&&(c=o(s)),u):o},u.context=function(f){return arguments.length?(f==null?s=c=null:c=o(s=f),u):s},u}class QV{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function Rge(t){return new QV(t,!0)}function Mge(t){return new QV(t,!1)}const dP={draw(t,e){const n=xo(e/Wx);t.moveTo(n,0),t.arc(0,0,n,0,jw)}},Dge={draw(t,e){const n=xo(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},XV=xo(1/3),$ge=XV*2,Lge={draw(t,e){const n=xo(e/$ge),r=n*XV;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},Fge={draw(t,e){const n=xo(e),r=-n/2;t.rect(r,r,n,n)}},Uge=.8908130915292852,JV=Kx(Wx/10)/Kx(7*Wx/10),Bge=Kx(jw/10)*JV,Hge=-VV(jw/10)*JV,zge={draw(t,e){const n=xo(e*Uge),r=Bge*n,i=Hge*n;t.moveTo(0,-n),t.lineTo(r,i);for(let s=1;s<5;++s){const o=jw*s/5,c=VV(o),l=Kx(o);t.lineTo(l*n,-c*n),t.lineTo(c*r-l*i,l*r+c*i)}t.closePath()}},oC=xo(3),Vge={draw(t,e){const n=-xo(e/(oC*3));t.moveTo(0,n*2),t.lineTo(-oC*n,-n),t.lineTo(oC*n,-n),t.closePath()}},cs=-.5,ls=xo(3)/2,WA=1/xo(12),Gge=(WA/2+1)*3,Kge={draw(t,e){const n=xo(e/Gge),r=n/2,i=n*WA,s=r,o=n*WA+n,c=-s,l=o;t.moveTo(r,i),t.lineTo(s,o),t.lineTo(c,l),t.lineTo(cs*r-ls*i,ls*r+cs*i),t.lineTo(cs*s-ls*o,ls*s+cs*o),t.lineTo(cs*c-ls*l,ls*c+cs*l),t.lineTo(cs*r+ls*i,cs*i-ls*r),t.lineTo(cs*s+ls*o,cs*o-ls*s),t.lineTo(cs*c+ls*l,cs*l-ls*c),t.closePath()}};function Wge(t,e){let n=null,r=lP(i);t=typeof t=="function"?t:Tn(t||dP),e=typeof e=="function"?e:Tn(e===void 0?64:+e);function i(){let s;if(n||(n=s=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),s)return n=null,s+""||null}return i.type=function(s){return arguments.length?(t=typeof s=="function"?s:Tn(s),i):t},i.size=function(s){return arguments.length?(e=typeof s=="function"?s:Tn(+s),i):e},i.context=function(s){return arguments.length?(n=s??null,i):n},i}function qx(){}function Yx(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function ZV(t){this._context=t}ZV.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Yx(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Yx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function qge(t){return new ZV(t)}function eG(t){this._context=t}eG.prototype={areaStart:qx,areaEnd:qx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Yx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Yge(t){return new eG(t)}function tG(t){this._context=t}tG.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Yx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Qge(t){return new tG(t)}function nG(t){this._context=t}nG.prototype={areaStart:qx,areaEnd:qx,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Xge(t){return new nG(t)}function VR(t){return t<0?-1:1}function GR(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),c=(s*i+o*r)/(r+i);return(VR(s)+VR(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(c))||0}function KR(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function aC(t,e,n){var r=t._x0,i=t._y0,s=t._x1,o=t._y1,c=(s-r)/3;t._context.bezierCurveTo(r+c,i+c*e,s-c,o-c*n,s,o)}function Qx(t){this._context=t}Qx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:aC(this,this._t0,KR(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,aC(this,KR(this,n=GR(this,t,e)),n);break;default:aC(this,this._t0,n=GR(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function rG(t){this._context=new iG(t)}(rG.prototype=Object.create(Qx.prototype)).point=function(t,e){Qx.prototype.point.call(this,e,t)};function iG(t){this._context=t}iG.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,s){this._context.bezierCurveTo(e,t,r,n,s,i)}};function Jge(t){return new Qx(t)}function Zge(t){return new rG(t)}function sG(t){this._context=t}sG.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=WR(t),i=WR(e),s=0,o=1;o=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function tve(t){return new Nw(t,.5)}function nve(t){return new Nw(t,0)}function rve(t){return new Nw(t,1)}function sf(t,e){if((o=t.length)>1)for(var n=1,r,i,s=t[e[0]],o,c=s.length;n=0;)n[e]=e;return n}function ive(t,e){return t[e]}function sve(t){const e=[];return e.key=t,e}function ove(){var t=Tn([]),e=qA,n=sf,r=ive;function i(s){var o=Array.from(t.apply(this,arguments),sve),c,l=o.length,u=-1,d;for(const f of s)for(c=0,++u;c0){for(var n,r,i=0,s=t[0].length,o;i0){for(var n=0,r=t[e[0]],i,s=r.length;n0)||!((s=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,s,o;r=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function mve(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var oG={symbolCircle:dP,symbolCross:Dge,symbolDiamond:Lge,symbolSquare:Fge,symbolStar:zge,symbolTriangle:Vge,symbolWye:Kge},gve=Math.PI/180,vve=function(e){var n="symbol".concat(Aw(e));return oG[n]||dP},yve=function(e,n,r){if(n==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var i=18*gve;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},xve=function(e,n){oG["symbol".concat(Aw(e))]=n},fP=function(e){var n=e.type,r=n===void 0?"circle":n,i=e.size,s=i===void 0?64:i,o=e.sizeType,c=o===void 0?"area":o,l=pve(e,uve),u=YR(YR({},l),{},{type:r,size:s,sizeType:c}),d=function(){var v=vve(r),b=Wge().type(v).size(yve(s,c,r));return b()},f=u.className,h=u.cx,p=u.cy,g=rt(u,!0);return h===+h&&p===+p&&s===+s?P.createElement("path",YA({},g,{className:It("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};fP.registerSymbol=xve;function of(t){"@babel/helpers - typeof";return of=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},of(t)}function QA(){return QA=Object.assign?Object.assign.bind():function(t){for(var e=1;e`);var x=p.inactive?u:p.color;return P.createElement("li",QA({className:v,style:f,key:"legend-item-".concat(g)},Cu(r.props,p,g)),P.createElement(BA,{width:o,height:o,viewBox:d,style:h},r.renderIcon(p)),P.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},m?m(b,p,g):b))})}},{key:"render",value:function(){var r=this.props,i=r.payload,s=r.layout,o=r.align;if(!i||!i.length)return null;var c={padding:0,margin:0,textAlign:s==="horizontal"?o:"left"};return P.createElement("ul",{className:"recharts-default-legend",style:c},this.renderItems())}}])}(y.PureComponent);_m(hP,"displayName","Legend");_m(hP,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Tve=fw;function Pve(){this.__data__=new Tve,this.size=0}var kve=Pve;function Ove(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var Ive=Ove;function Rve(t){return this.__data__.get(t)}var Mve=Rve;function Dve(t){return this.__data__.has(t)}var $ve=Dve,Lve=fw,Fve=eP,Uve=tP,Bve=200;function Hve(t,e){var n=this.__data__;if(n instanceof Lve){var r=n.__data__;if(!Fve||r.lengthc))return!1;var u=s.get(t),d=s.get(e);if(u&&d)return u==e&&d==t;var f=-1,h=!0,p=n&uye?new oye:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=pxe}var vP=mxe,gxe=qa,vxe=vP,yxe=Ya,xxe="[object Arguments]",bxe="[object Array]",wxe="[object Boolean]",Sxe="[object Date]",Cxe="[object Error]",_xe="[object Function]",Axe="[object Map]",jxe="[object Number]",Exe="[object Object]",Nxe="[object RegExp]",Txe="[object Set]",Pxe="[object String]",kxe="[object WeakMap]",Oxe="[object ArrayBuffer]",Ixe="[object DataView]",Rxe="[object Float32Array]",Mxe="[object Float64Array]",Dxe="[object Int8Array]",$xe="[object Int16Array]",Lxe="[object Int32Array]",Fxe="[object Uint8Array]",Uxe="[object Uint8ClampedArray]",Bxe="[object Uint16Array]",Hxe="[object Uint32Array]",In={};In[Rxe]=In[Mxe]=In[Dxe]=In[$xe]=In[Lxe]=In[Fxe]=In[Uxe]=In[Bxe]=In[Hxe]=!0;In[xxe]=In[bxe]=In[Oxe]=In[wxe]=In[Ixe]=In[Sxe]=In[Cxe]=In[_xe]=In[Axe]=In[jxe]=In[Exe]=In[Nxe]=In[Txe]=In[Pxe]=In[kxe]=!1;function zxe(t){return yxe(t)&&vxe(t.length)&&!!In[gxe(t)]}var Vxe=zxe;function Gxe(t){return function(e){return t(e)}}var vG=Gxe,eb={exports:{}};eb.exports;(function(t,e){var n=_V,r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,s=i&&i.exports===r,o=s&&n.process,c=function(){try{var l=i&&i.require&&i.require("util").types;return l||o&&o.binding&&o.binding("util")}catch{}}();t.exports=c})(eb,eb.exports);var Kxe=eb.exports,Wxe=Vxe,qxe=vG,n2=Kxe,r2=n2&&n2.isTypedArray,Yxe=r2?qxe(r2):Wxe,yG=Yxe,Qxe=Zye,Xxe=mP,Jxe=Hi,Zxe=gG,ebe=gP,tbe=yG,nbe=Object.prototype,rbe=nbe.hasOwnProperty;function ibe(t,e){var n=Jxe(t),r=!n&&Xxe(t),i=!n&&!r&&Zxe(t),s=!n&&!r&&!i&&tbe(t),o=n||r||i||s,c=o?Qxe(t.length,String):[],l=c.length;for(var u in t)(e||rbe.call(t,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||ebe(u,l)))&&c.push(u);return c}var sbe=ibe,obe=Object.prototype;function abe(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||obe;return t===n}var cbe=abe;function lbe(t,e){return function(n){return t(e(n))}}var xG=lbe,ube=xG,dbe=ube(Object.keys,Object),fbe=dbe,hbe=cbe,pbe=fbe,mbe=Object.prototype,gbe=mbe.hasOwnProperty;function vbe(t){if(!hbe(t))return pbe(t);var e=[];for(var n in Object(t))gbe.call(t,n)&&n!="constructor"&&e.push(n);return e}var ybe=vbe,xbe=JT,bbe=vP;function wbe(t){return t!=null&&bbe(t.length)&&!xbe(t)}var Ig=wbe,Sbe=sbe,Cbe=ybe,_be=Ig;function Abe(t){return _be(t)?Sbe(t):Cbe(t)}var Tw=Abe,jbe=Bye,Ebe=Xye,Nbe=Tw;function Tbe(t){return jbe(t,Nbe,Ebe)}var Pbe=Tbe,i2=Pbe,kbe=1,Obe=Object.prototype,Ibe=Obe.hasOwnProperty;function Rbe(t,e,n,r,i,s){var o=n&kbe,c=i2(t),l=c.length,u=i2(e),d=u.length;if(l!=d&&!o)return!1;for(var f=l;f--;){var h=c[f];if(!(o?h in e:Ibe.call(e,h)))return!1}var p=s.get(t),g=s.get(e);if(p&&g)return p==e&&g==t;var m=!0;s.set(t,e),s.set(e,t);for(var v=o;++f-1}var Owe=kwe;function Iwe(t,e,n){for(var r=-1,i=t==null?0:t.length;++r=qwe){var u=e?null:Kwe(t);if(u)return Wwe(u);o=!1,i=Gwe,l=new Hwe}else l=e?[]:c;e:for(;++r=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function uSe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function dSe(t){return t.value}function fSe(t,e){if(P.isValidElement(t))return P.cloneElement(t,e);if(typeof t=="function")return P.createElement(t,e);e.ref;var n=lSe(e,tSe);return P.createElement(hP,n)}var b2=1,Na=function(t){function e(){var n;nSe(this,e);for(var r=arguments.length,i=new Array(r),s=0;sb2||Math.abs(i.height-this.lastBoundingBox.height)>b2)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,r&&r(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?aa({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var i=this.props,s=i.layout,o=i.align,c=i.verticalAlign,l=i.margin,u=i.chartWidth,d=i.chartHeight,f,h;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(o==="center"&&s==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=o==="right"?{right:l&&l.right||0}:{left:l&&l.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(c==="middle"){var g=this.getBBoxSnapshot();h={top:((d||0)-g.height)/2}}else h=c==="bottom"?{bottom:l&&l.bottom||0}:{top:l&&l.top||0};return aa(aa({},f),h)}},{key:"render",value:function(){var r=this,i=this.props,s=i.content,o=i.width,c=i.height,l=i.wrapperStyle,u=i.payloadUniqBy,d=i.payload,f=aa(aa({position:"absolute",width:o||"auto",height:c||"auto"},this.getDefaultPosition(l)),l);return P.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){r.wrapperNode=p}},fSe(s,aa(aa({},this.props),{},{payload:jG(d,u,dSe)})))}}],[{key:"getWithHeight",value:function(r,i){var s=aa(aa({},this.defaultProps),r.props),o=s.layout;return o==="vertical"&&je(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||i}:null}}])}(y.PureComponent);Pw(Na,"displayName","Legend");Pw(Na,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var w2=kg,hSe=mP,pSe=Hi,S2=w2?w2.isConcatSpreadable:void 0;function mSe(t){return pSe(t)||hSe(t)||!!(S2&&t&&t[S2])}var gSe=mSe,vSe=pG,ySe=gSe;function TG(t,e,n,r,i){var s=-1,o=t.length;for(n||(n=ySe),i||(i=[]);++s0&&n(c)?e>1?TG(c,e-1,n,r,i):vSe(i,c):r||(i[i.length]=c)}return i}var PG=TG;function xSe(t){return function(e,n,r){for(var i=-1,s=Object(e),o=r(e),c=o.length;c--;){var l=o[t?c:++i];if(n(s[l],l,s)===!1)break}return e}}var bSe=xSe,wSe=bSe,SSe=wSe(),CSe=SSe,_Se=CSe,ASe=Tw;function jSe(t,e){return t&&_Se(t,e,ASe)}var kG=jSe,ESe=Ig;function NSe(t,e){return function(n,r){if(n==null)return n;if(!ESe(n))return t(n,r);for(var i=n.length,s=e?i:-1,o=Object(n);(e?s--:++se||s&&o&&l&&!c&&!u||r&&o&&l||!n&&l||!i)return 1;if(!r&&!s&&!u&&t=c)return l;var u=n[r];return l*(u=="desc"?-1:1)}}return t.index-e.index}var HSe=BSe,dC=rP,zSe=iP,VSe=na,GSe=OG,KSe=$Se,WSe=vG,qSe=HSe,YSe=sh,QSe=Hi;function XSe(t,e,n){e.length?e=dC(e,function(s){return QSe(s)?function(o){return zSe(o,s.length===1?s[0]:s)}:s}):e=[YSe];var r=-1;e=dC(e,WSe(VSe));var i=GSe(t,function(s,o,c){var l=dC(e,function(u){return u(s)});return{criteria:l,index:++r,value:s}});return KSe(i,function(s,o){return qSe(s,o,n)})}var JSe=XSe;function ZSe(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var eCe=ZSe,tCe=eCe,_2=Math.max;function nCe(t,e,n){return e=_2(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=_2(r.length-e,0),o=Array(s);++i0){if(++e>=fCe)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var gCe=mCe,vCe=dCe,yCe=gCe,xCe=yCe(vCe),bCe=xCe,wCe=sh,SCe=rCe,CCe=bCe;function _Ce(t,e){return CCe(SCe(t,e,wCe),t+"")}var ACe=_Ce,jCe=ZT,ECe=Ig,NCe=gP,TCe=pl;function PCe(t,e,n){if(!TCe(n))return!1;var r=typeof e;return(r=="number"?ECe(n)&&NCe(e,n.length):r=="string"&&e in n)?jCe(n[e],t):!1}var kw=PCe,kCe=PG,OCe=JSe,ICe=ACe,j2=kw,RCe=ICe(function(t,e){if(t==null)return[];var n=e.length;return n>1&&j2(t,e[0],e[1])?e=[]:n>2&&j2(e[0],e[1],e[2])&&(e=[e[0]]),OCe(t,kCe(e,1),[])}),MCe=RCe;const bP=dn(MCe);function Am(t){"@babel/helpers - typeof";return Am=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Am(t)}function i1(){return i1=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=e.x),"".concat(Th,"-left"),je(n)&&e&&je(e.x)&&n=e.y),"".concat(Th,"-top"),je(r)&&e&&je(e.y)&&rm?Math.max(d,l[r]):Math.max(f,l[r])}function QCe(t){var e=t.translateX,n=t.translateY,r=t.useTranslate3d;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function XCe(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTopLeft,i=t.position,s=t.reverseDirection,o=t.tooltipBox,c=t.useTranslate3d,l=t.viewBox,u,d,f;return o.height>0&&o.width>0&&n?(d=T2({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:r,position:i,reverseDirection:s,tooltipDimension:o.width,viewBox:l,viewBoxDimension:l.width}),f=T2({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:r,position:i,reverseDirection:s,tooltipDimension:o.height,viewBox:l,viewBoxDimension:l.height}),u=QCe({translateX:d,translateY:f,useTranslate3d:c})):u=qCe,{cssProperties:u,cssClasses:YCe({translateX:d,translateY:f,coordinate:n})}}function cf(t){"@babel/helpers - typeof";return cf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cf(t)}function P2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function k2(t){for(var e=1;eO2||Math.abs(r.height-this.state.lastBoundingBox.height)>O2)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,i=this.props,s=i.active,o=i.allowEscapeViewBox,c=i.animationDuration,l=i.animationEasing,u=i.children,d=i.coordinate,f=i.hasPayload,h=i.isAnimationActive,p=i.offset,g=i.position,m=i.reverseDirection,v=i.useTranslate3d,b=i.viewBox,x=i.wrapperStyle,w=XCe({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:p,position:g,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:v,viewBox:b}),S=w.cssClasses,C=w.cssProperties,_=k2(k2({transition:h&&s?"transform ".concat(c,"ms ").concat(l):void 0},C),{},{pointerEvents:"none",visibility:!this.state.dismissed&&s&&f?"visible":"hidden",position:"absolute",top:0,left:0},x);return P.createElement("div",{tabIndex:-1,className:S,style:_,ref:function(j){r.wrapperNode=j}},u)}}])}(y.PureComponent),a_e=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},io={isSsr:a_e(),get:function(e){return io[e]},set:function(e,n){if(typeof e=="string")io[e]=n;else{var r=Object.keys(e);r&&r.length&&r.forEach(function(i){io[i]=e[i]})}}};function lf(t){"@babel/helpers - typeof";return lf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lf(t)}function I2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function R2(t){for(var e=1;e0;return P.createElement(o_e,{allowEscapeViewBox:o,animationDuration:c,animationEasing:l,isAnimationActive:h,active:s,coordinate:d,hasPayload:_,offset:p,position:v,reverseDirection:b,useTranslate3d:x,viewBox:w,wrapperStyle:S},v_e(u,R2(R2({},this.props),{},{payload:C})))}}])}(y.PureComponent);wP(ni,"displayName","Tooltip");wP(ni,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!io.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var y_e=ta,x_e=function(){return y_e.Date.now()},b_e=x_e,w_e=/\s/;function S_e(t){for(var e=t.length;e--&&w_e.test(t.charAt(e)););return e}var C_e=S_e,__e=C_e,A_e=/^\s+/;function j_e(t){return t&&t.slice(0,__e(t)+1).replace(A_e,"")}var E_e=j_e,N_e=E_e,M2=pl,T_e=Qf,D2=NaN,P_e=/^[-+]0x[0-9a-f]+$/i,k_e=/^0b[01]+$/i,O_e=/^0o[0-7]+$/i,I_e=parseInt;function R_e(t){if(typeof t=="number")return t;if(T_e(t))return D2;if(M2(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=M2(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=N_e(t);var n=k_e.test(t);return n||O_e.test(t)?I_e(t.slice(2),n?2:8):P_e.test(t)?D2:+t}var LG=R_e,M_e=pl,hC=b_e,$2=LG,D_e="Expected a function",$_e=Math.max,L_e=Math.min;function F_e(t,e,n){var r,i,s,o,c,l,u=0,d=!1,f=!1,h=!0;if(typeof t!="function")throw new TypeError(D_e);e=$2(e)||0,M_e(n)&&(d=!!n.leading,f="maxWait"in n,s=f?$_e($2(n.maxWait)||0,e):s,h="trailing"in n?!!n.trailing:h);function p(_){var A=r,j=i;return r=i=void 0,u=_,o=t.apply(j,A),o}function g(_){return u=_,c=setTimeout(b,e),d?p(_):o}function m(_){var A=_-l,j=_-u,T=e-A;return f?L_e(T,s-j):T}function v(_){var A=_-l,j=_-u;return l===void 0||A>=e||A<0||f&&j>=s}function b(){var _=hC();if(v(_))return x(_);c=setTimeout(b,m(_))}function x(_){return c=void 0,h&&r?p(_):(r=i=void 0,o)}function w(){c!==void 0&&clearTimeout(c),u=0,r=l=i=c=void 0}function S(){return c===void 0?o:x(hC())}function C(){var _=hC(),A=v(_);if(r=arguments,i=this,l=_,A){if(c===void 0)return g(l);if(f)return clearTimeout(c),c=setTimeout(b,e),p(l)}return c===void 0&&(c=setTimeout(b,e)),o}return C.cancel=w,C.flush=S,C}var U_e=F_e,B_e=U_e,H_e=pl,z_e="Expected a function";function V_e(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError(z_e);return H_e(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),B_e(t,e,{leading:r,maxWait:e,trailing:i})}var G_e=V_e;const FG=dn(G_e);function Em(t){"@babel/helpers - typeof";return Em=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Em(t)}function L2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Av(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&(O=FG(O,m,{trailing:!0,leading:!1}));var M=new ResizeObserver(O),U=C.current.getBoundingClientRect(),D=U.width,B=U.height;return I(D,B),M.observe(C.current),function(){M.disconnect()}},[I,m]);var E=y.useMemo(function(){var O=T.containerWidth,M=T.containerHeight;if(O<0||M<0)return null;ro(Ul(o)||Ul(l),`The width(%s) and height(%s) are both fixed numbers, + maybe you don't need to use a ResponsiveContainer.`,o,l),ro(!n||n>0,"The aspect(%s) must be greater than zero.",n);var U=Ul(o)?O:o,D=Ul(l)?M:l;n&&n>0&&(U?D=U/n:D&&(U=D*n),h&&D>h&&(D=h)),ro(U>0||D>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,U,D,o,l,d,f,n);var B=!Array.isArray(p)&&Ea(p.type).endsWith("Chart");return P.Children.map(p,function(R){return MV.isElement(R)?y.cloneElement(R,Av({width:U,height:D},B?{style:Av({height:"100%",width:"100%",maxHeight:D,maxWidth:U},R.props.style)}:{})):R})},[n,p,l,h,f,d,T,o]);return P.createElement("div",{id:v?"".concat(v):void 0,className:It("recharts-responsive-container",b),style:Av(Av({},S),{},{width:o,height:l,minWidth:d,minHeight:f,maxHeight:h}),ref:C},E)}),Rg=function(e){return null};Rg.displayName="Cell";function Nm(t){"@babel/helpers - typeof";return Nm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nm(t)}function U2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function c1(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||io.isSsr)return{width:0,height:0};var r=sAe(n),i=JSON.stringify({text:e,copyStyle:r});if(Gu.widthCache[i])return Gu.widthCache[i];try{var s=document.getElementById(B2);s||(s=document.createElement("span"),s.setAttribute("id",B2),s.setAttribute("aria-hidden","true"),document.body.appendChild(s));var o=c1(c1({},iAe),r);Object.assign(s.style,o),s.textContent="".concat(e);var c=s.getBoundingClientRect(),l={width:c.width,height:c.height};return Gu.widthCache[i]=l,++Gu.cacheCount>rAe&&(Gu.cacheCount=0,Gu.widthCache={}),l}catch{return{width:0,height:0}}},oAe=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function Tm(t){"@babel/helpers - typeof";return Tm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Tm(t)}function ib(t,e){return uAe(t)||lAe(t,e)||cAe(t,e)||aAe()}function aAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cAe(t,e){if(t){if(typeof t=="string")return H2(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return H2(t,e)}}function H2(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function _Ae(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function q2(t,e){return NAe(t)||EAe(t,e)||jAe(t,e)||AAe()}function AAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jAe(t,e){if(t){if(typeof t=="string")return Y2(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Y2(t,e)}}function Y2(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[];return U.reduce(function(D,B){var R=B.word,L=B.width,Y=D[D.length-1];if(Y&&(i==null||s||Y.width+L+rB.width?D:B})};if(!d)return p;for(var m="…",v=function(U){var D=f.slice(0,U),B=zG({breakAll:u,style:l,children:D+m}).wordsWithComputedWidth,R=h(B),L=R.length>o||g(R).width>Number(i);return[L,R]},b=0,x=f.length-1,w=0,S;b<=x&&w<=f.length-1;){var C=Math.floor((b+x)/2),_=C-1,A=v(_),j=q2(A,2),T=j[0],k=j[1],I=v(C),E=q2(I,1),O=E[0];if(!T&&!O&&(b=C+1),T&&O&&(x=C-1),!T&&O){S=k;break}w++}return S||p},Q2=function(e){var n=Dt(e)?[]:e.toString().split(HG);return[{words:n}]},PAe=function(e){var n=e.width,r=e.scaleToFit,i=e.children,s=e.style,o=e.breakAll,c=e.maxLines;if((n||r)&&!io.isSsr){var l,u,d=zG({breakAll:o,children:i,style:s});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;l=f,u=h}else return Q2(i);return TAe({breakAll:o,children:i,maxLines:c,style:s},l,u,n,r)}return Q2(i)},X2="#808080",_u=function(e){var n=e.x,r=n===void 0?0:n,i=e.y,s=i===void 0?0:i,o=e.lineHeight,c=o===void 0?"1em":o,l=e.capHeight,u=l===void 0?"0.71em":l,d=e.scaleToFit,f=d===void 0?!1:d,h=e.textAnchor,p=h===void 0?"start":h,g=e.verticalAnchor,m=g===void 0?"end":g,v=e.fill,b=v===void 0?X2:v,x=W2(e,SAe),w=y.useMemo(function(){return PAe({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:f,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,f,x.style,x.width]),S=x.dx,C=x.dy,_=x.angle,A=x.className,j=x.breakAll,T=W2(x,CAe);if(!Tr(r)||!Tr(s))return null;var k=r+(je(S)?S:0),I=s+(je(C)?C:0),E;switch(m){case"start":E=pC("calc(".concat(u,")"));break;case"middle":E=pC("calc(".concat((w.length-1)/2," * -").concat(c," + (").concat(u," / 2))"));break;default:E=pC("calc(".concat(w.length-1," * -").concat(c,")"));break}var O=[];if(f){var M=w[0].width,U=x.width;O.push("scale(".concat((je(U)?U/M:1)/M,")"))}return _&&O.push("rotate(".concat(_,", ").concat(k,", ").concat(I,")")),O.length&&(T.transform=O.join(" ")),P.createElement("text",l1({},rt(T,!0),{x:k,y:I,className:It("recharts-text",A),textAnchor:p,fill:b.includes("url")?X2:b}),w.map(function(D,B){var R=D.words.join(j?"":" ");return P.createElement("tspan",{x:k,dy:B===0?E:c,key:"".concat(R,"-").concat(B)},R)}))};function Vc(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function kAe(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function SP(t){let e,n,r;t.length!==2?(e=Vc,n=(c,l)=>Vc(t(c),l),r=(c,l)=>t(c)-l):(e=t===Vc||t===kAe?t:OAe,n=t,r=t);function i(c,l,u=0,d=c.length){if(u>>1;n(c[f],l)<0?u=f+1:d=f}while(u>>1;n(c[f],l)<=0?u=f+1:d=f}while(uu&&r(c[f-1],l)>-r(c[f],l)?f-1:f}return{left:i,center:o,right:s}}function OAe(){return 0}function VG(t){return t===null?NaN:+t}function*IAe(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const RAe=SP(Vc),Mg=RAe.right;SP(VG).center;class J2 extends Map{constructor(e,n=$Ae){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,i]of e)this.set(r,i)}get(e){return super.get(Z2(this,e))}has(e){return super.has(Z2(this,e))}set(e,n){return super.set(MAe(this,e),n)}delete(e){return super.delete(DAe(this,e))}}function Z2({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function MAe({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function DAe({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function $Ae(t){return t!==null&&typeof t=="object"?t.valueOf():t}function LAe(t=Vc){if(t===Vc)return GG;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function GG(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const FAe=Math.sqrt(50),UAe=Math.sqrt(10),BAe=Math.sqrt(2);function sb(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=FAe?10:s>=UAe?5:s>=BAe?2:1;let c,l,u;return i<0?(u=Math.pow(10,-i)/o,c=Math.round(t*u),l=Math.round(e*u),c/ue&&--l,u=-u):(u=Math.pow(10,i)*o,c=Math.round(t/u),l=Math.round(e/u),c*ue&&--l),l0))return[];if(t===e)return[t];const r=e=i))return[];const c=s-i+1,l=new Array(c);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function tM(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function KG(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=i===void 0?GG:LAe(i);r>n;){if(r-n>600){const l=r-n+1,u=e-n+1,d=Math.log(l),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(l-f)/l)*(u-l/2<0?-1:1),p=Math.max(n,Math.floor(e-u*f/l+h)),g=Math.min(r,Math.floor(e+(l-u)*f/l+h));KG(t,e,p,g,i)}const s=t[e];let o=n,c=r;for(Ph(t,n,e),i(t[r],s)>0&&Ph(t,n,r);o0;)--c}i(t[n],s)===0?Ph(t,n,c):(++c,Ph(t,c,r)),c<=e&&(n=c+1),e<=c&&(r=c-1)}return t}function Ph(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function HAe(t,e,n){if(t=Float64Array.from(IAe(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return tM(t);if(e>=1)return eM(t);var r,i=(r-1)*e,s=Math.floor(i),o=eM(KG(t,s).subarray(0,s+1)),c=tM(t.subarray(s+1));return o+(c-o)*(i-s)}}function zAe(t,e,n=VG){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,s=Math.floor(i),o=+n(t[s],s,t),c=+n(t[s+1],s+1,t);return o+(c-o)*(i-s)}}function VAe(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,s=new Array(i);++r>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Ev(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Ev(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=KAe.exec(t))?new ki(e[1],e[2],e[3],1):(e=WAe.exec(t))?new ki(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=qAe.exec(t))?Ev(e[1],e[2],e[3],e[4]):(e=YAe.exec(t))?Ev(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=QAe.exec(t))?cM(e[1],e[2]/100,e[3]/100,1):(e=XAe.exec(t))?cM(e[1],e[2]/100,e[3]/100,e[4]):nM.hasOwnProperty(t)?sM(nM[t]):t==="transparent"?new ki(NaN,NaN,NaN,0):null}function sM(t){return new ki(t>>16&255,t>>8&255,t&255,1)}function Ev(t,e,n,r){return r<=0&&(t=e=n=NaN),new ki(t,e,n,r)}function e1e(t){return t instanceof Dg||(t=Im(t)),t?(t=t.rgb(),new ki(t.r,t.g,t.b,t.opacity)):new ki}function p1(t,e,n,r){return arguments.length===1?e1e(t):new ki(t,e,n,r??1)}function ki(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}_P(ki,p1,qG(Dg,{brighter(t){return t=t==null?ob:Math.pow(ob,t),new ki(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?km:Math.pow(km,t),new ki(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ki(nu(this.r),nu(this.g),nu(this.b),ab(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:oM,formatHex:oM,formatHex8:t1e,formatRgb:aM,toString:aM}));function oM(){return`#${Bl(this.r)}${Bl(this.g)}${Bl(this.b)}`}function t1e(){return`#${Bl(this.r)}${Bl(this.g)}${Bl(this.b)}${Bl((isNaN(this.opacity)?1:this.opacity)*255)}`}function aM(){const t=ab(this.opacity);return`${t===1?"rgb(":"rgba("}${nu(this.r)}, ${nu(this.g)}, ${nu(this.b)}${t===1?")":`, ${t})`}`}function ab(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function nu(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Bl(t){return t=nu(t),(t<16?"0":"")+t.toString(16)}function cM(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new qs(t,e,n,r)}function YG(t){if(t instanceof qs)return new qs(t.h,t.s,t.l,t.opacity);if(t instanceof Dg||(t=Im(t)),!t)return new qs;if(t instanceof qs)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,c=s-i,l=(s+i)/2;return c?(e===s?o=(n-r)/c+(n0&&l<1?0:o,new qs(o,c,l,t.opacity)}function n1e(t,e,n,r){return arguments.length===1?YG(t):new qs(t,e,n,r??1)}function qs(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}_P(qs,n1e,qG(Dg,{brighter(t){return t=t==null?ob:Math.pow(ob,t),new qs(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?km:Math.pow(km,t),new qs(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new ki(mC(t>=240?t-240:t+120,i,r),mC(t,i,r),mC(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new qs(lM(this.h),Nv(this.s),Nv(this.l),ab(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=ab(this.opacity);return`${t===1?"hsl(":"hsla("}${lM(this.h)}, ${Nv(this.s)*100}%, ${Nv(this.l)*100}%${t===1?")":`, ${t})`}`}}));function lM(t){return t=(t||0)%360,t<0?t+360:t}function Nv(t){return Math.max(0,Math.min(1,t||0))}function mC(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const AP=t=>()=>t;function r1e(t,e){return function(n){return t+n*e}}function i1e(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function s1e(t){return(t=+t)==1?QG:function(e,n){return n-e?i1e(e,n,t):AP(isNaN(e)?n:e)}}function QG(t,e){var n=e-t;return n?r1e(t,n):AP(isNaN(t)?e:t)}const uM=function t(e){var n=s1e(e);function r(i,s){var o=n((i=p1(i)).r,(s=p1(s)).r),c=n(i.g,s.g),l=n(i.b,s.b),u=QG(i.opacity,s.opacity);return function(d){return i.r=o(d),i.g=c(d),i.b=l(d),i.opacity=u(d),i+""}}return r.gamma=t,r}(1);function o1e(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(s){for(i=0;in&&(s=e.slice(n,s),c[o]?c[o]+=s:c[++o]=s),(r=r[0])===(i=i[0])?c[o]?c[o]+=i:c[++o]=i:(c[++o]=null,l.push({i:o,x:cb(r,i)})),n=gC.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function v1e(t,e,n){var r=t[0],i=t[1],s=e[0],o=e[1];return i2?y1e:v1e,l=u=null,f}function f(h){return h==null||isNaN(h=+h)?s:(l||(l=c(t.map(r),e,n)))(r(o(h)))}return f.invert=function(h){return o(i((u||(u=c(e,t.map(r),cb)))(h)))},f.domain=function(h){return arguments.length?(t=Array.from(h,lb),d()):t.slice()},f.range=function(h){return arguments.length?(e=Array.from(h),d()):e.slice()},f.rangeRound=function(h){return e=Array.from(h),n=jP,d()},f.clamp=function(h){return arguments.length?(o=h?!0:xi,d()):o!==xi},f.interpolate=function(h){return arguments.length?(n=h,d()):n},f.unknown=function(h){return arguments.length?(s=h,f):s},function(h,p){return r=h,i=p,d()}}function EP(){return Ow()(xi,xi)}function x1e(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function ub(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function uf(t){return t=ub(Math.abs(t)),t?t[1]:NaN}function b1e(t,e){return function(n,r){for(var i=n.length,s=[],o=0,c=t[0],l=0;i>0&&c>0&&(l+c+1>r&&(c=Math.max(1,r-l)),s.push(n.substring(i-=c,i+c)),!((l+=c+1)>r));)c=t[o=(o+1)%t.length];return s.reverse().join(e)}}function w1e(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var S1e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Rm(t){if(!(e=S1e.exec(t)))throw new Error("invalid format: "+t);var e;return new NP({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Rm.prototype=NP.prototype;function NP(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}NP.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function C1e(t){e:for(var e=t.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var XG;function _1e(t,e){var n=ub(t,e);if(!n)return t+"";var r=n[0],i=n[1],s=i-(XG=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+ub(t,Math.max(0,e+s-1))[0]}function fM(t,e){var n=ub(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const hM={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:x1e,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>fM(t*100,e),r:fM,s:_1e,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function pM(t){return t}var mM=Array.prototype.map,gM=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function A1e(t){var e=t.grouping===void 0||t.thousands===void 0?pM:b1e(mM.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",s=t.numerals===void 0?pM:w1e(mM.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",c=t.minus===void 0?"āˆ’":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function u(f){f=Rm(f);var h=f.fill,p=f.align,g=f.sign,m=f.symbol,v=f.zero,b=f.width,x=f.comma,w=f.precision,S=f.trim,C=f.type;C==="n"?(x=!0,C="g"):hM[C]||(w===void 0&&(w=12),S=!0,C="g"),(v||h==="0"&&p==="=")&&(v=!0,h="0",p="=");var _=m==="$"?n:m==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():"",A=m==="$"?r:/[%p]/.test(C)?o:"",j=hM[C],T=/[defgprs%]/.test(C);w=w===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function k(I){var E=_,O=A,M,U,D;if(C==="c")O=j(I)+O,I="";else{I=+I;var B=I<0||1/I<0;if(I=isNaN(I)?l:j(Math.abs(I),w),S&&(I=C1e(I)),B&&+I==0&&g!=="+"&&(B=!1),E=(B?g==="("?g:c:g==="-"||g==="("?"":g)+E,O=(C==="s"?gM[8+XG/3]:"")+O+(B&&g==="("?")":""),T){for(M=-1,U=I.length;++MD||D>57){O=(D===46?i+I.slice(M+1):I.slice(M))+O,I=I.slice(0,M);break}}}x&&!v&&(I=e(I,1/0));var R=E.length+I.length+O.length,L=R>1)+E+I+O+L.slice(R);break;default:I=L+E+I+O;break}return s(I)}return k.toString=function(){return f+""},k}function d(f,h){var p=u((f=Rm(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(uf(h)/3)))*3,m=Math.pow(10,-g),v=gM[8+g/3];return function(b){return p(m*b)+v}}return{format:u,formatPrefix:d}}var Tv,TP,JG;j1e({thousands:",",grouping:[3],currency:["$",""]});function j1e(t){return Tv=A1e(t),TP=Tv.format,JG=Tv.formatPrefix,Tv}function E1e(t){return Math.max(0,-uf(Math.abs(t)))}function N1e(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(uf(e)/3)))*3-uf(Math.abs(t)))}function T1e(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,uf(e)-uf(t))+1}function ZG(t,e,n,r){var i=f1(t,e,n),s;switch(r=Rm(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=N1e(i,o))&&(r.precision=s),JG(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=T1e(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=E1e(i))&&(r.precision=s-(r.type==="%")*2);break}}return TP(r)}function ml(t){var e=t.domain;return t.ticks=function(n){var r=e();return u1(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return ZG(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,s=r.length-1,o=r[i],c=r[s],l,u,d=10;for(c0;){if(u=d1(o,c,n),u===l)return r[i]=o,r[s]=c,e(r);if(u>0)o=Math.floor(o/u)*u,c=Math.ceil(c/u)*u;else if(u<0)o=Math.ceil(o*u)/u,c=Math.floor(c*u)/u;else break;l=u}return t},t}function db(){var t=EP();return t.copy=function(){return $g(t,db())},Os.apply(t,arguments),ml(t)}function e8(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,lb),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return e8(t).unknown(e)},t=arguments.length?Array.from(t,lb):[0,1],ml(n)}function t8(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],s=t[r],o;return sMath.pow(t,e)}function R1e(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function xM(t){return(e,n)=>-t(-e,n)}function PP(t){const e=t(vM,yM),n=e.domain;let r=10,i,s;function o(){return i=R1e(r),s=I1e(r),n()[0]<0?(i=xM(i),s=xM(s),t(P1e,k1e)):t(vM,yM),e}return e.base=function(c){return arguments.length?(r=+c,o()):r},e.domain=function(c){return arguments.length?(n(c),o()):n()},e.ticks=c=>{const l=n();let u=l[0],d=l[l.length-1];const f=d0){for(;h<=p;++h)for(g=1;gd)break;b.push(m)}}else for(;h<=p;++h)for(g=r-1;g>=1;--g)if(m=h>0?g/s(-h):g*s(h),!(md)break;b.push(m)}b.length*2{if(c==null&&(c=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=Rm(l)).precision==null&&(l.trim=!0),l=TP(l)),c===1/0)return l;const u=Math.max(1,r*c/e.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*rn(t8(n(),{floor:c=>s(Math.floor(i(c))),ceil:c=>s(Math.ceil(i(c)))})),e}function n8(){const t=PP(Ow()).domain([1,10]);return t.copy=()=>$g(t,n8()).base(t.base()),Os.apply(t,arguments),t}function bM(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function wM(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function kP(t){var e=1,n=t(bM(e),wM(e));return n.constant=function(r){return arguments.length?t(bM(e=+r),wM(e)):e},ml(n)}function r8(){var t=kP(Ow());return t.copy=function(){return $g(t,r8()).constant(t.constant())},Os.apply(t,arguments)}function SM(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function M1e(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function D1e(t){return t<0?-t*t:t*t}function OP(t){var e=t(xi,xi),n=1;function r(){return n===1?t(xi,xi):n===.5?t(M1e,D1e):t(SM(n),SM(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},ml(e)}function IP(){var t=OP(Ow());return t.copy=function(){return $g(t,IP()).exponent(t.exponent())},Os.apply(t,arguments),t}function $1e(){return IP.apply(null,arguments).exponent(.5)}function CM(t){return Math.sign(t)*t*t}function L1e(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function i8(){var t=EP(),e=[0,1],n=!1,r;function i(s){var o=L1e(t(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return t.invert(CM(s))},i.domain=function(s){return arguments.length?(t.domain(s),i):t.domain()},i.range=function(s){return arguments.length?(t.range((e=Array.from(s,lb)).map(CM)),i):e.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(n=!!s,i):n},i.clamp=function(s){return arguments.length?(t.clamp(s),i):t.clamp()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return i8(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},Os.apply(i,arguments),ml(i)}function s8(){var t=[],e=[],n=[],r;function i(){var o=0,c=Math.max(1,e.length);for(n=new Array(c-1);++o0?n[c-1]:t[0],c=n?[r[n-1],e]:[r[u-1],r[u]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return r.slice()},o.copy=function(){return o8().domain([t,e]).range(i).unknown(s)},Os.apply(ml(o),arguments)}function a8(){var t=[.5],e=[0,1],n,r=1;function i(s){return s!=null&&s<=s?e[Mg(t,s,0,r)]:n}return i.domain=function(s){return arguments.length?(t=Array.from(s),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(s){return arguments.length?(e=Array.from(s),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(s){var o=e.indexOf(s);return[t[o-1],t[o]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return a8().domain(t).range(e).unknown(n)},Os.apply(i,arguments)}const vC=new Date,yC=new Date;function Pr(t,e,n,r){function i(s){return t(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const o=i(s),c=i.ceil(s);return s-o(e(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,c)=>{const l=[];if(s=i.ceil(s),c=c==null?1:Math.floor(c),!(s0))return l;let u;do l.push(u=new Date(+s)),e(s,c),t(s);while(uPr(o=>{if(o>=o)for(;t(o),!s(o);)o.setTime(o-1)},(o,c)=>{if(o>=o)if(c<0)for(;++c<=0;)for(;e(o,-1),!s(o););else for(;--c>=0;)for(;e(o,1),!s(o););}),n&&(i.count=(s,o)=>(vC.setTime(+s),yC.setTime(+o),t(vC),t(yC),Math.floor(n(vC,yC))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?o=>r(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const fb=Pr(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);fb.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Pr(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):fb);fb.range;const Sa=1e3,Cs=Sa*60,Ca=Cs*60,Ua=Ca*24,RP=Ua*7,_M=Ua*30,xC=Ua*365,Hl=Pr(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Sa)},(t,e)=>(e-t)/Sa,t=>t.getUTCSeconds());Hl.range;const MP=Pr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Sa)},(t,e)=>{t.setTime(+t+e*Cs)},(t,e)=>(e-t)/Cs,t=>t.getMinutes());MP.range;const DP=Pr(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Cs)},(t,e)=>(e-t)/Cs,t=>t.getUTCMinutes());DP.range;const $P=Pr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Sa-t.getMinutes()*Cs)},(t,e)=>{t.setTime(+t+e*Ca)},(t,e)=>(e-t)/Ca,t=>t.getHours());$P.range;const LP=Pr(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Ca)},(t,e)=>(e-t)/Ca,t=>t.getUTCHours());LP.range;const Lg=Pr(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Cs)/Ua,t=>t.getDate()-1);Lg.range;const Iw=Pr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Ua,t=>t.getUTCDate()-1);Iw.range;const c8=Pr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Ua,t=>Math.floor(t/Ua));c8.range;function Du(t){return Pr(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Cs)/RP)}const Rw=Du(0),hb=Du(1),F1e=Du(2),U1e=Du(3),df=Du(4),B1e=Du(5),H1e=Du(6);Rw.range;hb.range;F1e.range;U1e.range;df.range;B1e.range;H1e.range;function $u(t){return Pr(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/RP)}const Mw=$u(0),pb=$u(1),z1e=$u(2),V1e=$u(3),ff=$u(4),G1e=$u(5),K1e=$u(6);Mw.range;pb.range;z1e.range;V1e.range;ff.range;G1e.range;K1e.range;const FP=Pr(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());FP.range;const UP=Pr(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());UP.range;const Ba=Pr(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Ba.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Pr(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Ba.range;const Ha=Pr(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Ha.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Pr(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Ha.range;function l8(t,e,n,r,i,s){const o=[[Hl,1,Sa],[Hl,5,5*Sa],[Hl,15,15*Sa],[Hl,30,30*Sa],[s,1,Cs],[s,5,5*Cs],[s,15,15*Cs],[s,30,30*Cs],[i,1,Ca],[i,3,3*Ca],[i,6,6*Ca],[i,12,12*Ca],[r,1,Ua],[r,2,2*Ua],[n,1,RP],[e,1,_M],[e,3,3*_M],[t,1,xC]];function c(u,d,f){const h=dv).right(o,h);if(p===o.length)return t.every(f1(u/xC,d/xC,f));if(p===0)return fb.every(Math.max(f1(u,d,f),1));const[g,m]=o[h/o[p-1][2]53)return null;"w"in ee||(ee.w=1),"Z"in ee?(et=wC(kh(ee.y,0,1)),Ct=et.getUTCDay(),et=Ct>4||Ct===0?pb.ceil(et):pb(et),et=Iw.offset(et,(ee.V-1)*7),ee.y=et.getUTCFullYear(),ee.m=et.getUTCMonth(),ee.d=et.getUTCDate()+(ee.w+6)%7):(et=bC(kh(ee.y,0,1)),Ct=et.getDay(),et=Ct>4||Ct===0?hb.ceil(et):hb(et),et=Lg.offset(et,(ee.V-1)*7),ee.y=et.getFullYear(),ee.m=et.getMonth(),ee.d=et.getDate()+(ee.w+6)%7)}else("W"in ee||"U"in ee)&&("w"in ee||(ee.w="u"in ee?ee.u%7:"W"in ee?1:0),Ct="Z"in ee?wC(kh(ee.y,0,1)).getUTCDay():bC(kh(ee.y,0,1)).getDay(),ee.m=0,ee.d="W"in ee?(ee.w+6)%7+ee.W*7-(Ct+5)%7:ee.w+ee.U*7-(Ct+6)%7);return"Z"in ee?(ee.H+=ee.Z/100|0,ee.M+=ee.Z%100,wC(ee)):bC(ee)}}function j(ue,we,Ae,ee){for(var wt=0,et=we.length,Ct=Ae.length,Xe,nn;wt=Ct)return-1;if(Xe=we.charCodeAt(wt++),Xe===37){if(Xe=we.charAt(wt++),nn=C[Xe in AM?we.charAt(wt++):Xe],!nn||(ee=nn(ue,Ae,ee))<0)return-1}else if(Xe!=Ae.charCodeAt(ee++))return-1}return ee}function T(ue,we,Ae){var ee=u.exec(we.slice(Ae));return ee?(ue.p=d.get(ee[0].toLowerCase()),Ae+ee[0].length):-1}function k(ue,we,Ae){var ee=p.exec(we.slice(Ae));return ee?(ue.w=g.get(ee[0].toLowerCase()),Ae+ee[0].length):-1}function I(ue,we,Ae){var ee=f.exec(we.slice(Ae));return ee?(ue.w=h.get(ee[0].toLowerCase()),Ae+ee[0].length):-1}function E(ue,we,Ae){var ee=b.exec(we.slice(Ae));return ee?(ue.m=x.get(ee[0].toLowerCase()),Ae+ee[0].length):-1}function O(ue,we,Ae){var ee=m.exec(we.slice(Ae));return ee?(ue.m=v.get(ee[0].toLowerCase()),Ae+ee[0].length):-1}function M(ue,we,Ae){return j(ue,e,we,Ae)}function U(ue,we,Ae){return j(ue,n,we,Ae)}function D(ue,we,Ae){return j(ue,r,we,Ae)}function B(ue){return o[ue.getDay()]}function R(ue){return s[ue.getDay()]}function L(ue){return l[ue.getMonth()]}function Y(ue){return c[ue.getMonth()]}function q(ue){return i[+(ue.getHours()>=12)]}function J(ue){return 1+~~(ue.getMonth()/3)}function me(ue){return o[ue.getUTCDay()]}function F(ue){return s[ue.getUTCDay()]}function oe(ue){return l[ue.getUTCMonth()]}function se(ue){return c[ue.getUTCMonth()]}function le(ue){return i[+(ue.getUTCHours()>=12)]}function ke(ue){return 1+~~(ue.getUTCMonth()/3)}return{format:function(ue){var we=_(ue+="",w);return we.toString=function(){return ue},we},parse:function(ue){var we=A(ue+="",!1);return we.toString=function(){return ue},we},utcFormat:function(ue){var we=_(ue+="",S);return we.toString=function(){return ue},we},utcParse:function(ue){var we=A(ue+="",!0);return we.toString=function(){return ue},we}}}var AM={"-":"",_:" ",0:"0"},Ur=/^\s*\d+/,J1e=/^%/,Z1e=/[\\^$*+?|[\]().{}]/g;function cn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function tje(t,e,n){var r=Ur.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function nje(t,e,n){var r=Ur.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function rje(t,e,n){var r=Ur.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function ije(t,e,n){var r=Ur.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function sje(t,e,n){var r=Ur.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function jM(t,e,n){var r=Ur.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function EM(t,e,n){var r=Ur.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function oje(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function aje(t,e,n){var r=Ur.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function cje(t,e,n){var r=Ur.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function NM(t,e,n){var r=Ur.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function lje(t,e,n){var r=Ur.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function TM(t,e,n){var r=Ur.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function uje(t,e,n){var r=Ur.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function dje(t,e,n){var r=Ur.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function fje(t,e,n){var r=Ur.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function hje(t,e,n){var r=Ur.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function pje(t,e,n){var r=J1e.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function mje(t,e,n){var r=Ur.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function gje(t,e,n){var r=Ur.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function PM(t,e){return cn(t.getDate(),e,2)}function vje(t,e){return cn(t.getHours(),e,2)}function yje(t,e){return cn(t.getHours()%12||12,e,2)}function xje(t,e){return cn(1+Lg.count(Ba(t),t),e,3)}function u8(t,e){return cn(t.getMilliseconds(),e,3)}function bje(t,e){return u8(t,e)+"000"}function wje(t,e){return cn(t.getMonth()+1,e,2)}function Sje(t,e){return cn(t.getMinutes(),e,2)}function Cje(t,e){return cn(t.getSeconds(),e,2)}function _je(t){var e=t.getDay();return e===0?7:e}function Aje(t,e){return cn(Rw.count(Ba(t)-1,t),e,2)}function d8(t){var e=t.getDay();return e>=4||e===0?df(t):df.ceil(t)}function jje(t,e){return t=d8(t),cn(df.count(Ba(t),t)+(Ba(t).getDay()===4),e,2)}function Eje(t){return t.getDay()}function Nje(t,e){return cn(hb.count(Ba(t)-1,t),e,2)}function Tje(t,e){return cn(t.getFullYear()%100,e,2)}function Pje(t,e){return t=d8(t),cn(t.getFullYear()%100,e,2)}function kje(t,e){return cn(t.getFullYear()%1e4,e,4)}function Oje(t,e){var n=t.getDay();return t=n>=4||n===0?df(t):df.ceil(t),cn(t.getFullYear()%1e4,e,4)}function Ije(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+cn(e/60|0,"0",2)+cn(e%60,"0",2)}function kM(t,e){return cn(t.getUTCDate(),e,2)}function Rje(t,e){return cn(t.getUTCHours(),e,2)}function Mje(t,e){return cn(t.getUTCHours()%12||12,e,2)}function Dje(t,e){return cn(1+Iw.count(Ha(t),t),e,3)}function f8(t,e){return cn(t.getUTCMilliseconds(),e,3)}function $je(t,e){return f8(t,e)+"000"}function Lje(t,e){return cn(t.getUTCMonth()+1,e,2)}function Fje(t,e){return cn(t.getUTCMinutes(),e,2)}function Uje(t,e){return cn(t.getUTCSeconds(),e,2)}function Bje(t){var e=t.getUTCDay();return e===0?7:e}function Hje(t,e){return cn(Mw.count(Ha(t)-1,t),e,2)}function h8(t){var e=t.getUTCDay();return e>=4||e===0?ff(t):ff.ceil(t)}function zje(t,e){return t=h8(t),cn(ff.count(Ha(t),t)+(Ha(t).getUTCDay()===4),e,2)}function Vje(t){return t.getUTCDay()}function Gje(t,e){return cn(pb.count(Ha(t)-1,t),e,2)}function Kje(t,e){return cn(t.getUTCFullYear()%100,e,2)}function Wje(t,e){return t=h8(t),cn(t.getUTCFullYear()%100,e,2)}function qje(t,e){return cn(t.getUTCFullYear()%1e4,e,4)}function Yje(t,e){var n=t.getUTCDay();return t=n>=4||n===0?ff(t):ff.ceil(t),cn(t.getUTCFullYear()%1e4,e,4)}function Qje(){return"+0000"}function OM(){return"%"}function IM(t){return+t}function RM(t){return Math.floor(+t/1e3)}var Ku,p8,m8;Xje({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Xje(t){return Ku=X1e(t),p8=Ku.format,Ku.parse,m8=Ku.utcFormat,Ku.utcParse,Ku}function Jje(t){return new Date(t)}function Zje(t){return t instanceof Date?+t:+new Date(+t)}function BP(t,e,n,r,i,s,o,c,l,u){var d=EP(),f=d.invert,h=d.domain,p=u(".%L"),g=u(":%S"),m=u("%I:%M"),v=u("%I %p"),b=u("%a %d"),x=u("%b %d"),w=u("%B"),S=u("%Y");function C(_){return(l(_)<_?p:c(_)<_?g:o(_)<_?m:s(_)<_?v:r(_)<_?i(_)<_?b:x:n(_)<_?w:S)(_)}return d.invert=function(_){return new Date(f(_))},d.domain=function(_){return arguments.length?h(Array.from(_,Zje)):h().map(Jje)},d.ticks=function(_){var A=h();return t(A[0],A[A.length-1],_??10)},d.tickFormat=function(_,A){return A==null?C:u(A)},d.nice=function(_){var A=h();return(!_||typeof _.range!="function")&&(_=e(A[0],A[A.length-1],_??10)),_?h(t8(A,_)):d},d.copy=function(){return $g(d,BP(t,e,n,r,i,s,o,c,l,u))},d}function eEe(){return Os.apply(BP(Y1e,Q1e,Ba,FP,Rw,Lg,$P,MP,Hl,p8).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function tEe(){return Os.apply(BP(W1e,q1e,Ha,UP,Mw,Iw,LP,DP,Hl,m8).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Dw(){var t=0,e=1,n,r,i,s,o=xi,c=!1,l;function u(f){return f==null||isNaN(f=+f)?l:o(i===0?.5:(f=(s(f)-n)*i,c?Math.max(0,Math.min(1,f)):f))}u.domain=function(f){return arguments.length?([t,e]=f,n=s(t=+t),r=s(e=+e),i=n===r?0:1/(r-n),u):[t,e]},u.clamp=function(f){return arguments.length?(c=!!f,u):c},u.interpolator=function(f){return arguments.length?(o=f,u):o};function d(f){return function(h){var p,g;return arguments.length?([p,g]=h,o=f(p,g),u):[o(0),o(1)]}}return u.range=d(oh),u.rangeRound=d(jP),u.unknown=function(f){return arguments.length?(l=f,u):l},function(f){return s=f,n=f(t),r=f(e),i=n===r?0:1/(r-n),u}}function gl(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function g8(){var t=ml(Dw()(xi));return t.copy=function(){return gl(t,g8())},Qa.apply(t,arguments)}function v8(){var t=PP(Dw()).domain([1,10]);return t.copy=function(){return gl(t,v8()).base(t.base())},Qa.apply(t,arguments)}function y8(){var t=kP(Dw());return t.copy=function(){return gl(t,y8()).constant(t.constant())},Qa.apply(t,arguments)}function HP(){var t=OP(Dw());return t.copy=function(){return gl(t,HP()).exponent(t.exponent())},Qa.apply(t,arguments)}function nEe(){return HP.apply(null,arguments).exponent(.5)}function x8(){var t=[],e=xi;function n(r){if(r!=null&&!isNaN(r=+r))return e((Mg(t,r,1)-1)/(t.length-1))}return n.domain=function(r){if(!arguments.length)return t.slice();t=[];for(let i of r)i!=null&&!isNaN(i=+i)&&t.push(i);return t.sort(Vc),n},n.interpolator=function(r){return arguments.length?(e=r,n):e},n.range=function(){return t.map((r,i)=>e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>HAe(t,s/r))},n.copy=function(){return x8(e).domain(t)},Qa.apply(n,arguments)}function $w(){var t=0,e=.5,n=1,r=1,i,s,o,c,l,u=xi,d,f=!1,h;function p(m){return isNaN(m=+m)?h:(m=.5+((m=+d(m))-s)*(r*me}var C8=oEe,aEe=Lw,cEe=C8,lEe=sh;function uEe(t){return t&&t.length?aEe(t,lEe,cEe):void 0}var dEe=uEe;const Cc=dn(dEe);function fEe(t,e){return tt.e^s.s<0?1:-1;for(r=s.d.length,i=t.d.length,e=0,n=rt.d[e]^s.s<0?1:-1;return r===i?0:r>i^s.s<0?1:-1};Qe.decimalPlaces=Qe.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*Dn;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Qe.dividedBy=Qe.div=function(t){return Ta(this,new this.constructor(t))};Qe.dividedToIntegerBy=Qe.idiv=function(t){var e=this,n=e.constructor;return jn(Ta(e,new n(t),0,1),n.precision)};Qe.equals=Qe.eq=function(t){return!this.cmp(t)};Qe.exponent=function(){return gr(this)};Qe.greaterThan=Qe.gt=function(t){return this.cmp(t)>0};Qe.greaterThanOrEqualTo=Qe.gte=function(t){return this.cmp(t)>=0};Qe.isInteger=Qe.isint=function(){return this.e>this.d.length-2};Qe.isNegative=Qe.isneg=function(){return this.s<0};Qe.isPositive=Qe.ispos=function(){return this.s>0};Qe.isZero=function(){return this.s===0};Qe.lessThan=Qe.lt=function(t){return this.cmp(t)<0};Qe.lessThanOrEqualTo=Qe.lte=function(t){return this.cmp(t)<1};Qe.logarithm=Qe.log=function(t){var e,n=this,r=n.constructor,i=r.precision,s=i+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq(Xi))throw Error(Ts+"NaN");if(n.s<1)throw Error(Ts+(n.s?"NaN":"-Infinity"));return n.eq(Xi)?new r(0):(Vn=!1,e=Ta(Mm(n,s),Mm(t,s),s),Vn=!0,jn(e,i))};Qe.minus=Qe.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?N8(e,t):j8(e,(t.s=-t.s,t))};Qe.modulo=Qe.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(Ts+"NaN");return n.s?(Vn=!1,e=Ta(n,t,0,1).times(t),Vn=!0,n.minus(e)):jn(new r(n),i)};Qe.naturalExponential=Qe.exp=function(){return E8(this)};Qe.naturalLogarithm=Qe.ln=function(){return Mm(this)};Qe.negated=Qe.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Qe.plus=Qe.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?j8(e,t):N8(e,(t.s=-t.s,t))};Qe.precision=Qe.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(ru+t);if(e=gr(i)+1,r=i.d.length-1,n=r*Dn+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};Qe.squareRoot=Qe.sqrt=function(){var t,e,n,r,i,s,o,c=this,l=c.constructor;if(c.s<1){if(!c.s)return new l(0);throw Error(Ts+"NaN")}for(t=gr(c),Vn=!1,i=Math.sqrt(+c),i==0||i==1/0?(e=Do(c.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=ch((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new l(e)):r=new l(i.toString()),n=l.precision,i=o=n+3;;)if(s=r,r=s.plus(Ta(c,s,o+2)).times(.5),Do(s.d).slice(0,o)===(e=Do(r.d)).slice(0,o)){if(e=e.slice(o-3,o+1),i==o&&e=="4999"){if(jn(s,n+1,0),s.times(s).eq(c)){r=s;break}}else if(e!="9999")break;o+=4}return Vn=!0,jn(r,n)};Qe.times=Qe.mul=function(t){var e,n,r,i,s,o,c,l,u,d=this,f=d.constructor,h=d.d,p=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,l=h.length,u=p.length,l=0;){for(e=0,i=l+r;i>r;)c=s[i]+p[r]*h[i-r-1]+e,s[i--]=c%Ir|0,e=c/Ir|0;s[i]=(s[i]+e)%Ir|0}for(;!s[--o];)s.pop();return e?++n:s.shift(),t.d=s,t.e=n,Vn?jn(t,f.precision):t};Qe.toDecimalPlaces=Qe.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(Qo(t,0,ah),e===void 0?e=r.rounding:Qo(e,0,8),jn(n,t+gr(n)+1,e))};Qe.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=ju(r,!0):(Qo(t,0,ah),e===void 0?e=i.rounding:Qo(e,0,8),r=jn(new i(r),t+1,e),n=ju(r,!0,t+1)),n};Qe.toFixed=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?ju(i):(Qo(t,0,ah),e===void 0?e=s.rounding:Qo(e,0,8),r=jn(new s(i),t+gr(i)+1,e),n=ju(r.abs(),!1,t+gr(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Qe.toInteger=Qe.toint=function(){var t=this,e=t.constructor;return jn(new e(t),gr(t)+1,e.rounding)};Qe.toNumber=function(){return+this};Qe.toPower=Qe.pow=function(t){var e,n,r,i,s,o,c=this,l=c.constructor,u=12,d=+(t=new l(t));if(!t.s)return new l(Xi);if(c=new l(c),!c.s){if(t.s<1)throw Error(Ts+"Infinity");return c}if(c.eq(Xi))return c;if(r=l.precision,t.eq(Xi))return jn(c,r);if(e=t.e,n=t.d.length-1,o=e>=n,s=c.s,o){if((n=d<0?-d:d)<=A8){for(i=new l(Xi),e=Math.ceil(r/Dn+4),Vn=!1;n%2&&(i=i.times(c),$M(i.d,e)),n=ch(n/2),n!==0;)c=c.times(c),$M(c.d,e);return Vn=!0,t.s<0?new l(Xi).div(i):jn(i,r)}}else if(s<0)throw Error(Ts+"NaN");return s=s<0&&t.d[Math.max(e,n)]&1?-1:1,c.s=1,Vn=!1,i=t.times(Mm(c,r+u)),Vn=!0,i=E8(i),i.s=s,i};Qe.toPrecision=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?(n=gr(i),r=ju(i,n<=s.toExpNeg||n>=s.toExpPos)):(Qo(t,1,ah),e===void 0?e=s.rounding:Qo(e,0,8),i=jn(new s(i),t,e),n=gr(i),r=ju(i,t<=n||n<=s.toExpNeg,t)),r};Qe.toSignificantDigits=Qe.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(Qo(t,1,ah),e===void 0?e=r.rounding:Qo(e,0,8)),jn(new r(n),t,e)};Qe.toString=Qe.valueOf=Qe.val=Qe.toJSON=Qe[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=gr(t),n=t.constructor;return ju(t,e<=n.toExpNeg||e>=n.toExpPos)};function j8(t,e){var n,r,i,s,o,c,l,u,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),Vn?jn(e,f):e;if(l=t.d,u=e.d,o=t.e,i=e.e,l=l.slice(),s=o-i,s){for(s<0?(r=l,s=-s,c=u.length):(r=u,i=o,c=l.length),o=Math.ceil(f/Dn),c=o>c?o+1:c+1,s>c&&(s=c,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(c=l.length,s=u.length,c-s<0&&(s=c,r=u,u=l,l=r),n=0;s;)n=(l[--s]=l[s]+u[s]+n)/Ir|0,l[s]%=Ir;for(n&&(l.unshift(n),++i),c=l.length;l[--c]==0;)l.pop();return e.d=l,e.e=i,Vn?jn(e,f):e}function Qo(t,e,n){if(t!==~~t||tn)throw Error(ru+t)}function Do(t){var e,n,r,i=t.length-1,s="",o=t[0];if(i>0){for(s+=o,e=1;eo?1:-1;else for(c=l=0;ci[c]?1:-1;break}return l}function n(r,i,s){for(var o=0;s--;)r[s]-=o,o=r[s]1;)r.shift()}return function(r,i,s,o){var c,l,u,d,f,h,p,g,m,v,b,x,w,S,C,_,A,j,T=r.constructor,k=r.s==i.s?1:-1,I=r.d,E=i.d;if(!r.s)return new T(r);if(!i.s)throw Error(Ts+"Division by zero");for(l=r.e-i.e,A=E.length,C=I.length,p=new T(k),g=p.d=[],u=0;E[u]==(I[u]||0);)++u;if(E[u]>(I[u]||0)&&--l,s==null?x=s=T.precision:o?x=s+(gr(r)-gr(i))+1:x=s,x<0)return new T(0);if(x=x/Dn+2|0,u=0,A==1)for(d=0,E=E[0],x++;(u1&&(E=t(E,d),I=t(I,d),A=E.length,C=I.length),S=A,m=I.slice(0,A),v=m.length;v=Ir/2&&++_;do d=0,c=e(E,m,A,v),c<0?(b=m[0],A!=v&&(b=b*Ir+(m[1]||0)),d=b/_|0,d>1?(d>=Ir&&(d=Ir-1),f=t(E,d),h=f.length,v=m.length,c=e(f,m,h,v),c==1&&(d--,n(f,A16)throw Error(VP+gr(t));if(!t.s)return new d(Xi);for(e==null?(Vn=!1,c=f):c=e,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),u+=5;for(r=Math.log(Tl(2,u))/Math.LN10*2+5|0,c+=r,n=i=s=new d(Xi),d.precision=c;;){if(i=jn(i.times(t),c),n=n.times(++l),o=s.plus(Ta(i,n,c)),Do(o.d).slice(0,c)===Do(s.d).slice(0,c)){for(;u--;)s=jn(s.times(s),c);return d.precision=f,e==null?(Vn=!0,jn(s,f)):s}s=o}}function gr(t){for(var e=t.e*Dn,n=t.d[0];n>=10;n/=10)e++;return e}function SC(t,e,n){if(e>t.LN10.sd())throw Vn=!0,n&&(t.precision=n),Error(Ts+"LN10 precision limit exceeded");return jn(new t(t.LN10),e)}function ac(t){for(var e="";t--;)e+="0";return e}function Mm(t,e){var n,r,i,s,o,c,l,u,d,f=1,h=10,p=t,g=p.d,m=p.constructor,v=m.precision;if(p.s<1)throw Error(Ts+(p.s?"NaN":"-Infinity"));if(p.eq(Xi))return new m(0);if(e==null?(Vn=!1,u=v):u=e,p.eq(10))return e==null&&(Vn=!0),SC(m,u);if(u+=h,m.precision=u,n=Do(g),r=n.charAt(0),s=gr(p),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(t),n=Do(p.d),r=n.charAt(0),f++;s=gr(p),r>1?(p=new m("0."+n),s++):p=new m(r+"."+n.slice(1))}else return l=SC(m,u+2,v).times(s+""),p=Mm(new m(r+"."+n.slice(1)),u-h).plus(l),m.precision=v,e==null?(Vn=!0,jn(p,v)):p;for(c=o=p=Ta(p.minus(Xi),p.plus(Xi),u),d=jn(p.times(p),u),i=3;;){if(o=jn(o.times(d),u),l=c.plus(Ta(o,new m(i),u)),Do(l.d).slice(0,u)===Do(c.d).slice(0,u))return c=c.times(2),s!==0&&(c=c.plus(SC(m,u+2,v).times(s+""))),c=Ta(c,new m(f),u),m.precision=v,e==null?(Vn=!0,jn(c,v)):c;c=l,i+=2}}function DM(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(r,i),e){if(i-=r,n=n-r-1,t.e=ch(n/Dn),t.d=[],r=(n+1)%Dn,n<0&&(r+=Dn),rmb||t.e<-mb))throw Error(VP+n)}else t.s=0,t.e=0,t.d=[0];return t}function jn(t,e,n){var r,i,s,o,c,l,u,d,f=t.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(r=e-o,r<0)r+=Dn,i=e,u=f[d=0];else{if(d=Math.ceil((r+1)/Dn),s=f.length,d>=s)return t;for(u=s=f[d],o=1;s>=10;s/=10)o++;r%=Dn,i=r-Dn+o}if(n!==void 0&&(s=Tl(10,o-i-1),c=u/s%10|0,l=e<0||f[d+1]!==void 0||u%s,l=n<4?(c||l)&&(n==0||n==(t.s<0?3:2)):c>5||c==5&&(n==4||l||n==6&&(r>0?i>0?u/Tl(10,o-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(s=gr(t),f.length=1,e=e-s-1,f[0]=Tl(10,(Dn-e%Dn)%Dn),t.e=ch(-e/Dn)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(r==0?(f.length=d,s=1,d--):(f.length=d+1,s=Tl(10,Dn-r),f[d]=i>0?(u/Tl(10,o-i)%Tl(10,i)|0)*s:0),l)for(;;)if(d==0){(f[0]+=s)==Ir&&(f[0]=1,++t.e);break}else{if(f[d]+=s,f[d]!=Ir)break;f[d--]=0,s=1}for(r=f.length;f[--r]===0;)f.pop();if(Vn&&(t.e>mb||t.e<-mb))throw Error(VP+gr(t));return t}function N8(t,e){var n,r,i,s,o,c,l,u,d,f,h=t.constructor,p=h.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new h(t),Vn?jn(e,p):e;if(l=t.d,f=e.d,r=e.e,u=t.e,l=l.slice(),o=u-r,o){for(d=o<0,d?(n=l,o=-o,c=f.length):(n=f,r=u,c=l.length),i=Math.max(Math.ceil(p/Dn),c)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=l.length,c=f.length,d=i0;--i)l[c++]=0;for(i=f.length;i>o;){if(l[--i]0?s=s.charAt(0)+"."+s.slice(1)+ac(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+ac(-i-1)+s,n&&(r=n-o)>0&&(s+=ac(r))):i>=o?(s+=ac(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+ac(r))):((r=i+1)0&&(i+1===o&&(s+="."),s+=ac(r))),t.s<0?"-"+s:s}function $M(t,e){if(t.length>e)return t.length=e,!0}function T8(t){var e,n,r;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(ru+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return DM(o,s.toString())}else if(typeof s!="string")throw Error(ru+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,IEe.test(s))DM(o,s);else throw Error(ru+s)}if(i.prototype=Qe,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=T8,i.config=i.set=REe,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=i[e+1]&&r<=i[e+2])this[n]=r;else throw Error(ru+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(ru+n+": "+r);return this}var GP=T8(OEe);Xi=new GP(1);const wn=GP;function MEe(t){return FEe(t)||LEe(t)||$Ee(t)||DEe()}function DEe(){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 $Ee(t,e){if(t){if(typeof t=="string")return v1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v1(t,e)}}function LEe(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function FEe(t){if(Array.isArray(t))return v1(t)}function v1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=e?n.apply(void 0,i):t(e-o,LM(function(){for(var c=arguments.length,l=new Array(c),u=0;ut.length)&&(e=t.length);for(var n=0,r=new Array(e);n"u"||!(Symbol.iterator in Object(t)))){var n=[],r=!0,i=!1,s=void 0;try{for(var o=t[Symbol.iterator](),c;!(r=(c=o.next()).done)&&(n.push(c.value),!(e&&n.length===e));r=!0);}catch(l){i=!0,s=l}finally{try{!r&&o.return!=null&&o.return()}finally{if(i)throw s}}return n}}function eNe(t){if(Array.isArray(t))return t}function R8(t){var e=Dm(t,2),n=e[0],r=e[1],i=n,s=r;return n>r&&(i=r,s=n),[i,s]}function M8(t,e,n){if(t.lte(0))return new wn(0);var r=Bw.getDigitCount(t.toNumber()),i=new wn(10).pow(r),s=t.div(i),o=r!==1?.05:.1,c=new wn(Math.ceil(s.div(o).toNumber())).add(n).mul(o),l=c.mul(i);return e?l:new wn(Math.ceil(l))}function tNe(t,e,n){var r=1,i=new wn(t);if(!i.isint()&&n){var s=Math.abs(t);s<1?(r=new wn(10).pow(Bw.getDigitCount(t)-1),i=new wn(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new wn(Math.floor(t)))}else t===0?i=new wn(Math.floor((e-1)/2)):n||(i=new wn(Math.floor(t)));var o=Math.floor((e-1)/2),c=zEe(HEe(function(l){return i.add(new wn(l-o).mul(r)).toNumber()}),y1);return c(0,e)}function D8(t,e,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(n-1)))return{step:new wn(0),tickMin:new wn(0),tickMax:new wn(0)};var s=M8(new wn(e).sub(t).div(n-1),r,i),o;t<=0&&e>=0?o=new wn(0):(o=new wn(t).add(e).div(2),o=o.sub(new wn(o).mod(s)));var c=Math.ceil(o.sub(t).div(s).toNumber()),l=Math.ceil(new wn(e).sub(o).div(s).toNumber()),u=c+l+1;return u>n?D8(t,e,n,r,i+1):(u0?l+(n-u):l,c=e>0?c:c+(n-u)),{step:s,tickMin:o.sub(new wn(c).mul(s)),tickMax:o.add(new wn(l).mul(s))})}function nNe(t){var e=Dm(t,2),n=e[0],r=e[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),c=R8([n,r]),l=Dm(c,2),u=l[0],d=l[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(b1(y1(0,i-1).map(function(){return 1/0}))):[].concat(b1(y1(0,i-1).map(function(){return-1/0})),[d]);return n>r?x1(f):f}if(u===d)return tNe(u,i,s);var h=D8(u,d,o,s),p=h.step,g=h.tickMin,m=h.tickMax,v=Bw.rangeStep(g,m.add(new wn(.1).mul(p)),p);return n>r?x1(v):v}function rNe(t,e){var n=Dm(t,2),r=n[0],i=n[1],s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=R8([r,i]),c=Dm(o,2),l=c[0],u=c[1];if(l===-1/0||u===1/0)return[r,i];if(l===u)return[l];var d=Math.max(e,2),f=M8(new wn(u).sub(l).div(d-1),s,0),h=[].concat(b1(Bw.rangeStep(new wn(l),new wn(u).sub(new wn(.99).mul(f)),f)),[u]);return r>i?x1(h):h}var iNe=O8(nNe),sNe=O8(rNe),oNe="Invariant failed";function Eu(t,e){throw new Error(oNe)}var aNe=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function hf(t){"@babel/helpers - typeof";return hf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hf(t)}function gb(){return gb=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function pNe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function mNe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gNe(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,o=-1,c=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(c<=1)return 0;if(s&&s.axisType==="angleAxis"&&Math.abs(Math.abs(s.range[1]-s.range[0])-360)<=1e-6)for(var l=s.range,u=0;u0?i[u-1].coordinate:i[c-1].coordinate,f=i[u].coordinate,h=u>=c-1?i[0].coordinate:i[u+1].coordinate,p=void 0;if(vi(f-d)!==vi(h-f)){var g=[];if(vi(h-f)===vi(l[1]-l[0])){p=h;var m=f+l[1]-l[0];g[0]=Math.min(m,(m+d)/2),g[1]=Math.max(m,(m+d)/2)}else{p=d;var v=h+l[1]-l[0];g[0]=Math.min(f,(v+f)/2),g[1]=Math.max(f,(v+f)/2)}var b=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(e>b[0]&&e<=b[1]||e>=g[0]&&e<=g[1]){o=i[u].index;break}}else{var x=Math.min(d,h),w=Math.max(d,h);if(e>(x+f)/2&&e<=(w+f)/2){o=i[u].index;break}}}else for(var S=0;S0&&S(r[S].coordinate+r[S-1].coordinate)/2&&e<=(r[S].coordinate+r[S+1].coordinate)/2||S===c-1&&e>(r[S].coordinate+r[S-1].coordinate)/2){o=r[S].index;break}return o},KP=function(e){var n,r=e,i=r.type.displayName,s=(n=e.type)!==null&&n!==void 0&&n.defaultProps?nr(nr({},e.type.defaultProps),e.props):e.props,o=s.stroke,c=s.fill,l;switch(i){case"Line":l=o;break;case"Area":case"Radar":l=o&&o!=="none"?o:c;break;default:l=c;break}return l},INe=function(e){var n=e.barSize,r=e.totalSize,i=e.stackGroups,s=i===void 0?{}:i;if(!s)return{};for(var o={},c=Object.keys(s),l=0,u=c.length;l=0});if(b&&b.length){var x=b[0].type.defaultProps,w=x!==void 0?nr(nr({},x),b[0].props):b[0].props,S=w.barSize,C=w[v];o[C]||(o[C]=[]);var _=Dt(S)?n:S;o[C].push({item:b[0],stackList:b.slice(1),barSize:Dt(_)?void 0:yi(_,r,0)})}}return o},RNe=function(e){var n=e.barGap,r=e.barCategoryGap,i=e.bandSize,s=e.sizeList,o=s===void 0?[]:s,c=e.maxBarSize,l=o.length;if(l<1)return null;var u=yi(n,i,0,!0),d,f=[];if(o[0].barSize===+o[0].barSize){var h=!1,p=i/l,g=o.reduce(function(S,C){return S+C.barSize||0},0);g+=(l-1)*u,g>=i&&(g-=(l-1)*u,u=0),g>=i&&p>0&&(h=!0,p*=.9,g=l*p);var m=(i-g)/2>>0,v={offset:m-u,size:0};d=o.reduce(function(S,C){var _={item:C.item,position:{offset:v.offset+v.size+u,size:h?p:C.barSize}},A=[].concat(BM(S),[_]);return v=A[A.length-1].position,C.stackList&&C.stackList.length&&C.stackList.forEach(function(j){A.push({item:j,position:v})}),A},f)}else{var b=yi(r,i,0,!0);i-2*b-(l-1)*u<=0&&(u=0);var x=(i-2*b-(l-1)*u)/l;x>1&&(x>>=0);var w=c===+c?Math.min(x,c):x;d=o.reduce(function(S,C,_){var A=[].concat(BM(S),[{item:C.item,position:{offset:b+(x+u)*_+(x-w)/2,size:w}}]);return C.stackList&&C.stackList.length&&C.stackList.forEach(function(j){A.push({item:j,position:A[A.length-1].position})}),A},f)}return d},MNe=function(e,n,r,i){var s=r.children,o=r.width,c=r.margin,l=o-(c.left||0)-(c.right||0),u=U8({children:s,legendWidth:l});if(u){var d=i||{},f=d.width,h=d.height,p=u.align,g=u.verticalAlign,m=u.layout;if((m==="vertical"||m==="horizontal"&&g==="middle")&&p!=="center"&&je(e[p]))return nr(nr({},e),{},kd({},p,e[p]+(f||0)));if((m==="horizontal"||m==="vertical"&&p==="center")&&g!=="middle"&&je(e[g]))return nr(nr({},e),{},kd({},g,e[g]+(h||0)))}return e},DNe=function(e,n,r){return Dt(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},B8=function(e,n,r,i,s){var o=n.props.children,c=js(o,Hw).filter(function(u){return DNe(i,s,u.props.direction)});if(c&&c.length){var l=c.map(function(u){return u.props.dataKey});return e.reduce(function(u,d){var f=or(d,r);if(Dt(f))return u;var h=Array.isArray(f)?[Fw(f),Cc(f)]:[f,f],p=l.reduce(function(g,m){var v=or(d,m,0),b=h[0]-Math.abs(Array.isArray(v)?v[0]:v),x=h[1]+Math.abs(Array.isArray(v)?v[1]:v);return[Math.min(b,g[0]),Math.max(x,g[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},$Ne=function(e,n,r,i,s){var o=n.map(function(c){return B8(e,c,r,s,i)}).filter(function(c){return!Dt(c)});return o&&o.length?o.reduce(function(c,l){return[Math.min(c[0],l[0]),Math.max(c[1],l[1])]},[1/0,-1/0]):null},H8=function(e,n,r,i,s){var o=n.map(function(l){var u=l.props.dataKey;return r==="number"&&u&&B8(e,l,u,i)||xp(e,u,r,s)});if(r==="number")return o.reduce(function(l,u){return[Math.min(l[0],u[0]),Math.max(l[1],u[1])]},[1/0,-1/0]);var c={};return o.reduce(function(l,u){for(var d=0,f=u.length;d=2?vi(c[0]-c[1])*2*u:u,n&&(e.ticks||e.niceTicks)){var d=(e.ticks||e.niceTicks).map(function(f){var h=s?s.indexOf(f):f;return{coordinate:i(h)+u,value:f,offset:u}});return d.filter(function(f){return!th(f.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(f,h){return{coordinate:i(f)+u,value:f,index:h,offset:u}}):i.ticks&&!r?i.ticks(e.tickCount).map(function(f){return{coordinate:i(f)+u,value:f,offset:u}}):i.domain().map(function(f,h){return{coordinate:i(f)+u,value:s?s[f]:f,index:h,offset:u}})},CC=new WeakMap,Pv=function(e,n){if(typeof n!="function")return e;CC.has(e)||CC.set(e,new WeakMap);var r=CC.get(e);if(r.has(n))return r.get(n);var i=function(){e.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,i),i},G8=function(e,n,r){var i=e.scale,s=e.type,o=e.layout,c=e.axisType;if(i==="auto")return o==="radial"&&c==="radiusAxis"?{scale:Pm(),realScaleType:"band"}:o==="radial"&&c==="angleAxis"?{scale:db(),realScaleType:"linear"}:s==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:yp(),realScaleType:"point"}:s==="category"?{scale:Pm(),realScaleType:"band"}:{scale:db(),realScaleType:"linear"};if(Og(i)){var l="scale".concat(Aw(i));return{scale:(MM[l]||yp)(),realScaleType:MM[l]?l:"point"}}return At(i)?{scale:i}:{scale:yp(),realScaleType:"point"}},zM=1e-4,K8=function(e){var n=e.domain();if(!(!n||n.length<=2)){var r=n.length,i=e.range(),s=Math.min(i[0],i[1])-zM,o=Math.max(i[0],i[1])+zM,c=e(n[0]),l=e(n[r-1]);(co||lo)&&e.domain([n[0],n[r-1]])}},LNe=function(e,n){if(!e)return null;for(var r=0,i=e.length;ri)&&(s[1]=i),s[0]>i&&(s[0]=i),s[1]=0?(e[c][r][0]=s,e[c][r][1]=s+l,s=e[c][r][1]):(e[c][r][0]=o,e[c][r][1]=o+l,o=e[c][r][1])}},BNe=function(e){var n=e.length;if(!(n<=0))for(var r=0,i=e[0].length;r=0?(e[o][r][0]=s,e[o][r][1]=s+c,s=e[o][r][1]):(e[o][r][0]=0,e[o][r][1]=0)}},HNe={sign:UNe,expand:ave,none:sf,silhouette:cve,wiggle:lve,positive:BNe},zNe=function(e,n,r){var i=n.map(function(c){return c.props.dataKey}),s=HNe[r],o=ove().keys(i).value(function(c,l){return+or(c,l,0)}).order(qA).offset(s);return o(e)},VNe=function(e,n,r,i,s,o){if(!e)return null;var c=o?n.reverse():n,l={},u=c.reduce(function(f,h){var p,g=(p=h.type)!==null&&p!==void 0&&p.defaultProps?nr(nr({},h.type.defaultProps),h.props):h.props,m=g.stackId,v=g.hide;if(v)return f;var b=g[r],x=f[b]||{hasStack:!1,stackGroups:{}};if(Tr(m)){var w=x.stackGroups[m]||{numericAxisId:r,cateAxisId:i,items:[]};w.items.push(h),x.hasStack=!0,x.stackGroups[m]=w}else x.stackGroups[nh("_stackId_")]={numericAxisId:r,cateAxisId:i,items:[h]};return nr(nr({},f),{},kd({},b,x))},l),d={};return Object.keys(u).reduce(function(f,h){var p=u[h];if(p.hasStack){var g={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(m,v){var b=p.stackGroups[v];return nr(nr({},m),{},kd({},v,{numericAxisId:r,cateAxisId:i,items:b.items,stackedData:zNe(e,b.items,s)}))},g)}return nr(nr({},f),{},kd({},h,p))},d)},W8=function(e,n){var r=n.realScaleType,i=n.type,s=n.tickCount,o=n.originalDomain,c=n.allowDecimals,l=r||n.scale;if(l!=="auto"&&l!=="linear")return null;if(s&&i==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var u=e.domain();if(!u.length)return null;var d=iNe(u,s,c);return e.domain([Fw(d),Cc(d)]),{niceTicks:d}}if(s&&i==="number"){var f=e.domain(),h=sNe(f,s,c);return{niceTicks:h}}return null};function VM(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,s=t.index,o=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Dt(i[e.dataKey])){var c=Vx(n,"value",i[e.dataKey]);if(c)return c.coordinate+r/2}return n[s]?n[s].coordinate+r/2:null}var l=or(i,Dt(o)?e.dataKey:o);return Dt(l)?null:e.scale(l)}var GM=function(e){var n=e.axis,r=e.ticks,i=e.offset,s=e.bandSize,o=e.entry,c=e.index;if(n.type==="category")return r[c]?r[c].coordinate+i:null;var l=or(o,n.dataKey,n.domain[c]);return Dt(l)?null:n.scale(l)-s/2+i},GNe=function(e){var n=e.numericAxis,r=n.scale.domain();if(n.type==="number"){var i=Math.min(r[0],r[1]),s=Math.max(r[0],r[1]);return i<=0&&s>=0?0:s<0?s:i}return r[0]},KNe=function(e,n){var r,i=(r=e.type)!==null&&r!==void 0&&r.defaultProps?nr(nr({},e.type.defaultProps),e.props):e.props,s=i.stackId;if(Tr(s)){var o=n[s];if(o){var c=o.items.indexOf(e);return c>=0?o.stackedData[c]:null}}return null},WNe=function(e){return e.reduce(function(n,r){return[Fw(r.concat([n[0]]).filter(je)),Cc(r.concat([n[1]]).filter(je))]},[1/0,-1/0])},q8=function(e,n,r){return Object.keys(e).reduce(function(i,s){var o=e[s],c=o.stackedData,l=c.reduce(function(u,d){var f=WNe(d.slice(n,r+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],i[0]),Math.max(l[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},KM=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,WM=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,_1=function(e,n,r){if(At(e))return e(n,r);if(!Array.isArray(e))return n;var i=[];if(je(e[0]))i[0]=r?e[0]:Math.min(e[0],n[0]);else if(KM.test(e[0])){var s=+KM.exec(e[0])[1];i[0]=n[0]-s}else At(e[0])?i[0]=e[0](n[0]):i[0]=n[0];if(je(e[1]))i[1]=r?e[1]:Math.max(e[1],n[1]);else if(WM.test(e[1])){var o=+WM.exec(e[1])[1];i[1]=n[1]+o}else At(e[1])?i[1]=e[1](n[1]):i[1]=n[1];return i},yb=function(e,n,r){if(e&&e.scale&&e.scale.bandwidth){var i=e.scale.bandwidth();if(!r||i>0)return i}if(e&&n&&n.length>=2){for(var s=bP(n,function(f){return f.coordinate}),o=1/0,c=1,l=s.length;ct.length)&&(e=t.length);for(var n=0,r=new Array(e);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},J8=function(e,n,r,i,s){var o=e.width,c=e.height,l=e.startAngle,u=e.endAngle,d=yi(e.cx,o,o/2),f=yi(e.cy,c,c/2),h=X8(o,c,r),p=yi(e.innerRadius,h,0),g=yi(e.outerRadius,h,h*.8),m=Object.keys(n);return m.reduce(function(v,b){var x=n[b],w=x.domain,S=x.reversed,C;if(Dt(x.range))i==="angleAxis"?C=[l,u]:i==="radiusAxis"&&(C=[p,g]),S&&(C=[C[1],C[0]]);else{C=x.range;var _=C,A=QNe(_,2);l=A[0],u=A[1]}var j=G8(x,s),T=j.realScaleType,k=j.scale;k.domain(w).range(C),K8(k);var I=W8(k,ha(ha({},x),{},{realScaleType:T})),E=ha(ha(ha({},x),I),{},{range:C,radius:g,realScaleType:T,scale:k,cx:d,cy:f,innerRadius:p,outerRadius:g,startAngle:l,endAngle:u});return ha(ha({},v),{},Q8({},b,E))},{})},nTe=function(e,n){var r=e.x,i=e.y,s=n.x,o=n.y;return Math.sqrt(Math.pow(r-s,2)+Math.pow(i-o,2))},rTe=function(e,n){var r=e.x,i=e.y,s=n.cx,o=n.cy,c=nTe({x:r,y:i},{x:s,y:o});if(c<=0)return{radius:c};var l=(r-s)/c,u=Math.acos(l);return i>o&&(u=2*Math.PI-u),{radius:c,angle:tTe(u),angleInRadian:u}},iTe=function(e){var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),s=Math.floor(r/360),o=Math.min(i,s);return{startAngle:n-o*360,endAngle:r-o*360}},sTe=function(e,n){var r=n.startAngle,i=n.endAngle,s=Math.floor(r/360),o=Math.floor(i/360),c=Math.min(s,o);return e+c*360},XM=function(e,n){var r=e.x,i=e.y,s=rTe({x:r,y:i},n),o=s.radius,c=s.angle,l=n.innerRadius,u=n.outerRadius;if(ou)return!1;if(o===0)return!0;var d=iTe(n),f=d.startAngle,h=d.endAngle,p=c,g;if(f<=h){for(;p>h;)p-=360;for(;p=f&&p<=h}else{for(;p>f;)p-=360;for(;p=h&&p<=f}return g?ha(ha({},n),{},{radius:o,angle:sTe(p,n)}):null},Z8=function(e){return!y.isValidElement(e)&&!At(e)&&typeof e!="boolean"?e.className:""};function Um(t){"@babel/helpers - typeof";return Um=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Um(t)}var oTe=["offset"];function aTe(t){return dTe(t)||uTe(t)||lTe(t)||cTe()}function cTe(){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 lTe(t,e){if(t){if(typeof t=="string")return A1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A1(t,e)}}function uTe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function dTe(t){if(Array.isArray(t))return A1(t)}function A1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function hTe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function JM(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function xr(t){for(var e=1;e=0?1:-1,w,S;i==="insideStart"?(w=p+x*o,S=m):i==="insideEnd"?(w=g-x*o,S=!m):i==="end"&&(w=g+x*o,S=m),S=b<=0?S:!S;var C=un(u,d,v,w),_=un(u,d,v,w+(S?1:-1)*359),A="M".concat(C.x,",").concat(C.y,` + A`).concat(v,",").concat(v,",0,1,").concat(S?0:1,`, + `).concat(_.x,",").concat(_.y),j=Dt(e.id)?nh("recharts-radial-line-"):e.id;return P.createElement("text",Bm({},r,{dominantBaseline:"central",className:It("recharts-radial-bar-label",c)}),P.createElement("defs",null,P.createElement("path",{id:j,d:A})),P.createElement("textPath",{xlinkHref:"#".concat(j)},n))},bTe=function(e){var n=e.viewBox,r=e.offset,i=e.position,s=n,o=s.cx,c=s.cy,l=s.innerRadius,u=s.outerRadius,d=s.startAngle,f=s.endAngle,h=(d+f)/2;if(i==="outside"){var p=un(o,c,u+r,h),g=p.x,m=p.y;return{x:g,y:m,textAnchor:g>=o?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:o,y:c,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:o,y:c,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:o,y:c,textAnchor:"middle",verticalAnchor:"end"};var v=(l+u)/2,b=un(o,c,v,h),x=b.x,w=b.y;return{x,y:w,textAnchor:"middle",verticalAnchor:"middle"}},wTe=function(e){var n=e.viewBox,r=e.parentViewBox,i=e.offset,s=e.position,o=n,c=o.x,l=o.y,u=o.width,d=o.height,f=d>=0?1:-1,h=f*i,p=f>0?"end":"start",g=f>0?"start":"end",m=u>=0?1:-1,v=m*i,b=m>0?"end":"start",x=m>0?"start":"end";if(s==="top"){var w={x:c+u/2,y:l-f*i,textAnchor:"middle",verticalAnchor:p};return xr(xr({},w),r?{height:Math.max(l-r.y,0),width:u}:{})}if(s==="bottom"){var S={x:c+u/2,y:l+d+h,textAnchor:"middle",verticalAnchor:g};return xr(xr({},S),r?{height:Math.max(r.y+r.height-(l+d),0),width:u}:{})}if(s==="left"){var C={x:c-v,y:l+d/2,textAnchor:b,verticalAnchor:"middle"};return xr(xr({},C),r?{width:Math.max(C.x-r.x,0),height:d}:{})}if(s==="right"){var _={x:c+u+v,y:l+d/2,textAnchor:x,verticalAnchor:"middle"};return xr(xr({},_),r?{width:Math.max(r.x+r.width-_.x,0),height:d}:{})}var A=r?{width:u,height:d}:{};return s==="insideLeft"?xr({x:c+v,y:l+d/2,textAnchor:x,verticalAnchor:"middle"},A):s==="insideRight"?xr({x:c+u-v,y:l+d/2,textAnchor:b,verticalAnchor:"middle"},A):s==="insideTop"?xr({x:c+u/2,y:l+h,textAnchor:"middle",verticalAnchor:g},A):s==="insideBottom"?xr({x:c+u/2,y:l+d-h,textAnchor:"middle",verticalAnchor:p},A):s==="insideTopLeft"?xr({x:c+v,y:l+h,textAnchor:x,verticalAnchor:g},A):s==="insideTopRight"?xr({x:c+u-v,y:l+h,textAnchor:b,verticalAnchor:g},A):s==="insideBottomLeft"?xr({x:c+v,y:l+d-h,textAnchor:x,verticalAnchor:p},A):s==="insideBottomRight"?xr({x:c+u-v,y:l+d-h,textAnchor:b,verticalAnchor:p},A):Xf(s)&&(je(s.x)||Ul(s.x))&&(je(s.y)||Ul(s.y))?xr({x:c+yi(s.x,u),y:l+yi(s.y,d),textAnchor:"end",verticalAnchor:"end"},A):xr({x:c+u/2,y:l+d/2,textAnchor:"middle",verticalAnchor:"middle"},A)},STe=function(e){return"cx"in e&&je(e.cx)};function Dr(t){var e=t.offset,n=e===void 0?5:e,r=fTe(t,oTe),i=xr({offset:n},r),s=i.viewBox,o=i.position,c=i.value,l=i.children,u=i.content,d=i.className,f=d===void 0?"":d,h=i.textBreakAll;if(!s||Dt(c)&&Dt(l)&&!y.isValidElement(u)&&!At(u))return null;if(y.isValidElement(u))return y.cloneElement(u,i);var p;if(At(u)){if(p=y.createElement(u,i),y.isValidElement(p))return p}else p=vTe(i);var g=STe(s),m=rt(i,!0);if(g&&(o==="insideStart"||o==="insideEnd"||o==="end"))return xTe(i,p,m);var v=g?bTe(i):wTe(i);return P.createElement(_u,Bm({className:It("recharts-label",f)},m,v,{breakAll:h}),p)}Dr.displayName="Label";var eK=function(e){var n=e.cx,r=e.cy,i=e.angle,s=e.startAngle,o=e.endAngle,c=e.r,l=e.radius,u=e.innerRadius,d=e.outerRadius,f=e.x,h=e.y,p=e.top,g=e.left,m=e.width,v=e.height,b=e.clockWise,x=e.labelViewBox;if(x)return x;if(je(m)&&je(v)){if(je(f)&&je(h))return{x:f,y:h,width:m,height:v};if(je(p)&&je(g))return{x:p,y:g,width:m,height:v}}return je(f)&&je(h)?{x:f,y:h,width:0,height:0}:je(n)&&je(r)?{cx:n,cy:r,startAngle:s||i||0,endAngle:o||i||0,innerRadius:u||0,outerRadius:d||l||c||0,clockWise:b}:e.viewBox?e.viewBox:{}},CTe=function(e,n){return e?e===!0?P.createElement(Dr,{key:"label-implicit",viewBox:n}):Tr(e)?P.createElement(Dr,{key:"label-implicit",viewBox:n,value:e}):y.isValidElement(e)?e.type===Dr?y.cloneElement(e,{key:"label-implicit",viewBox:n}):P.createElement(Dr,{key:"label-implicit",content:e,viewBox:n}):At(e)?P.createElement(Dr,{key:"label-implicit",content:e,viewBox:n}):Xf(e)?P.createElement(Dr,Bm({viewBox:n},e,{key:"label-implicit"})):null:null},_Te=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var i=e.children,s=eK(e),o=js(i,Dr).map(function(l,u){return y.cloneElement(l,{viewBox:n||s,key:"label-".concat(u)})});if(!r)return o;var c=CTe(e.label,n||s);return[c].concat(aTe(o))};Dr.parseViewBox=eK;Dr.renderCallByParent=_Te;function ATe(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var jTe=ATe;const tK=dn(jTe);function Hm(t){"@babel/helpers - typeof";return Hm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hm(t)}var ETe=["valueAccessor"],NTe=["data","dataKey","clockWise","id","textBreakAll"];function TTe(t){return ITe(t)||OTe(t)||kTe(t)||PTe()}function PTe(){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 kTe(t,e){if(t){if(typeof t=="string")return j1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return j1(t,e)}}function OTe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ITe(t){if(Array.isArray(t))return j1(t)}function j1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function $Te(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var LTe=function(e){return Array.isArray(e.value)?tK(e.value):e.value};function zo(t){var e=t.valueAccessor,n=e===void 0?LTe:e,r=tD(t,ETe),i=r.data,s=r.dataKey,o=r.clockWise,c=r.id,l=r.textBreakAll,u=tD(r,NTe);return!i||!i.length?null:P.createElement(qt,{className:"recharts-label-list"},i.map(function(d,f){var h=Dt(s)?n(d,f):or(d&&d.payload,s),p=Dt(c)?{}:{id:"".concat(c,"-").concat(f)};return P.createElement(Dr,bb({},rt(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:l,viewBox:Dr.parseViewBox(Dt(o)?d:eD(eD({},d),{},{clockWise:o})),key:"label-".concat(f),index:f}))}))}zo.displayName="LabelList";function FTe(t,e){return t?t===!0?P.createElement(zo,{key:"labelList-implicit",data:e}):P.isValidElement(t)||At(t)?P.createElement(zo,{key:"labelList-implicit",data:e,content:t}):Xf(t)?P.createElement(zo,bb({data:e},t,{key:"labelList-implicit"})):null:null}function UTe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var r=t.children,i=js(r,zo).map(function(o,c){return y.cloneElement(o,{data:e,key:"labelList-".concat(c)})});if(!n)return i;var s=FTe(t.label,e);return[s].concat(TTe(i))}zo.renderCallByParent=UTe;function zm(t){"@babel/helpers - typeof";return zm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zm(t)}function E1(){return E1=Object.assign?Object.assign.bind():function(t){for(var e=1;e180),",").concat(+(o>u),`, + `).concat(f.x,",").concat(f.y,` + `);if(i>0){var p=un(n,r,i,o),g=un(n,r,i,u);h+="L ".concat(g.x,",").concat(g.y,` + A `).concat(i,",").concat(i,`,0, + `).concat(+(Math.abs(l)>180),",").concat(+(o<=u),`, + `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(n,",").concat(r," Z");return h},GTe=function(e){var n=e.cx,r=e.cy,i=e.innerRadius,s=e.outerRadius,o=e.cornerRadius,c=e.forceCornerRadius,l=e.cornerIsExternal,u=e.startAngle,d=e.endAngle,f=vi(d-u),h=kv({cx:n,cy:r,radius:s,angle:u,sign:f,cornerRadius:o,cornerIsExternal:l}),p=h.circleTangency,g=h.lineTangency,m=h.theta,v=kv({cx:n,cy:r,radius:s,angle:d,sign:-f,cornerRadius:o,cornerIsExternal:l}),b=v.circleTangency,x=v.lineTangency,w=v.theta,S=l?Math.abs(u-d):Math.abs(u-d)-m-w;if(S<0)return c?"M ".concat(g.x,",").concat(g.y,` + a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0 + a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0 + `):nK({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:u,endAngle:d});var C="M ".concat(g.x,",").concat(g.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,` + A`).concat(s,",").concat(s,",0,").concat(+(S>180),",").concat(+(f<0),",").concat(b.x,",").concat(b.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(x.x,",").concat(x.y,` + `);if(i>0){var _=kv({cx:n,cy:r,radius:i,angle:u,sign:f,isExternal:!0,cornerRadius:o,cornerIsExternal:l}),A=_.circleTangency,j=_.lineTangency,T=_.theta,k=kv({cx:n,cy:r,radius:i,angle:d,sign:-f,isExternal:!0,cornerRadius:o,cornerIsExternal:l}),I=k.circleTangency,E=k.lineTangency,O=k.theta,M=l?Math.abs(u-d):Math.abs(u-d)-T-O;if(M<0&&o===0)return"".concat(C,"L").concat(n,",").concat(r,"Z");C+="L".concat(E.x,",").concat(E.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(I.x,",").concat(I.y,` + A`).concat(i,",").concat(i,",0,").concat(+(M>180),",").concat(+(f>0),",").concat(A.x,",").concat(A.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(j.x,",").concat(j.y,"Z")}else C+="L".concat(n,",").concat(r,"Z");return C},KTe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},rK=function(e){var n=rD(rD({},KTe),e),r=n.cx,i=n.cy,s=n.innerRadius,o=n.outerRadius,c=n.cornerRadius,l=n.forceCornerRadius,u=n.cornerIsExternal,d=n.startAngle,f=n.endAngle,h=n.className;if(o0&&Math.abs(d-f)<360?v=GTe({cx:r,cy:i,innerRadius:s,outerRadius:o,cornerRadius:Math.min(m,g/2),forceCornerRadius:l,cornerIsExternal:u,startAngle:d,endAngle:f}):v=nK({cx:r,cy:i,innerRadius:s,outerRadius:o,startAngle:d,endAngle:f}),P.createElement("path",E1({},rt(n,!0),{className:p,d:v,role:"img"}))};function Vm(t){"@babel/helpers - typeof";return Vm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vm(t)}function N1(){return N1=Object.assign?Object.assign.bind():function(t){for(var e=1;e0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function aPe(t,e){return lh(t.getTime(),e.getTime())}function dD(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.entries(),s=0,o,c;(o=i.next())&&!o.done;){for(var l=e.entries(),u=!1,d=0;(c=l.next())&&!c.done;){var f=o.value,h=f[0],p=f[1],g=c.value,m=g[0],v=g[1];!u&&!r[d]&&(u=n.equals(h,m,s,d,t,e,n)&&n.equals(p,v,h,m,t,e,n))&&(r[d]=!0),d++}if(!u)return!1;s++}return!0}function cPe(t,e,n){var r=uD(t),i=r.length;if(uD(e).length!==i)return!1;for(var s;i-- >0;)if(s=r[i],s===cK&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!aK(e,s)||!n.equals(t[s],e[s],s,s,t,e,n))return!1;return!0}function Dh(t,e,n){var r=cD(t),i=r.length;if(cD(e).length!==i)return!1;for(var s,o,c;i-- >0;)if(s=r[i],s===cK&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!aK(e,s)||!n.equals(t[s],e[s],s,s,t,e,n)||(o=lD(t,s),c=lD(e,s),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function lPe(t,e){return lh(t.valueOf(),e.valueOf())}function uPe(t,e){return t.source===e.source&&t.flags===e.flags}function fD(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.values(),s,o;(s=i.next())&&!s.done;){for(var c=e.values(),l=!1,u=0;(o=c.next())&&!o.done;)!l&&!r[u]&&(l=n.equals(s.value,o.value,s.value,o.value,t,e,n))&&(r[u]=!0),u++;if(!l)return!1}return!0}function dPe(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}var fPe="[object Arguments]",hPe="[object Boolean]",pPe="[object Date]",mPe="[object Map]",gPe="[object Number]",vPe="[object Object]",yPe="[object RegExp]",xPe="[object Set]",bPe="[object String]",wPe=Array.isArray,hD=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,pD=Object.assign,SPe=Object.prototype.toString.call.bind(Object.prototype.toString);function CPe(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,s=t.arePrimitiveWrappersEqual,o=t.areRegExpsEqual,c=t.areSetsEqual,l=t.areTypedArraysEqual;return function(d,f,h){if(d===f)return!0;if(d==null||f==null||typeof d!="object"||typeof f!="object")return d!==d&&f!==f;var p=d.constructor;if(p!==f.constructor)return!1;if(p===Object)return i(d,f,h);if(wPe(d))return e(d,f,h);if(hD!=null&&hD(d))return l(d,f,h);if(p===Date)return n(d,f,h);if(p===RegExp)return o(d,f,h);if(p===Map)return r(d,f,h);if(p===Set)return c(d,f,h);var g=SPe(d);return g===pPe?n(d,f,h):g===yPe?o(d,f,h):g===mPe?r(d,f,h):g===xPe?c(d,f,h):g===vPe?typeof d.then!="function"&&typeof f.then!="function"&&i(d,f,h):g===fPe?i(d,f,h):g===hPe||g===gPe||g===bPe?s(d,f,h):!1}}function _Pe(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?Dh:oPe,areDatesEqual:aPe,areMapsEqual:r?aD(dD,Dh):dD,areObjectsEqual:r?Dh:cPe,arePrimitiveWrappersEqual:lPe,areRegExpsEqual:uPe,areSetsEqual:r?aD(fD,Dh):fD,areTypedArraysEqual:r?Dh:dPe};if(n&&(i=pD({},i,n(i))),e){var s=Iv(i.areArraysEqual),o=Iv(i.areMapsEqual),c=Iv(i.areObjectsEqual),l=Iv(i.areSetsEqual);i=pD({},i,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:c,areSetsEqual:l})}return i}function APe(t){return function(e,n,r,i,s,o,c){return t(e,n,c)}}function jPe(t){var e=t.circular,n=t.comparator,r=t.createState,i=t.equals,s=t.strict;if(r)return function(l,u){var d=r(),f=d.cache,h=f===void 0?e?new WeakMap:void 0:f,p=d.meta;return n(l,u,{cache:h,equals:i,meta:p,strict:s})};if(e)return function(l,u){return n(l,u,{cache:new WeakMap,equals:i,meta:void 0,strict:s})};var o={cache:void 0,equals:i,meta:void 0,strict:s};return function(l,u){return n(l,u,o)}}var EPe=vl();vl({strict:!0});vl({circular:!0});vl({circular:!0,strict:!0});vl({createInternalComparator:function(){return lh}});vl({strict:!0,createInternalComparator:function(){return lh}});vl({circular:!0,createInternalComparator:function(){return lh}});vl({circular:!0,createInternalComparator:function(){return lh},strict:!0});function vl(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,i=t.createState,s=t.strict,o=s===void 0?!1:s,c=_Pe(t),l=CPe(c),u=r?r(l):APe(l);return jPe({circular:n,comparator:l,createState:i,equals:u,strict:o})}function NPe(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function mD(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function i(s){n<0&&(n=s),s-n>e?(t(s),n=-1):NPe(i)};requestAnimationFrame(r)}function T1(t){"@babel/helpers - typeof";return T1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T1(t)}function TPe(t){return IPe(t)||OPe(t)||kPe(t)||PPe()}function PPe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kPe(t,e){if(t){if(typeof t=="string")return gD(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gD(t,e)}}function gD(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1?1:b<0?0:b},m=function(b){for(var x=b>1?1:b,w=x,S=0;S<8;++S){var C=f(w)-x,_=p(w);if(Math.abs(C-x)0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,i=e.damping,s=i===void 0?8:i,o=e.dt,c=o===void 0?17:o,l=function(d,f,h){var p=-(d-f)*r,g=h*s,m=h+(p-g)*c/1e3,v=h*c/1e3+d;return Math.abs(v-f)t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function uke(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s=0)&&(n[i]=t[i]);return n}function _C(t){return pke(t)||hke(t)||fke(t)||dke()}function dke(){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 fke(t,e){if(t){if(typeof t=="string")return R1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return R1(t,e)}}function hke(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function pke(t){if(Array.isArray(t))return R1(t)}function R1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Cb(t){return Cb=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Cb(t)}var go=function(t){xke(n,t);var e=bke(n);function n(r,i){var s;mke(this,n),s=e.call(this,r,i);var o=s.props,c=o.isActive,l=o.attributeName,u=o.from,d=o.to,f=o.steps,h=o.children,p=o.duration;if(s.handleStyleChange=s.handleStyleChange.bind($1(s)),s.changeStyle=s.changeStyle.bind($1(s)),!c||p<=0)return s.state={style:{}},typeof h=="function"&&(s.state={style:d}),D1(s);if(f&&f.length)s.state={style:f[0].style};else if(u){if(typeof h=="function")return s.state={style:u},D1(s);s.state={style:l?Xh({},l,u):u}}else s.state={style:{}};return s}return vke(n,[{key:"componentDidMount",value:function(){var i=this.props,s=i.isActive,o=i.canBegin;this.mounted=!0,!(!s||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var s=this.props,o=s.isActive,c=s.canBegin,l=s.attributeName,u=s.shouldReAnimate,d=s.to,f=s.from,h=this.state.style;if(c){if(!o){var p={style:l?Xh({},l,d):d};this.state&&h&&(l&&h[l]!==d||!l&&h!==d)&&this.setState(p);return}if(!(EPe(i.to,d)&&i.canBegin&&i.isActive)){var g=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var m=g||u?f:i.to;if(this.state&&h){var v={style:l?Xh({},l,m):m};(l&&h[l]!==m||!l&&h!==m)&&this.setState(v)}this.runAnimation(Ds(Ds({},this.props),{},{from:m,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var s=this,o=i.from,c=i.to,l=i.duration,u=i.easing,d=i.begin,f=i.onAnimationEnd,h=i.onAnimationStart,p=ake(o,c,QPe(u),l,this.changeStyle),g=function(){s.stopJSAnimation=p()};this.manager.start([h,d,g,l,f])}},{key:"runStepAnimation",value:function(i){var s=this,o=i.steps,c=i.begin,l=i.onAnimationStart,u=o[0],d=u.style,f=u.duration,h=f===void 0?0:f,p=function(m,v,b){if(b===0)return m;var x=v.duration,w=v.easing,S=w===void 0?"ease":w,C=v.style,_=v.properties,A=v.onAnimationEnd,j=b>0?o[b-1]:v,T=_||Object.keys(C);if(typeof S=="function"||S==="spring")return[].concat(_C(m),[s.runJSAnimation.bind(s,{from:j.style,to:C,duration:x,easing:S}),x]);var k=xD(T,x,S),I=Ds(Ds(Ds({},j.style),C),{},{transition:k});return[].concat(_C(m),[I,x,A]).filter(LPe)};return this.manager.start([l].concat(_C(o.reduce(p,[d,Math.max(h,c)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=RPe());var s=i.begin,o=i.duration,c=i.attributeName,l=i.to,u=i.easing,d=i.onAnimationStart,f=i.onAnimationEnd,h=i.steps,p=i.children,g=this.manager;if(this.unSubscribe=g.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(i);return}if(h.length>1){this.runStepAnimation(i);return}var m=c?Xh({},c,l):l,v=xD(Object.keys(m),o,u);g.start([d,s,Ds(Ds({},m),{},{transition:v}),o,f])}},{key:"render",value:function(){var i=this.props,s=i.children;i.begin;var o=i.duration;i.attributeName,i.easing;var c=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var l=lke(i,cke),u=y.Children.count(s),d=this.state.style;if(typeof s=="function")return s(d);if(!c||u===0||o<=0)return s;var f=function(p){var g=p.props,m=g.style,v=m===void 0?{}:m,b=g.className,x=y.cloneElement(p,Ds(Ds({},l),{},{style:Ds(Ds({},v),d),className:b}));return x};return u===1?f(y.Children.only(s)):P.createElement("div",null,y.Children.map(s,function(h){return f(h)}))}}]),n}(y.PureComponent);go.displayName="Animate";go.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};go.propTypes={from:Bt.oneOfType([Bt.object,Bt.string]),to:Bt.oneOfType([Bt.object,Bt.string]),attributeName:Bt.string,duration:Bt.number,begin:Bt.number,easing:Bt.oneOfType([Bt.string,Bt.func]),steps:Bt.arrayOf(Bt.shape({duration:Bt.number.isRequired,style:Bt.object.isRequired,easing:Bt.oneOfType([Bt.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Bt.func]),properties:Bt.arrayOf("string"),onAnimationEnd:Bt.func})),children:Bt.oneOfType([Bt.node,Bt.func]),isActive:Bt.bool,canBegin:Bt.bool,onAnimationEnd:Bt.func,shouldReAnimate:Bt.bool,onAnimationStart:Bt.func,onAnimationReStart:Bt.func};Bt.object,Bt.object,Bt.object,Bt.element;Bt.object,Bt.object,Bt.object,Bt.oneOfType([Bt.array,Bt.element]),Bt.any;function Wm(t){"@babel/helpers - typeof";return Wm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wm(t)}function _b(){return _b=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0?1:-1,l=r>=0?1:-1,u=i>=0&&r>=0||i<0&&r<0?1:0,d;if(o>0&&s instanceof Array){for(var f=[0,0,0,0],h=0,p=4;ho?o:s[h];d="M".concat(e,",").concat(n+c*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(e+l*f[0],",").concat(n)),d+="L ".concat(e+r-l*f[1],",").concat(n),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`, + `).concat(e+r,",").concat(n+c*f[1])),d+="L ".concat(e+r,",").concat(n+i-c*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`, + `).concat(e+r-l*f[2],",").concat(n+i)),d+="L ".concat(e+l*f[3],",").concat(n+i),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`, + `).concat(e,",").concat(n+i-c*f[3])),d+="Z"}else if(o>0&&s===+s&&s>0){var g=Math.min(o,s);d="M ".concat(e,",").concat(n+c*g,` + A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e+l*g,",").concat(n,` + L `).concat(e+r-l*g,",").concat(n,` + A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e+r,",").concat(n+c*g,` + L `).concat(e+r,",").concat(n+i-c*g,` + A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e+r-l*g,",").concat(n+i,` + L `).concat(e+l*g,",").concat(n+i,` + A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e,",").concat(n+i-c*g," Z")}else d="M ".concat(e,",").concat(n," h ").concat(r," v ").concat(i," h ").concat(-r," Z");return d},Pke=function(e,n){if(!e||!n)return!1;var r=e.x,i=e.y,s=n.x,o=n.y,c=n.width,l=n.height;if(Math.abs(c)>0&&Math.abs(l)>0){var u=Math.min(s,s+c),d=Math.max(s,s+c),f=Math.min(o,o+l),h=Math.max(o,o+l);return r>=u&&r<=d&&i>=f&&i<=h}return!1},kke={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},WP=function(e){var n=ED(ED({},kke),e),r=y.useRef(),i=y.useState(-1),s=Ske(i,2),o=s[0],c=s[1];y.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var S=r.current.getTotalLength();S&&c(S)}catch{}},[]);var l=n.x,u=n.y,d=n.width,f=n.height,h=n.radius,p=n.className,g=n.animationEasing,m=n.animationDuration,v=n.animationBegin,b=n.isAnimationActive,x=n.isUpdateAnimationActive;if(l!==+l||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var w=It("recharts-rectangle",p);return x?P.createElement(go,{canBegin:o>0,from:{width:d,height:f,x:l,y:u},to:{width:d,height:f,x:l,y:u},duration:m,animationEasing:g,isActive:x},function(S){var C=S.width,_=S.height,A=S.x,j=S.y;return P.createElement(go,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:m,isActive:b,easing:g},P.createElement("path",_b({},rt(n,!0),{className:w,d:ND(A,j,C,_,h),ref:r})))}):P.createElement("path",_b({},rt(n,!0),{className:w,d:ND(l,u,d,f,h)}))},Oke=["points","className","baseLinePoints","connectNulls"];function fd(){return fd=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Rke(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function TD(t){return Lke(t)||$ke(t)||Dke(t)||Mke()}function Mke(){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 Dke(t,e){if(t){if(typeof t=="string")return L1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return L1(t,e)}}function $ke(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Lke(t){if(Array.isArray(t))return L1(t)}function L1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(r){PD(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),PD(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},wp=function(e,n){var r=Fke(e);n&&(r=[r.reduce(function(s,o){return[].concat(TD(s),TD(o))},[])]);var i=r.map(function(s){return s.reduce(function(o,c,l){return"".concat(o).concat(l===0?"M":"L").concat(c.x,",").concat(c.y)},"")}).join("");return r.length===1?"".concat(i,"Z"):i},Uke=function(e,n,r){var i=wp(e,r);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(wp(n.reverse(),r).slice(1))},mK=function(e){var n=e.points,r=e.className,i=e.baseLinePoints,s=e.connectNulls,o=Ike(e,Oke);if(!n||!n.length)return null;var c=It("recharts-polygon",r);if(i&&i.length){var l=o.stroke&&o.stroke!=="none",u=Uke(n,i,s);return P.createElement("g",{className:c},P.createElement("path",fd({},rt(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:u})),l?P.createElement("path",fd({},rt(o,!0),{fill:"none",d:wp(n,s)})):null,l?P.createElement("path",fd({},rt(o,!0),{fill:"none",d:wp(i,s)})):null)}var d=wp(n,s);return P.createElement("path",fd({},rt(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",className:c,d}))};function F1(){return F1=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Wke(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var qke=function(e,n,r,i,s,o){return"M".concat(e,",").concat(s,"v").concat(i,"M").concat(o,",").concat(n,"h").concat(r)},Yke=function(e){var n=e.x,r=n===void 0?0:n,i=e.y,s=i===void 0?0:i,o=e.top,c=o===void 0?0:o,l=e.left,u=l===void 0?0:l,d=e.width,f=d===void 0?0:d,h=e.height,p=h===void 0?0:h,g=e.className,m=Kke(e,Bke),v=Hke({x:r,y:s,top:c,left:u,width:f,height:p},m);return!je(r)||!je(s)||!je(f)||!je(p)||!je(c)||!je(u)?null:P.createElement("path",U1({},rt(v,!0),{className:It("recharts-cross",g),d:qke(r,s,f,p,c,u)}))},Qke=["cx","cy","innerRadius","outerRadius","gridType","radialLines"];function Ym(t){"@babel/helpers - typeof";return Ym=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ym(t)}function Xke(t,e){if(t==null)return{};var n=Jke(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Jke(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function za(){return za=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function wOe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function SOe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function MD(t,e){for(var n=0;nLD?o=i==="outer"?"start":"end":s<-LD?o=i==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.cx,s=r.cy,o=r.radius,c=r.axisLine,l=r.axisLineType,u=Cl(Cl({},rt(this.props,!1)),{},{fill:"none"},rt(c,!1));if(l==="circle")return P.createElement(Fg,Pl({className:"recharts-polar-angle-axis-line"},u,{cx:i,cy:s,r:o}));var d=this.props.ticks,f=d.map(function(h){return un(i,s,o,h.coordinate)});return P.createElement(mK,Pl({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var r=this,i=this.props,s=i.ticks,o=i.tick,c=i.tickLine,l=i.tickFormatter,u=i.stroke,d=rt(this.props,!1),f=rt(o,!1),h=Cl(Cl({},d),{},{fill:"none"},rt(c,!1)),p=s.map(function(g,m){var v=r.getTickLineCoord(g),b=r.getTickTextAnchor(g),x=Cl(Cl(Cl({textAnchor:b},d),{},{stroke:"none",fill:u},f),{},{index:m,payload:g,x:v.x2,y:v.y2});return P.createElement(qt,Pl({className:It("recharts-polar-angle-axis-tick",Z8(o)),key:"tick-".concat(g.coordinate)},Cu(r.props,g,m)),c&&P.createElement("line",Pl({className:"recharts-polar-angle-axis-tick-line"},h,v)),o&&e.renderTickItem(o,x,l?l(g.value,m):g.value))});return P.createElement(qt,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var r=this.props,i=r.ticks,s=r.radius,o=r.axisLine;return s<=0||!i||!i.length?null:P.createElement(qt,{className:It("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,i,s){var o;return P.isValidElement(r)?o=P.cloneElement(r,i):At(r)?o=r(i):o=P.createElement(_u,Pl({},i,{className:"recharts-polar-angle-axis-tick-value"}),s),o}}])}(y.PureComponent);Vw(dh,"displayName","PolarAngleAxis");Vw(dh,"axisType","angleAxis");Vw(dh,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var $Oe=xG,LOe=$Oe(Object.getPrototypeOf,Object),FOe=LOe,UOe=qa,BOe=FOe,HOe=Ya,zOe="[object Object]",VOe=Function.prototype,GOe=Object.prototype,wK=VOe.toString,KOe=GOe.hasOwnProperty,WOe=wK.call(Object);function qOe(t){if(!HOe(t)||UOe(t)!=zOe)return!1;var e=BOe(t);if(e===null)return!0;var n=KOe.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&wK.call(n)==WOe}var YOe=qOe;const QOe=dn(YOe);var XOe=qa,JOe=Ya,ZOe="[object Boolean]";function eIe(t){return t===!0||t===!1||JOe(t)&&XOe(t)==ZOe}var tIe=eIe;const nIe=dn(tIe);function Xm(t){"@babel/helpers - typeof";return Xm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xm(t)}function Eb(){return Eb=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n0,from:{upperWidth:0,lowerWidth:0,height:h,x:l,y:u},to:{upperWidth:d,lowerWidth:f,height:h,x:l,y:u},duration:m,animationEasing:g,isActive:b},function(w){var S=w.upperWidth,C=w.lowerWidth,_=w.height,A=w.x,j=w.y;return P.createElement(go,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:m,easing:g},P.createElement("path",Eb({},rt(n,!0),{className:x,d:HD(A,j,S,C,_),ref:r})))}):P.createElement("g",null,P.createElement("path",Eb({},rt(n,!0),{className:x,d:HD(l,u,d,f,h)})))},hIe=["option","shapeType","propTransformer","activeClassName","isActive"];function Jm(t){"@babel/helpers - typeof";return Jm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jm(t)}function pIe(t,e){if(t==null)return{};var n=mIe(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function mIe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function zD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Nb(t){for(var e=1;e0?rs(w,"paddingAngle",0):0;if(C){var A=Mr(C.endAngle-C.startAngle,w.endAngle-w.startAngle),j=Nn(Nn({},w),{},{startAngle:x+_,endAngle:x+A(m)+_});v.push(j),x=j.endAngle}else{var T=w.endAngle,k=w.startAngle,I=Mr(0,T-k),E=I(m),O=Nn(Nn({},w),{},{startAngle:x+_,endAngle:x+E+_});v.push(O),x=O.endAngle}}),P.createElement(qt,null,r.renderSectorsStatically(v))})}},{key:"attachKeyboardHandlers",value:function(r){var i=this;r.onkeydown=function(s){if(!s.altKey)switch(s.key){case"ArrowLeft":{var o=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[o].focus(),i.setState({sectorToFocus:o});break}case"ArrowRight":{var c=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[c].focus(),i.setState({sectorToFocus:c});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,i=r.sectors,s=r.isAnimationActive,o=this.state.prevSectors;return s&&i&&i.length&&(!o||!Au(o,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,i=this.props,s=i.hide,o=i.sectors,c=i.className,l=i.label,u=i.cx,d=i.cy,f=i.innerRadius,h=i.outerRadius,p=i.isAnimationActive,g=this.state.isAnimationFinished;if(s||!o||!o.length||!je(u)||!je(d)||!je(f)||!je(h))return null;var m=It("recharts-pie",c);return P.createElement(qt,{tabIndex:this.props.rootTabIndex,className:m,ref:function(b){r.pieRef=b}},this.renderSectors(),l&&this.renderLabels(o),Dr.renderCallByParent(this.props,null,!1),(!p||g)&&zo.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return i.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:r.sectors!==i.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,i){return r>i?"start":r=360?x:x-1)*l,S=v-x*p-w,C=i.reduce(function(j,T){var k=or(T,b,0);return j+(je(k)?k:0)},0),_;if(C>0){var A;_=i.map(function(j,T){var k=or(j,b,0),I=or(j,d,T),E=(je(k)?k:0)/C,O;T?O=A.endAngle+vi(m)*l*(k!==0?1:0):O=o;var M=O+vi(m)*((k!==0?p:0)+E*S),U=(O+M)/2,D=(g.innerRadius+g.outerRadius)/2,B=[{name:I,value:k,payload:j,dataKey:b,type:h}],R=un(g.cx,g.cy,D,U);return A=Nn(Nn(Nn({percent:E,cornerRadius:s,name:I,tooltipPayload:B,midAngle:U,middleRadius:D,tooltipPosition:R},j),g),{},{value:or(j,b),startAngle:O,endAngle:M,payload:j,paddingAngle:vi(m)*l}),A})}return Nn(Nn({},g),{},{sectors:_,data:i})});function DIe(t){return t&&t.length?t[0]:void 0}var $Ie=DIe,LIe=$Ie;const FIe=dn(LIe);var UIe=["key"];function yf(t){"@babel/helpers - typeof";return yf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yf(t)}function BIe(t,e){if(t==null)return{};var n=HIe(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function HIe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Pb(){return Pb=Object.assign?Object.assign.bind():function(t){for(var e=1;e=2&&(l=!0),u.push(di(di({},un(o,c,x,v)),{},{name:g,value:m,cx:o,cy:c,radius:x,angle:v,payload:h}))});var f=[];return l&&u.forEach(function(h){if(Array.isArray(h.value)){var p=FIe(h.value),g=Dt(p)?void 0:e.scale(p);f.push(di(di({},h),{},{radius:g},un(o,c,g,h.angle)))}else f.push(h)}),{points:u,isRange:l,baseLinePoints:f}});var QIe=Math.ceil,XIe=Math.max;function JIe(t,e,n,r){for(var i=-1,s=XIe(QIe((e-t)/(n||1)),0),o=Array(s);s--;)o[r?s:++i]=t,t+=n;return o}var ZIe=JIe,eRe=LG,YD=1/0,tRe=17976931348623157e292;function nRe(t){if(!t)return t===0?t:0;if(t=eRe(t),t===YD||t===-YD){var e=t<0?-1:1;return e*tRe}return t===t?t:0}var EK=nRe,rRe=ZIe,iRe=kw,AC=EK;function sRe(t){return function(e,n,r){return r&&typeof r!="number"&&iRe(e,n,r)&&(n=r=void 0),e=AC(e),n===void 0?(n=e,e=0):n=AC(n),r=r===void 0?e0&&r.handleDrag(i.changedTouches[0])}),Vi(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=r.props,s=i.endIndex,o=i.onDragEnd,c=i.startIndex;o==null||o({endIndex:s,startIndex:c})}),r.detachDragEndListener()}),Vi(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Vi(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Vi(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Vi(r,"handleSlideDragStart",function(i){var s=e$(i)?i.changedTouches[0]:i;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:s.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return xRe(e,t),mRe(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var i=r.startX,s=r.endX,o=this.state.scaleValues,c=this.props,l=c.gap,u=c.data,d=u.length-1,f=Math.min(i,s),h=Math.max(i,s),p=e.getIndexInRange(o,f),g=e.getIndexInRange(o,h);return{startIndex:p-p%l,endIndex:g===d?d:g-g%l}}},{key:"getTextOfTick",value:function(r){var i=this.props,s=i.data,o=i.tickFormatter,c=i.dataKey,l=or(s[r],c,r);return At(o)?o(l,r):l}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var i=this.state,s=i.slideMoveStartX,o=i.startX,c=i.endX,l=this.props,u=l.x,d=l.width,f=l.travellerWidth,h=l.startIndex,p=l.endIndex,g=l.onChange,m=r.pageX-s;m>0?m=Math.min(m,u+d-f-c,u+d-f-o):m<0&&(m=Math.max(m,u-o,u-c));var v=this.getIndex({startX:o+m,endX:c+m});(v.startIndex!==h||v.endIndex!==p)&&g&&g(v),this.setState({startX:o+m,endX:c+m,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,i){var s=e$(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:s.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var i=this.state,s=i.brushMoveStartX,o=i.movingTravellerId,c=i.endX,l=i.startX,u=this.state[o],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,g=d.onChange,m=d.gap,v=d.data,b={startX:this.state.startX,endX:this.state.endX},x=r.pageX-s;x>0?x=Math.min(x,f+h-p-u):x<0&&(x=Math.max(x,f-u)),b[o]=u+x;var w=this.getIndex(b),S=w.startIndex,C=w.endIndex,_=function(){var j=v.length-1;return o==="startX"&&(c>l?S%m===0:C%m===0)||cl?C%m===0:S%m===0)||c>l&&C===j};this.setState(Vi(Vi({},o,u+x),"brushMoveStartX",r.pageX),function(){g&&_()&&g(w)})}},{key:"handleTravellerMoveKeyboard",value:function(r,i){var s=this,o=this.state,c=o.scaleValues,l=o.startX,u=o.endX,d=this.state[i],f=c.indexOf(d);if(f!==-1){var h=f+r;if(!(h===-1||h>=c.length)){var p=c[h];i==="startX"&&p>=u||i==="endX"&&p<=l||this.setState(Vi({},i,p),function(){s.props.onChange(s.getIndex({startX:s.state.startX,endX:s.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,i=r.x,s=r.y,o=r.width,c=r.height,l=r.fill,u=r.stroke;return P.createElement("rect",{stroke:u,fill:l,x:i,y:s,width:o,height:c})}},{key:"renderPanorama",value:function(){var r=this.props,i=r.x,s=r.y,o=r.width,c=r.height,l=r.data,u=r.children,d=r.padding,f=y.Children.only(u);return f?P.cloneElement(f,{x:i,y:s,width:o,height:c,margin:d,compact:!0,data:l}):null}},{key:"renderTravellerLayer",value:function(r,i){var s,o,c=this,l=this.props,u=l.y,d=l.travellerWidth,f=l.height,h=l.traveller,p=l.ariaLabel,g=l.data,m=l.startIndex,v=l.endIndex,b=Math.max(r,this.props.x),x=jC(jC({},rt(this.props,!1)),{},{x:b,y:u,width:d,height:f}),w=p||"Min value: ".concat((s=g[m])===null||s===void 0?void 0:s.name,", Max value: ").concat((o=g[v])===null||o===void 0?void 0:o.name);return P.createElement(qt,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(C){["ArrowLeft","ArrowRight"].includes(C.key)&&(C.preventDefault(),C.stopPropagation(),c.handleTravellerMoveKeyboard(C.key==="ArrowRight"?1:-1,i))},onFocus:function(){c.setState({isTravellerFocused:!0})},onBlur:function(){c.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(h,x))}},{key:"renderSlide",value:function(r,i){var s=this.props,o=s.y,c=s.height,l=s.stroke,u=s.travellerWidth,d=Math.min(r,i)+u,f=Math.max(Math.abs(i-r)-u,0);return P.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:l,fillOpacity:.2,x:d,y:o,width:f,height:c})}},{key:"renderText",value:function(){var r=this.props,i=r.startIndex,s=r.endIndex,o=r.y,c=r.height,l=r.travellerWidth,u=r.stroke,d=this.state,f=d.startX,h=d.endX,p=5,g={pointerEvents:"none",fill:u};return P.createElement(qt,{className:"recharts-brush-texts"},P.createElement(_u,Ib({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:o+c/2},g),this.getTextOfTick(i)),P.createElement(_u,Ib({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+l+p,y:o+c/2},g),this.getTextOfTick(s)))}},{key:"render",value:function(){var r=this.props,i=r.data,s=r.className,o=r.children,c=r.x,l=r.y,u=r.width,d=r.height,f=r.alwaysShowText,h=this.state,p=h.startX,g=h.endX,m=h.isTextActive,v=h.isSlideMoving,b=h.isTravellerMoving,x=h.isTravellerFocused;if(!i||!i.length||!je(c)||!je(l)||!je(u)||!je(d)||u<=0||d<=0)return null;var w=It("recharts-brush",s),S=P.Children.count(o)===1,C=hRe("userSelect","none");return P.createElement(qt,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:C},this.renderBackground(),S&&this.renderPanorama(),this.renderSlide(p,g),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(g,"endX"),(m||v||b||x||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var i=r.x,s=r.y,o=r.width,c=r.height,l=r.stroke,u=Math.floor(s+c/2)-1;return P.createElement(P.Fragment,null,P.createElement("rect",{x:i,y:s,width:o,height:c,fill:l,stroke:"none"}),P.createElement("line",{x1:i+1,y1:u,x2:i+o-1,y2:u,fill:"none",stroke:"#fff"}),P.createElement("line",{x1:i+1,y1:u+2,x2:i+o-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,i){var s;return P.isValidElement(r)?s=P.cloneElement(r,i):At(r)?s=r(i):s=e.renderDefaultTraveller(i),s}},{key:"getDerivedStateFromProps",value:function(r,i){var s=r.data,o=r.width,c=r.x,l=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(s!==i.prevData||u!==i.prevUpdateId)return jC({prevData:s,prevTravellerWidth:l,prevUpdateId:u,prevX:c,prevWidth:o},s&&s.length?wRe({data:s,width:o,x:c,travellerWidth:l,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(i.scale&&(o!==i.prevWidth||c!==i.prevX||l!==i.prevTravellerWidth)){i.scale.range([c,c+o-l]);var h=i.scale.domain().map(function(p){return i.scale(p)});return{prevData:s,prevTravellerWidth:l,prevUpdateId:u,prevX:c,prevWidth:o,startX:i.scale(r.startIndex),endX:i.scale(r.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(r,i){for(var s=r.length,o=0,c=s-1;c-o>1;){var l=Math.floor((o+c)/2);r[l]>i?c=l:o=l}return i>=r[c]?c:o}}])}(y.PureComponent);Vi(bf,"displayName","Brush");Vi(bf,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var SRe=xP;function CRe(t,e){var n;return SRe(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}var _Re=CRe,ARe=dG,jRe=na,ERe=_Re,NRe=Hi,TRe=kw;function PRe(t,e,n){var r=NRe(t)?ARe:ERe;return n&&TRe(t,e,n)&&(e=void 0),r(t,jRe(e))}var kRe=PRe;const ORe=dn(kRe);var Vo=function(e,n){var r=e.alwaysShow,i=e.ifOverflow;return r&&(i="extendDomain"),i===n},t$=IG;function IRe(t,e,n){e=="__proto__"&&t$?t$(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var RRe=IRe,MRe=RRe,DRe=kG,$Re=na;function LRe(t,e){var n={};return e=$Re(e),DRe(t,function(r,i,s){MRe(n,i,e(r,i,s))}),n}var FRe=LRe;const URe=dn(FRe);function BRe(t,e){for(var n=-1,r=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function i2e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function s2e(t,e){var n=t.x,r=t.y,i=r2e(t,ZRe),s="".concat(n),o=parseInt(s,10),c="".concat(r),l=parseInt(c,10),u="".concat(e.height||i.height),d=parseInt(u,10),f="".concat(e.width||i.width),h=parseInt(f,10);return $h($h($h($h($h({},e),i),o?{x:o}:{}),l?{y:l}:{}),{},{height:d,width:h,name:e.name,radius:e.radius})}function r$(t){return P.createElement(SK,K1({shapeType:"rectangle",propTransformer:s2e,activeClassName:"recharts-active-bar"},t))}var o2e=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,i){if(typeof e=="number")return e;var s=typeof r=="number";return s?e(r,i):(s||Eu(),n)}},a2e=["value","background"],OK;function wf(t){"@babel/helpers - typeof";return wf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wf(t)}function c2e(t,e){if(t==null)return{};var n=l2e(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function l2e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Mb(){return Mb=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&Math.abs(U)0&&Math.abs(M)0&&(O=Math.min((F||0)-(M[oe-1]||0),O))}),Number.isFinite(O)){var U=O/E,D=m.layout==="vertical"?r.height:r.width;if(m.padding==="gap"&&(A=U*D/2),m.padding==="no-gap"){var B=yi(e.barCategoryGap,U*D),R=U*D/2;A=R-B-(R-B)/D*B}}}i==="xAxis"?j=[r.left+(w.left||0)+(A||0),r.left+r.width-(w.right||0)-(A||0)]:i==="yAxis"?j=l==="horizontal"?[r.top+r.height-(w.bottom||0),r.top+(w.top||0)]:[r.top+(w.top||0)+(A||0),r.top+r.height-(w.bottom||0)-(A||0)]:j=m.range,C&&(j=[j[1],j[0]]);var L=G8(m,s,h),Y=L.scale,q=L.realScaleType;Y.domain(b).range(j),K8(Y);var J=W8(Y,Vs(Vs({},m),{},{realScaleType:q}));i==="xAxis"?(I=v==="top"&&!S||v==="bottom"&&S,T=r.left,k=f[_]-I*m.height):i==="yAxis"&&(I=v==="left"&&!S||v==="right"&&S,T=f[_]-I*m.width,k=r.top);var me=Vs(Vs(Vs({},m),J),{},{realScaleType:q,x:T,y:k,scale:Y,width:i==="xAxis"?r.width:m.width,height:i==="yAxis"?r.height:m.height});return me.bandSize=yb(me,J),!m.hide&&i==="xAxis"?f[_]+=(I?-1:1)*me.height:m.hide||(f[_]+=(I?-1:1)*me.width),Vs(Vs({},p),{},Ww({},g,me))},{})},$K=function(e,n){var r=e.x,i=e.y,s=n.x,o=n.y;return{x:Math.min(r,s),y:Math.min(i,o),width:Math.abs(s-r),height:Math.abs(o-i)}},b2e=function(e){var n=e.x1,r=e.y1,i=e.x2,s=e.y2;return $K({x:n,y:r},{x:i,y:s})},LK=function(){function t(e){v2e(this,t),this.scale=e}return y2e(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.bandAware,s=r.position;if(n!==void 0){if(s)switch(s){case"start":return this.scale(n);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+o}case"end":{var c=this.bandwidth?this.bandwidth():0;return this.scale(n)+c}default:return this.scale(n)}if(i){var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+l}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),i=r[0],s=r[r.length-1];return i<=s?n>=i&&n<=s:n>=s&&n<=i}}],[{key:"create",value:function(n){return new t(n)}}])}();Ww(LK,"EPS",1e-4);var qP=function(e){var n=Object.keys(e).reduce(function(r,i){return Vs(Vs({},r),{},Ww({},i,LK.create(e[i])))},{});return Vs(Vs({},n),{},{apply:function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=s.bandAware,c=s.position;return URe(i,function(l,u){return n[u].apply(l,{bandAware:o,position:c})})},isInRange:function(i){return kK(i,function(s,o){return n[o].isInRange(s)})}})};function w2e(t){return(t%180+180)%180}var S2e=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=w2e(i),o=s*Math.PI/180,c=Math.atan(r/n),l=o>c&&o-1?i[s?e[o]:o]:void 0}}var E2e=j2e,N2e=EK;function T2e(t){var e=N2e(t),n=e%1;return e===e?n?e-n:e:0}var P2e=T2e,k2e=AG,O2e=na,I2e=P2e,R2e=Math.max;function M2e(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:I2e(n);return i<0&&(i=R2e(r+i,0)),k2e(t,O2e(e),i)}var D2e=M2e,$2e=E2e,L2e=D2e,F2e=$2e(L2e),U2e=F2e;const B2e=dn(U2e);var H2e=jpe(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),YP=y.createContext(void 0),QP=y.createContext(void 0),FK=y.createContext(void 0),UK=y.createContext({}),BK=y.createContext(void 0),HK=y.createContext(0),zK=y.createContext(0),c$=function(e){var n=e.state,r=n.xAxisMap,i=n.yAxisMap,s=n.offset,o=e.clipPathId,c=e.children,l=e.width,u=e.height,d=H2e(s);return P.createElement(YP.Provider,{value:r},P.createElement(QP.Provider,{value:i},P.createElement(UK.Provider,{value:s},P.createElement(FK.Provider,{value:d},P.createElement(BK.Provider,{value:o},P.createElement(HK.Provider,{value:u},P.createElement(zK.Provider,{value:l},c)))))))},z2e=function(){return y.useContext(BK)},VK=function(e){var n=y.useContext(YP);n==null&&Eu();var r=n[e];return r==null&&Eu(),r},V2e=function(){var e=y.useContext(YP);return hc(e)},G2e=function(){var e=y.useContext(QP),n=B2e(e,function(r){return kK(r.domain,Number.isFinite)});return n||hc(e)},GK=function(e){var n=y.useContext(QP);n==null&&Eu();var r=n[e];return r==null&&Eu(),r},K2e=function(){var e=y.useContext(FK);return e},W2e=function(){return y.useContext(UK)},XP=function(){return y.useContext(zK)},JP=function(){return y.useContext(HK)};function Sf(t){"@babel/helpers - typeof";return Sf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sf(t)}function q2e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Y2e(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);nt*i)return!1;var s=n();return t*(e-t*s/2-r)>=0&&t*(e+t*s/2-i)<=0}function PMe(t,e){return JK(t,e+1)}function kMe(t,e,n,r,i){for(var s=(r||[]).slice(),o=e.start,c=e.end,l=0,u=1,d=o,f=function(){var g=r==null?void 0:r[l];if(g===void 0)return{v:JK(r,u)};var m=l,v,b=function(){return v===void 0&&(v=n(g,m)),v},x=g.coordinate,w=l===0||Ub(t,x,b,d,c);w||(l=0,d=o,u+=1),w&&(d=x+t*(b()/2+i),l+=u)},h;u<=s.length;)if(h=f(),h)return h.v;return[]}function rg(t){"@babel/helpers - typeof";return rg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rg(t)}function g$(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ei(t){for(var e=1;e0?p.coordinate-v*t:p.coordinate})}else s[h]=p=ei(ei({},p),{},{tickCoord:p.coordinate});var b=Ub(t,p.tickCoord,m,c,l);b&&(l=p.tickCoord-t*(m()/2+i),s[h]=ei(ei({},p),{},{isShow:!0}))},d=o-1;d>=0;d--)u(d);return s}function DMe(t,e,n,r,i,s){var o=(r||[]).slice(),c=o.length,l=e.start,u=e.end;if(s){var d=r[c-1],f=n(d,c-1),h=t*(d.coordinate+t*f/2-u);o[c-1]=d=ei(ei({},d),{},{tickCoord:h>0?d.coordinate-h*t:d.coordinate});var p=Ub(t,d.tickCoord,function(){return f},l,u);p&&(u=d.tickCoord-t*(f/2+i),o[c-1]=ei(ei({},d),{},{isShow:!0}))}for(var g=s?c-1:c,m=function(x){var w=o[x],S,C=function(){return S===void 0&&(S=n(w,x)),S};if(x===0){var _=t*(w.coordinate-t*C()/2-l);o[x]=w=ei(ei({},w),{},{tickCoord:_<0?w.coordinate-_*t:w.coordinate})}else o[x]=w=ei(ei({},w),{},{tickCoord:w.coordinate});var A=Ub(t,w.tickCoord,C,l,u);A&&(l=w.tickCoord+t*(C()/2+i),o[x]=ei(ei({},w),{},{isShow:!0}))},v=0;v=2?vi(i[1].coordinate-i[0].coordinate):1,b=TMe(s,v,p);return l==="equidistantPreserveStart"?kMe(v,b,m,i,o):(l==="preserveStart"||l==="preserveStartEnd"?h=DMe(v,b,m,i,o,l==="preserveStartEnd"):h=MMe(v,b,m,i,o),h.filter(function(x){return x.isShow}))}var $Me=["viewBox"],LMe=["viewBox"],FMe=["ticks"];function Af(t){"@babel/helpers - typeof";return Af=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Af(t)}function pd(){return pd=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function UMe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function BMe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function y$(t,e){for(var n=0;n0?l(this.props):l(p)),o<=0||c<=0||!g||!g.length?null:P.createElement(qt,{className:It("recharts-cartesian-axis",u),ref:function(v){r.layerReference=v}},s&&this.renderAxisLine(),this.renderTicks(g,this.state.fontSize,this.state.letterSpacing),Dr.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,i,s){var o;return P.isValidElement(r)?o=P.cloneElement(r,i):At(r)?o=r(i):o=P.createElement(_u,pd({},i,{className:"recharts-cartesian-axis-tick-value"}),s),o}}])}(y.Component);nk(fh,"displayName","CartesianAxis");nk(fh,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var qMe=["x1","y1","x2","y2","key"],YMe=["offset"];function Nu(t){"@babel/helpers - typeof";return Nu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nu(t)}function x$(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ii(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function ZMe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var eDe=function(e){var n=e.fill;if(!n||n==="none")return null;var r=e.fillOpacity,i=e.x,s=e.y,o=e.width,c=e.height,l=e.ry;return P.createElement("rect",{x:i,y:s,ry:l,width:o,height:c,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function tW(t,e){var n;if(P.isValidElement(t))n=P.cloneElement(t,e);else if(At(t))n=t(e);else{var r=e.x1,i=e.y1,s=e.x2,o=e.y2,c=e.key,l=b$(e,qMe),u=rt(l,!1);u.offset;var d=b$(u,YMe);n=P.createElement("line",zl({},d,{x1:r,y1:i,x2:s,y2:o,fill:"none",key:c}))}return n}function tDe(t){var e=t.x,n=t.width,r=t.horizontal,i=r===void 0?!0:r,s=t.horizontalPoints;if(!i||!s||!s.length)return null;var o=s.map(function(c,l){var u=ii(ii({},t),{},{x1:e,y1:c,x2:e+n,y2:c,key:"line-".concat(l),index:l});return tW(i,u)});return P.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function nDe(t){var e=t.y,n=t.height,r=t.vertical,i=r===void 0?!0:r,s=t.verticalPoints;if(!i||!s||!s.length)return null;var o=s.map(function(c,l){var u=ii(ii({},t),{},{x1:c,y1:e,x2:c,y2:e+n,key:"line-".concat(l),index:l});return tW(i,u)});return P.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function rDe(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,s=t.width,o=t.height,c=t.horizontalPoints,l=t.horizontal,u=l===void 0?!0:l;if(!u||!e||!e.length)return null;var d=c.map(function(h){return Math.round(h+i-i)}).sort(function(h,p){return h-p});i!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?i+o-h:d[p+1]-h;if(m<=0)return null;var v=p%e.length;return P.createElement("rect",{key:"react-".concat(p),y:h,x:r,height:m,width:s,stroke:"none",fill:e[v],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return P.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function iDe(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,s=t.x,o=t.y,c=t.width,l=t.height,u=t.verticalPoints;if(!n||!r||!r.length)return null;var d=u.map(function(h){return Math.round(h+s-s)}).sort(function(h,p){return h-p});s!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?s+c-h:d[p+1]-h;if(m<=0)return null;var v=p%r.length;return P.createElement("rect",{key:"react-".concat(p),x:h,y:o,width:m,height:l,stroke:"none",fill:r[v],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return P.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var sDe=function(e,n){var r=e.xAxis,i=e.width,s=e.height,o=e.offset;return V8(tk(ii(ii(ii({},fh.defaultProps),r),{},{ticks:_a(r,!0),viewBox:{x:0,y:0,width:i,height:s}})),o.left,o.left+o.width,n)},oDe=function(e,n){var r=e.yAxis,i=e.width,s=e.height,o=e.offset;return V8(tk(ii(ii(ii({},fh.defaultProps),r),{},{ticks:_a(r,!0),viewBox:{x:0,y:0,width:i,height:s}})),o.top,o.top+o.height,n)},Wu={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function ig(t){var e,n,r,i,s,o,c=XP(),l=JP(),u=W2e(),d=ii(ii({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:Wu.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:Wu.fill,horizontal:(r=t.horizontal)!==null&&r!==void 0?r:Wu.horizontal,horizontalFill:(i=t.horizontalFill)!==null&&i!==void 0?i:Wu.horizontalFill,vertical:(s=t.vertical)!==null&&s!==void 0?s:Wu.vertical,verticalFill:(o=t.verticalFill)!==null&&o!==void 0?o:Wu.verticalFill,x:je(t.x)?t.x:u.left,y:je(t.y)?t.y:u.top,width:je(t.width)?t.width:u.width,height:je(t.height)?t.height:u.height}),f=d.x,h=d.y,p=d.width,g=d.height,m=d.syncWithTicks,v=d.horizontalValues,b=d.verticalValues,x=V2e(),w=G2e();if(!je(p)||p<=0||!je(g)||g<=0||!je(f)||f!==+f||!je(h)||h!==+h)return null;var S=d.verticalCoordinatesGenerator||sDe,C=d.horizontalCoordinatesGenerator||oDe,_=d.horizontalPoints,A=d.verticalPoints;if((!_||!_.length)&&At(C)){var j=v&&v.length,T=C({yAxis:w?ii(ii({},w),{},{ticks:j?v:w.ticks}):void 0,width:c,height:l,offset:u},j?!0:m);ro(Array.isArray(T),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Nu(T),"]")),Array.isArray(T)&&(_=T)}if((!A||!A.length)&&At(S)){var k=b&&b.length,I=S({xAxis:x?ii(ii({},x),{},{ticks:k?b:x.ticks}):void 0,width:c,height:l,offset:u},k?!0:m);ro(Array.isArray(I),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Nu(I),"]")),Array.isArray(I)&&(A=I)}return P.createElement("g",{className:"recharts-cartesian-grid"},P.createElement(eDe,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),P.createElement(tDe,zl({},d,{offset:u,horizontalPoints:_,xAxis:x,yAxis:w})),P.createElement(nDe,zl({},d,{offset:u,verticalPoints:A,xAxis:x,yAxis:w})),P.createElement(rDe,zl({},d,{horizontalPoints:_})),P.createElement(iDe,zl({},d,{verticalPoints:A})))}ig.displayName="CartesianGrid";var aDe=["layout","type","stroke","connectNulls","isRange","ref"],cDe=["key"],nW;function jf(t){"@babel/helpers - typeof";return jf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jf(t)}function rW(t,e){if(t==null)return{};var n=lDe(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function lDe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Vl(){return Vl=Object.assign?Object.assign.bind():function(t){for(var e=1;e0||!Au(d,o)||!Au(f,c))?this.renderAreaWithAnimation(r,i):this.renderAreaStatically(o,c,r,i)}},{key:"render",value:function(){var r,i=this.props,s=i.hide,o=i.dot,c=i.points,l=i.className,u=i.top,d=i.left,f=i.xAxis,h=i.yAxis,p=i.width,g=i.height,m=i.isAnimationActive,v=i.id;if(s||!c||!c.length)return null;var b=this.state.isAnimationFinished,x=c.length===1,w=It("recharts-area",l),S=f&&f.allowDataOverflow,C=h&&h.allowDataOverflow,_=S||C,A=Dt(v)?this.id:v,j=(r=rt(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},T=j.r,k=T===void 0?3:T,I=j.strokeWidth,E=I===void 0?2:I,O=kme(o)?o:{},M=O.clipDot,U=M===void 0?!0:M,D=k*2+E;return P.createElement(qt,{className:w},S||C?P.createElement("defs",null,P.createElement("clipPath",{id:"clipPath-".concat(A)},P.createElement("rect",{x:S?d:d-p/2,y:C?u:u-g/2,width:S?p:p*2,height:C?g:g*2})),!U&&P.createElement("clipPath",{id:"clipPath-dots-".concat(A)},P.createElement("rect",{x:d-D/2,y:u-D/2,width:p+D,height:g+D}))):null,x?null:this.renderArea(_,A),(o||x)&&this.renderDots(_,U,A),(!m||b)&&zo.renderCallByParent(this.props,c))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:i.curPoints,prevBaseLine:i.curBaseLine}:r.points!==i.curPoints||r.baseLine!==i.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(y.PureComponent);nW=so;$o(so,"displayName","Area");$o(so,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!io.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});$o(so,"getBaseValue",function(t,e,n,r){var i=t.layout,s=t.baseValue,o=e.props.baseValue,c=o??s;if(je(c)&&typeof c=="number")return c;var l=i==="horizontal"?r:n,u=l.scale.domain();if(l.type==="number"){var d=Math.max(u[0],u[1]),f=Math.min(u[0],u[1]);return c==="dataMin"?f:c==="dataMax"||d<0?d:Math.max(Math.min(u[0],u[1]),0)}return c==="dataMin"?u[0]:c==="dataMax"?u[1]:u[0]});$o(so,"getComposedData",function(t){var e=t.props,n=t.item,r=t.xAxis,i=t.yAxis,s=t.xAxisTicks,o=t.yAxisTicks,c=t.bandSize,l=t.dataKey,u=t.stackedData,d=t.dataStartIndex,f=t.displayedData,h=t.offset,p=e.layout,g=u&&u.length,m=nW.getBaseValue(e,n,r,i),v=p==="horizontal",b=!1,x=f.map(function(S,C){var _;g?_=u[d+C]:(_=or(S,l),Array.isArray(_)?b=!0:_=[m,_]);var A=_[1]==null||g&&or(S,l)==null;return v?{x:VM({axis:r,ticks:s,bandSize:c,entry:S,index:C}),y:A?null:i.scale(_[1]),value:_,payload:S}:{x:A?null:r.scale(_[1]),y:VM({axis:i,ticks:o,bandSize:c,entry:S,index:C}),value:_,payload:S}}),w;return g||b?w=x.map(function(S){var C=Array.isArray(S.value)?S.value[0]:null;return v?{x:S.x,y:C!=null&&S.y!=null?i.scale(C):null}:{x:C!=null?r.scale(C):null,y:S.y}}):w=v?i.scale(m):r.scale(m),rc({points:x,baseLine:w,layout:p,isRange:b},h)});$o(so,"renderDotItem",function(t,e){var n;if(P.isValidElement(t))n=P.cloneElement(t,e);else if(At(t))n=t(e);else{var r=It("recharts-area-dot",typeof t!="boolean"?t.className:""),i=e.key,s=rW(e,cDe);n=P.createElement(Fg,Vl({},s,{key:i,className:r}))}return n});function Ef(t){"@babel/helpers - typeof";return Ef=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ef(t)}function vDe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yDe(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function i$e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function s$e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o$e(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n0?o:e&&e.length&&je(i)&&je(s)?e.slice(i,s+1):[]};function xW(t){return t==="number"?[0,"auto"]:void 0}var uj=function(e,n,r,i){var s=e.graphicalItems,o=e.tooltipAxis,c=Jw(n,e);return r<0||!s||!s.length||r>=c.length?null:s.reduce(function(l,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:n;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=r&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var p=f===void 0?c:f;h=Vx(p,o.dataKey,i)}else h=f&&f[r]||c[r];return h?[].concat(Pf(l),[Y8(u,h)]):l},[])},N$=function(e,n,r,i){var s=i||{x:e.chartX,y:e.chartY},o=y$e(s,r),c=e.orderedTooltipTicks,l=e.tooltipAxis,u=e.tooltipTicks,d=ONe(o,c,u,l);if(d>=0&&u){var f=u[d]&&u[d].value,h=uj(e,n,d,f),p=x$e(r,c,d,s);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},b$e=function(e,n){var r=n.axes,i=n.graphicalItems,s=n.axisType,o=n.axisIdKey,c=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,h=e.stackOffset,p=z8(d,s);return r.reduce(function(g,m){var v,b=m.type.defaultProps!==void 0?ce(ce({},m.type.defaultProps),m.props):m.props,x=b.type,w=b.dataKey,S=b.allowDataOverflow,C=b.allowDuplicatedCategory,_=b.scale,A=b.ticks,j=b.includeHidden,T=b[o];if(g[T])return g;var k=Jw(e.data,{graphicalItems:i.filter(function(J){var me,F=o in J.props?J.props[o]:(me=J.type.defaultProps)===null||me===void 0?void 0:me[o];return F===T}),dataStartIndex:l,dataEndIndex:u}),I=k.length,E,O,M;KDe(b.domain,S,x)&&(E=_1(b.domain,null,S),p&&(x==="number"||_!=="auto")&&(M=xp(k,w,"category")));var U=xW(x);if(!E||E.length===0){var D,B=(D=b.domain)!==null&&D!==void 0?D:U;if(w){if(E=xp(k,w,x),x==="category"&&p){var R=Sme(E);C&&R?(O=E,E=Ob(0,I)):C||(E=qM(B,E,m).reduce(function(J,me){return J.indexOf(me)>=0?J:[].concat(Pf(J),[me])},[]))}else if(x==="category")C?E=E.filter(function(J){return J!==""&&!Dt(J)}):E=qM(B,E,m).reduce(function(J,me){return J.indexOf(me)>=0||me===""||Dt(me)?J:[].concat(Pf(J),[me])},[]);else if(x==="number"){var L=$Ne(k,i.filter(function(J){var me,F,oe=o in J.props?J.props[o]:(me=J.type.defaultProps)===null||me===void 0?void 0:me[o],se="hide"in J.props?J.props.hide:(F=J.type.defaultProps)===null||F===void 0?void 0:F.hide;return oe===T&&(j||!se)}),w,s,d);L&&(E=L)}p&&(x==="number"||_!=="auto")&&(M=xp(k,w,"category"))}else p?E=Ob(0,I):c&&c[T]&&c[T].hasStack&&x==="number"?E=h==="expand"?[0,1]:q8(c[T].stackGroups,l,u):E=H8(k,i.filter(function(J){var me=o in J.props?J.props[o]:J.type.defaultProps[o],F="hide"in J.props?J.props.hide:J.type.defaultProps.hide;return me===T&&(j||!F)}),x,d,!0);if(x==="number")E=aj(f,E,T,s,A),B&&(E=_1(B,E,S));else if(x==="category"&&B){var Y=B,q=E.every(function(J){return Y.indexOf(J)>=0});q&&(E=Y)}}return ce(ce({},g),{},Nt({},T,ce(ce({},b),{},{axisType:s,domain:E,categoricalDomain:M,duplicateDomain:O,originalDomain:(v=b.domain)!==null&&v!==void 0?v:U,isCategorical:p,layout:d})))},{})},w$e=function(e,n){var r=n.graphicalItems,i=n.Axis,s=n.axisType,o=n.axisIdKey,c=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,h=Jw(e.data,{graphicalItems:r,dataStartIndex:l,dataEndIndex:u}),p=h.length,g=z8(d,s),m=-1;return r.reduce(function(v,b){var x=b.type.defaultProps!==void 0?ce(ce({},b.type.defaultProps),b.props):b.props,w=x[o],S=xW("number");if(!v[w]){m++;var C;return g?C=Ob(0,p):c&&c[w]&&c[w].hasStack?(C=q8(c[w].stackGroups,l,u),C=aj(f,C,w,s)):(C=_1(S,H8(h,r.filter(function(_){var A,j,T=o in _.props?_.props[o]:(A=_.type.defaultProps)===null||A===void 0?void 0:A[o],k="hide"in _.props?_.props.hide:(j=_.type.defaultProps)===null||j===void 0?void 0:j.hide;return T===w&&!k}),"number",d),i.defaultProps.allowDataOverflow),C=aj(f,C,w,s)),ce(ce({},v),{},Nt({},w,ce(ce({axisType:s},i.defaultProps),{},{hide:!0,orientation:rs(g$e,"".concat(s,".").concat(m%2),null),domain:C,originalDomain:S,isCategorical:g,layout:d})))}return v},{})},S$e=function(e,n){var r=n.axisType,i=r===void 0?"xAxis":r,s=n.AxisComp,o=n.graphicalItems,c=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,d=e.children,f="".concat(i,"Id"),h=js(d,s),p={};return h&&h.length?p=b$e(e,{axes:h,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:l,dataEndIndex:u}):o&&o.length&&(p=w$e(e,{Axis:s,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:l,dataEndIndex:u})),p},C$e=function(e){var n=hc(e),r=_a(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:bP(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:yb(n,r)}},T$=function(e){var n=e.children,r=e.defaultShowTooltip,i=qi(n,bf),s=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(s=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:s,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},_$e=function(e){return!e||!e.length?!1:e.some(function(n){var r=Ea(n&&n.type);return r&&r.indexOf("Bar")>=0})},P$=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},A$e=function(e,n){var r=e.props,i=e.graphicalItems,s=e.xAxisMap,o=s===void 0?{}:s,c=e.yAxisMap,l=c===void 0?{}:c,u=r.width,d=r.height,f=r.children,h=r.margin||{},p=qi(f,bf),g=qi(f,Na),m=Object.keys(l).reduce(function(C,_){var A=l[_],j=A.orientation;return!A.mirror&&!A.hide?ce(ce({},C),{},Nt({},j,C[j]+A.width)):C},{left:h.left||0,right:h.right||0}),v=Object.keys(o).reduce(function(C,_){var A=o[_],j=A.orientation;return!A.mirror&&!A.hide?ce(ce({},C),{},Nt({},j,rs(C,"".concat(j))+A.height)):C},{top:h.top||0,bottom:h.bottom||0}),b=ce(ce({},v),m),x=b.bottom;p&&(b.bottom+=p.props.height||bf.defaultProps.height),g&&n&&(b=MNe(b,i,r,n));var w=u-b.left-b.right,S=d-b.top-b.bottom;return ce(ce({brushBottom:x},b),{},{width:Math.max(w,0),height:Math.max(S,0)})},j$e=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},Zw=function(e){var n=e.chartName,r=e.GraphicalChild,i=e.defaultTooltipEventType,s=i===void 0?"axis":i,o=e.validateTooltipEventTypes,c=o===void 0?["axis"]:o,l=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,f=e.defaultProps,h=function(v,b){var x=b.graphicalItems,w=b.stackGroups,S=b.offset,C=b.updateId,_=b.dataStartIndex,A=b.dataEndIndex,j=v.barSize,T=v.layout,k=v.barGap,I=v.barCategoryGap,E=v.maxBarSize,O=P$(T),M=O.numericAxisName,U=O.cateAxisName,D=_$e(x),B=[];return x.forEach(function(R,L){var Y=Jw(v.data,{graphicalItems:[R],dataStartIndex:_,dataEndIndex:A}),q=R.type.defaultProps!==void 0?ce(ce({},R.type.defaultProps),R.props):R.props,J=q.dataKey,me=q.maxBarSize,F=q["".concat(M,"Id")],oe=q["".concat(U,"Id")],se={},le=l.reduce(function(z,G){var Q=b["".concat(G.axisType,"Map")],H=q["".concat(G.axisType,"Id")];Q&&Q[H]||G.axisType==="zAxis"||Eu();var Z=Q[H];return ce(ce({},z),{},Nt(Nt({},G.axisType,Z),"".concat(G.axisType,"Ticks"),_a(Z)))},se),ke=le[U],ue=le["".concat(U,"Ticks")],we=w&&w[F]&&w[F].hasStack&&KNe(R,w[F].stackGroups),Ae=Ea(R.type).indexOf("Bar")>=0,ee=yb(ke,ue),wt=[],et=D&&INe({barSize:j,stackGroups:w,totalSize:j$e(le,U)});if(Ae){var Ct,Xe,nn=Dt(me)?E:me,N=(Ct=(Xe=yb(ke,ue,!0))!==null&&Xe!==void 0?Xe:nn)!==null&&Ct!==void 0?Ct:0;wt=RNe({barGap:k,barCategoryGap:I,bandSize:N!==ee?N:ee,sizeList:et[oe],maxBarSize:nn}),N!==ee&&(wt=wt.map(function(z){return ce(ce({},z),{},{position:ce(ce({},z.position),{},{offset:z.position.offset-N/2})})}))}var $=R&&R.type&&R.type.getComposedData;$&&B.push({props:ce(ce({},$(ce(ce({},le),{},{displayedData:Y,props:v,dataKey:J,item:R,bandSize:ee,barPosition:wt,offset:S,stackedData:we,layout:T,dataStartIndex:_,dataEndIndex:A}))),{},Nt(Nt(Nt({key:R.key||"item-".concat(L)},M,le[M]),U,le[U]),"animationId",C)),childIndex:Rme(R,v.children),item:R})}),B},p=function(v,b){var x=v.props,w=v.dataStartIndex,S=v.dataEndIndex,C=v.updateId;if(!BR({props:x}))return null;var _=x.children,A=x.layout,j=x.stackOffset,T=x.data,k=x.reverseStackOrder,I=P$(A),E=I.numericAxisName,O=I.cateAxisName,M=js(_,r),U=VNe(T,M,"".concat(E,"Id"),"".concat(O,"Id"),j,k),D=l.reduce(function(q,J){var me="".concat(J.axisType,"Map");return ce(ce({},q),{},Nt({},me,S$e(x,ce(ce({},J),{},{graphicalItems:M,stackGroups:J.axisType===E&&U,dataStartIndex:w,dataEndIndex:S}))))},{}),B=A$e(ce(ce({},D),{},{props:x,graphicalItems:M}),b==null?void 0:b.legendBBox);Object.keys(D).forEach(function(q){D[q]=d(x,D[q],B,q.replace("Map",""),n)});var R=D["".concat(O,"Map")],L=C$e(R),Y=h(x,ce(ce({},D),{},{dataStartIndex:w,dataEndIndex:S,updateId:C,graphicalItems:M,stackGroups:U,offset:B}));return ce(ce({formattedGraphicalItems:Y,graphicalItems:M,offset:B,stackGroups:U},L),D)},g=function(m){function v(b){var x,w,S;return s$e(this,v),S=c$e(this,v,[b]),Nt(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Nt(S,"accessibilityManager",new GDe),Nt(S,"handleLegendBBoxUpdate",function(C){if(C){var _=S.state,A=_.dataStartIndex,j=_.dataEndIndex,T=_.updateId;S.setState(ce({legendBBox:C},p({props:S.props,dataStartIndex:A,dataEndIndex:j,updateId:T},ce(ce({},S.state),{},{legendBBox:C}))))}}),Nt(S,"handleReceiveSyncEvent",function(C,_,A){if(S.props.syncId===C){if(A===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(_)}}),Nt(S,"handleBrushChange",function(C){var _=C.startIndex,A=C.endIndex;if(_!==S.state.dataStartIndex||A!==S.state.dataEndIndex){var j=S.state.updateId;S.setState(function(){return ce({dataStartIndex:_,dataEndIndex:A},p({props:S.props,dataStartIndex:_,dataEndIndex:A,updateId:j},S.state))}),S.triggerSyncEvent({dataStartIndex:_,dataEndIndex:A})}}),Nt(S,"handleMouseEnter",function(C){var _=S.getMouseInfo(C);if(_){var A=ce(ce({},_),{},{isTooltipActive:!0});S.setState(A),S.triggerSyncEvent(A);var j=S.props.onMouseEnter;At(j)&&j(A,C)}}),Nt(S,"triggeredAfterMouseMove",function(C){var _=S.getMouseInfo(C),A=_?ce(ce({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(A),S.triggerSyncEvent(A);var j=S.props.onMouseMove;At(j)&&j(A,C)}),Nt(S,"handleItemMouseEnter",function(C){S.setState(function(){return{isTooltipActive:!0,activeItem:C,activePayload:C.tooltipPayload,activeCoordinate:C.tooltipPosition||{x:C.cx,y:C.cy}}})}),Nt(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),Nt(S,"handleMouseMove",function(C){C.persist(),S.throttleTriggeredAfterMouseMove(C)}),Nt(S,"handleMouseLeave",function(C){S.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};S.setState(_),S.triggerSyncEvent(_);var A=S.props.onMouseLeave;At(A)&&A(_,C)}),Nt(S,"handleOuterEvent",function(C){var _=Ime(C),A=rs(S.props,"".concat(_));if(_&&At(A)){var j,T;/.*touch.*/i.test(_)?T=S.getMouseInfo(C.changedTouches[0]):T=S.getMouseInfo(C),A((j=T)!==null&&j!==void 0?j:{},C)}}),Nt(S,"handleClick",function(C){var _=S.getMouseInfo(C);if(_){var A=ce(ce({},_),{},{isTooltipActive:!0});S.setState(A),S.triggerSyncEvent(A);var j=S.props.onClick;At(j)&&j(A,C)}}),Nt(S,"handleMouseDown",function(C){var _=S.props.onMouseDown;if(At(_)){var A=S.getMouseInfo(C);_(A,C)}}),Nt(S,"handleMouseUp",function(C){var _=S.props.onMouseUp;if(At(_)){var A=S.getMouseInfo(C);_(A,C)}}),Nt(S,"handleTouchMove",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(C.changedTouches[0])}),Nt(S,"handleTouchStart",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseDown(C.changedTouches[0])}),Nt(S,"handleTouchEnd",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseUp(C.changedTouches[0])}),Nt(S,"triggerSyncEvent",function(C){S.props.syncId!==void 0&&NC.emit(TC,S.props.syncId,C,S.eventEmitterSymbol)}),Nt(S,"applySyncEvent",function(C){var _=S.props,A=_.layout,j=_.syncMethod,T=S.state.updateId,k=C.dataStartIndex,I=C.dataEndIndex;if(C.dataStartIndex!==void 0||C.dataEndIndex!==void 0)S.setState(ce({dataStartIndex:k,dataEndIndex:I},p({props:S.props,dataStartIndex:k,dataEndIndex:I,updateId:T},S.state)));else if(C.activeTooltipIndex!==void 0){var E=C.chartX,O=C.chartY,M=C.activeTooltipIndex,U=S.state,D=U.offset,B=U.tooltipTicks;if(!D)return;if(typeof j=="function")M=j(B,C);else if(j==="value"){M=-1;for(var R=0;R=0){var we,Ae;if(E.dataKey&&!E.allowDuplicatedCategory){var ee=typeof E.dataKey=="function"?ue:"payload.".concat(E.dataKey.toString());we=Vx(R,ee,M),Ae=L&&Y&&Vx(Y,ee,M)}else we=R==null?void 0:R[O],Ae=L&&Y&&Y[O];if(oe||F){var wt=C.props.activeIndex!==void 0?C.props.activeIndex:O;return[y.cloneElement(C,ce(ce(ce({},j.props),le),{},{activeIndex:wt})),null,null]}if(!Dt(we))return[ke].concat(Pf(S.renderActivePoints({item:j,activePoint:we,basePoint:Ae,childIndex:O,isRange:L})))}else{var et,Ct=(et=S.getItemByXY(S.state.activeCoordinate))!==null&&et!==void 0?et:{graphicalItem:ke},Xe=Ct.graphicalItem,nn=Xe.item,N=nn===void 0?C:nn,$=Xe.childIndex,z=ce(ce(ce({},j.props),le),{},{activeIndex:$});return[y.cloneElement(N,z),null,null]}return L?[ke,null,null]:[ke,null]}),Nt(S,"renderCustomized",function(C,_,A){return y.cloneElement(C,ce(ce({key:"recharts-customized-".concat(A)},S.props),S.state))}),Nt(S,"renderMap",{CartesianGrid:{handler:Mv,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:Mv},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:Mv},YAxis:{handler:Mv},Brush:{handler:S.renderBrush,once:!0},Bar:{handler:S.renderGraphicChild},Line:{handler:S.renderGraphicChild},Area:{handler:S.renderGraphicChild},Radar:{handler:S.renderGraphicChild},RadialBar:{handler:S.renderGraphicChild},Scatter:{handler:S.renderGraphicChild},Pie:{handler:S.renderGraphicChild},Funnel:{handler:S.renderGraphicChild},Tooltip:{handler:S.renderCursor,once:!0},PolarGrid:{handler:S.renderPolarGrid,once:!0},PolarAngleAxis:{handler:S.renderPolarAxis},PolarRadiusAxis:{handler:S.renderPolarAxis},Customized:{handler:S.renderCustomized}}),S.clipPathId="".concat((x=b.id)!==null&&x!==void 0?x:nh("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=FG(S.triggeredAfterMouseMove,(w=b.throttleDelay)!==null&&w!==void 0?w:1e3/60),S.state={},S}return d$e(v,m),a$e(v,[{key:"componentDidMount",value:function(){var x,w;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(x=this.props.margin.left)!==null&&x!==void 0?x:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var x=this.props,w=x.children,S=x.data,C=x.height,_=x.layout,A=qi(w,ni);if(A){var j=A.props.defaultIndex;if(!(typeof j!="number"||j<0||j>this.state.tooltipTicks.length-1)){var T=this.state.tooltipTicks[j]&&this.state.tooltipTicks[j].value,k=uj(this.state,S,j,T),I=this.state.tooltipTicks[j].coordinate,E=(this.state.offset.top+C)/2,O=_==="horizontal",M=O?{x:I,y:E}:{y:I,x:E},U=this.state.formattedGraphicalItems.find(function(B){var R=B.item;return R.type.name==="Scatter"});U&&(M=ce(ce({},M),U.props.points[j].tooltipPosition),k=U.props.points[j].tooltipPayload);var D={activeTooltipIndex:j,isTooltipActive:!0,activeLabel:T,activePayload:k,activeCoordinate:M};this.setState(D),this.renderCursor(A),this.accessibilityManager.setIndex(j)}}}},{key:"getSnapshotBeforeUpdate",value:function(x,w){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==w.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==x.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==x.margin){var S,C;this.accessibilityManager.setDetails({offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0}})}return null}},{key:"componentDidUpdate",value:function(x){FA([qi(x.children,ni)],[qi(this.props.children,ni)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var x=qi(this.props.children,ni);if(x&&typeof x.props.shared=="boolean"){var w=x.props.shared?"axis":"item";return c.indexOf(w)>=0?w:s}return s}},{key:"getMouseInfo",value:function(x){if(!this.container)return null;var w=this.container,S=w.getBoundingClientRect(),C=oAe(S),_={chartX:Math.round(x.pageX-C.left),chartY:Math.round(x.pageY-C.top)},A=S.width/w.offsetWidth||1,j=this.inRange(_.chartX,_.chartY,A);if(!j)return null;var T=this.state,k=T.xAxisMap,I=T.yAxisMap,E=this.getTooltipEventType();if(E!=="axis"&&k&&I){var O=hc(k).scale,M=hc(I).scale,U=O&&O.invert?O.invert(_.chartX):null,D=M&&M.invert?M.invert(_.chartY):null;return ce(ce({},_),{},{xValue:U,yValue:D})}var B=N$(this.state,this.props.data,this.props.layout,j);return B?ce(ce({},_),B):null}},{key:"inRange",value:function(x,w){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,C=this.props.layout,_=x/S,A=w/S;if(C==="horizontal"||C==="vertical"){var j=this.state.offset,T=_>=j.left&&_<=j.left+j.width&&A>=j.top&&A<=j.top+j.height;return T?{x:_,y:A}:null}var k=this.state,I=k.angleAxisMap,E=k.radiusAxisMap;if(I&&E){var O=hc(I);return XM({x:_,y:A},O)}return null}},{key:"parseEventsOfWrapper",value:function(){var x=this.props.children,w=this.getTooltipEventType(),S=qi(x,ni),C={};S&&w==="axis"&&(S.props.trigger==="click"?C={onClick:this.handleClick}:C={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var _=Gx(this.props,this.handleOuterEvent);return ce(ce({},_),C)}},{key:"addListener",value:function(){NC.on(TC,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){NC.removeListener(TC,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(x,w,S){for(var C=this.state.formattedGraphicalItems,_=0,A=C.length;_{var g;const[r,i]=y.useState([{name:"Very Positive",value:0,color:"#4ade80"},{name:"Positive",value:0,color:"#a3e635"},{name:"Neutral",value:0,color:"#93c5fd"},{name:"Negative",value:0,color:"#fb923c"},{name:"Very Negative",value:0,color:"#f87171"}]),[s,o]=y.useState([]),[c,l]=y.useState({}),[u,d]=y.useState({isBalanced:!1,score:0,reason:""}),f=m=>{const v=n.find(b=>b.id===m);return v?v.name:`Participant ${m}`};y.useEffect(()=>{if(t.length===0)return;const m={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0},v={},b={};t.forEach(S=>{if(S.senderId!=="moderator"&&S.senderId!=="facilitator"){const C=S.text.toLowerCase();let _="Neutral";C.includes("love")||C.includes("excellent")||C.includes("amazing")?_="Very Positive":C.includes("good")||C.includes("like")||C.includes("great")?_="Positive":C.includes("bad")||C.includes("issue")||C.includes("problem")?_="Negative":(C.includes("terrible")||C.includes("hate")||C.includes("awful"))&&(_="Very Negative"),m[_]++,b[S.senderId]||(b[S.senderId]={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0}),b[S.senderId][_]++,v[S.senderId]=(v[S.senderId]||0)+1}}),i(S=>S.map(C=>({...C,value:m[C.name]||0})));const x=Object.entries(v).map(([S,C])=>({name:f(S),messages:C}));o(x);const w={};Object.entries(b).forEach(([S,C])=>{w[S]={name:f(S),sentiments:C}}),l(w),h(v,b)},[t,n,f]);const h=(m,v)=>{if(Object.keys(m).length===0){d({isBalanced:!1,score:0,reason:"No participant data available"});return}const x=Object.values(m).reduce((B,R)=>B+R,0)/Object.keys(m).length,w=Object.values(m).map(B=>Math.abs(B-x)/x),S=w.reduce((B,R)=>B+R,0)/w.length,C=Object.values(v).map(B=>Object.values(B).filter(R=>R>0).length),_=C.reduce((B,R)=>B+R,0)/C.length,A=["Very Positive","Positive","Neutral","Negative","Very Negative"],j=Object.values(v).map(B=>{const R=Math.max(...Object.values(B));return A.find(L=>B[L]===R)||"Neutral"}),T=new Set(j).size,k=T/A.length,I=Math.max(0,100-S*100),E=_/5*100,O=k*100,M=Math.round(I*.6+E*.2+O*.2);let U="";const D=M>=70;S>.3&&(U+="Participation is uneven among participants. "),_<2&&(U+="Limited range of sentiments expressed. "),T<=1?U+="Participants show similar sentiment patterns, suggesting potential group-think. ":T>=4&&(U+="Wide divergence in participant sentiments, showing healthy diversity of opinions. "),U===""&&(U=D?"Good mix of participation and diverse opinions.":"Multiple factors affecting balance."),d({isBalanced:D,score:M,reason:U})},p=m=>{const v=c[m];if(!v)return"N/A";const b=v.sentiments;let x=0,w="Neutral";return Object.entries(b).forEach(([S,C])=>{C>x&&(x=C,w=S)}),w};return a.jsx("div",{className:"glass-panel rounded-xl p-4",children:a.jsxs(hl,{defaultValue:"sentiment",children:[a.jsxs(Ka,{className:"grid grid-cols-2 mb-4",children:[a.jsxs(gn,{value:"sentiment",className:"flex items-center",children:[a.jsx(GJ,{className:"h-4 w-4 mr-2"}),"Sentiment"]}),a.jsxs(gn,{value:"participation",className:"flex items-center",children:[a.jsx(B_,{className:"h-4 w-4 mr-2"}),"Participation"]})]}),a.jsx(vn,{value:"sentiment",children:a.jsx(lt,{children:a.jsxs(Ot,{className:"pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"Sentiment Analysis"}),a.jsxs("div",{className:`px-3 py-1 rounded-full text-sm ${u.isBalanced?"bg-green-100 text-green-800":"bg-amber-100 text-amber-800"}`,children:["Balance score: ",u.score,"/100"]})]}),a.jsx("div",{className:"h-60",children:a.jsx(zc,{width:"100%",height:"100%",children:a.jsxs(rk,{children:[a.jsx(ni,{}),a.jsx(bo,{data:r,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:m,percent:v})=>v>0?`${m} ${(v*100).toFixed(0)}%`:"",children:r.map((m,v)=>a.jsx(Rg,{fill:m.color},`cell-${v}`))}),a.jsx(Na,{})]})})}),a.jsxs("div",{className:"mt-4",children:[a.jsx("h4",{className:"text-sm font-medium mb-2",children:"Sentiment by Participant"}),a.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto pr-2",children:Object.entries(c).map(([m,v])=>{var w;const b=p(m),x=((w=r.find(S=>S.name===b))==null?void 0:w.color)||"#93c5fd";return a.jsxs("div",{className:"flex items-center justify-between p-2 bg-slate-50 rounded",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(Qp,{className:"h-4 w-4 text-slate-400 mr-2"}),a.jsx("span",{className:"text-sm",children:v.name})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("span",{className:"text-xs mr-2",children:"Predominant:"}),a.jsx("span",{className:"text-xs font-medium px-2 py-0.5 rounded",style:{backgroundColor:`${x}30`,color:x},children:b})]})]},m)})})]}),a.jsxs("div",{className:"mt-4 pt-4 border-t",children:[a.jsx("h4",{className:"text-sm font-medium mb-2",children:"Focus Group Balance Assessment"}),a.jsxs("div",{className:`p-3 rounded text-sm ${u.isBalanced?"bg-green-50 text-green-700":"bg-amber-50 text-amber-700"}`,children:[a.jsx("span",{className:"font-medium",children:u.isBalanced?"Balanced Focus Group":"Potential Balance Issues"}),a.jsx("p",{className:"mt-1 text-xs",children:u.reason})]})]})]})})}),a.jsx(vn,{value:"participation",children:a.jsx(lt,{children:a.jsxs(Ot,{className:"pt-6",children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Participation Distribution"}),a.jsx("div",{className:"h-60",children:a.jsx(zc,{width:"100%",height:"100%",children:a.jsxs(bW,{data:s,layout:"vertical",margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(ig,{strokeDasharray:"3 3"}),a.jsx(sl,{type:"number"}),a.jsx(ol,{dataKey:"name",type:"category",width:100}),a.jsx(ni,{}),a.jsx(yl,{dataKey:"messages",fill:"#8884d8",name:"Messages"})]})})}),a.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:s.length>0?`Most active: ${(g=s.sort((m,v)=>v.messages-m.messages)[0])==null?void 0:g.name}`:"No participation data available"})]})})})]})})};function T$e(t){if(console.log("šŸ” [GPT-5 CONVERTER] Input wsMessage:",JSON.stringify(t,null,2)),!t)return console.error("šŸ” [GPT-5 CONVERTER] ERROR: wsMessage is null/undefined"),null;const e={id:t.id,senderId:t.senderId,text:t.text,timestamp:new Date(t.timestamp),type:t.type,highlighted:t.highlighted,attached_assets:t.attached_assets||[],activates_visual_context:t.activates_visual_context||!1,visualAsset:t.visualAsset};return console.log("šŸ” [GPT-5 CONVERTER] Output converted:",JSON.stringify(e,null,2)),e}function P$e(t){return{id:t.id,title:t.title,description:t.description,quotes:t.quotes,source:t.source,created_at:t.created_at}}function SW(){return!0}const k$e=({focusGroupId:t,personas:e,isVisible:n,onToggle:r})=>{const[i,s]=y.useState(null),[o,c]=y.useState(null),[l,u]=y.useState(null),[d,f]=y.useState(null),[h,p]=y.useState(!1),[g,m]=y.useState(null),[v,b]=y.useState(null);Zo();const x=SW();y.useEffect(()=>{if(!(!n||!t))return S(),console.log("šŸ“Š Setting up STABLE WebSocket event listeners for dashboard"),console.log("šŸ“Š Dashboard WebSocket listeners temporarily disabled for GPT-5 fix"),()=>{console.log("šŸ“Š Cleaning up STABLE dashboard WebSocket listeners")}},[n,t,x,!0]);const S=async()=>{p(!0),m(null);try{const[T,k,I,E]=await Promise.allSettled([er.getConversationAnalytics(t),er.getConversationState(t),er.getAutonomousConversationStatus(t),er.getConversationInsights(t)]);T.status==="fulfilled"&&s(T.value.data.analytics),k.status==="fulfilled"&&c(k.value.data.state),I.status==="fulfilled"&&u(I.value.data.status),E.status==="fulfilled"&&f(E.value.data.insights),b(new Date)}catch(T){console.error("Error fetching dashboard data:",T),m("Failed to load dashboard data")}finally{p(!1)}},C=()=>{S()},_=T=>{switch(T){case"running":return"bg-green-500";case"paused":return"bg-amber-500";case"completed":return"bg-blue-500";case"error":return"bg-red-500";default:return"bg-gray-500"}},A=T=>{switch(T){case"positive":return"text-green-600";case"negative":return"text-red-600";default:return"text-gray-600"}},j=T=>{switch(T){case"excellent":return"text-green-600";case"good":return"text-blue-600";case"fair":return"text-amber-600";case"poor":return"text-red-600";default:return"text-gray-600"}};return n?a.jsxs("div",{className:"fixed right-4 top-4 bottom-4 w-80 bg-white rounded-lg shadow-lg border border-gray-200 flex flex-col overflow-hidden z-50",children:[a.jsxs("div",{className:"p-4 border-b border-gray-200 bg-gray-50",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(xa,{className:"h-5 w-5 text-blue-600"}),a.jsx("h3",{className:"font-semibold text-gray-900",children:"AI Dashboard"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(X,{variant:"ghost",size:"sm",onClick:C,disabled:h,className:"p-1",children:a.jsx(Xl,{className:`h-4 w-4 ${h?"animate-spin":""}`})}),a.jsx(X,{variant:"ghost",size:"sm",onClick:r,className:"p-1",children:a.jsx(QJ,{className:"h-4 w-4"})})]})]}),v&&a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Last updated: ",v.toLocaleTimeString()]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[g&&a.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(KJ,{className:"h-4 w-4 text-red-600"}),a.jsx("span",{className:"text-sm text-red-800",children:g})]})}),l&&a.jsxs(lt,{children:[a.jsx(Ei,{className:"pb-3",children:a.jsxs(Yi,{className:"text-sm flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${_(l.conversation_state)}`}),"Autonomous Status"]})}),a.jsx(Ot,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"State:"}),a.jsx(_r,{variant:l.conversation_state==="running"?"default":"secondary",children:l.conversation_state})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Actions:"}),a.jsx("span",{className:"font-medium",children:l.action_count||0})]})]})})]}),o&&a.jsxs(lt,{children:[a.jsx(Ei,{className:"pb-3",children:a.jsxs(Yi,{className:"text-sm flex items-center gap-2",children:[a.jsx(ma,{className:"h-4 w-4"}),"Conversation Health"]})}),a.jsx(Ot,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm",children:"Overall Health:"}),a.jsx(_r,{className:j(o.conversation_health.status),children:o.conversation_health.status})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Score:"}),a.jsxs("span",{className:"font-medium",children:[o.conversation_health.score,"/100"]})]}),a.jsx($l,{value:o.conversation_health.score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("span",{className:"text-xs text-gray-600",children:"Indicators:"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:o.conversation_health.indicators.map((T,k)=>a.jsx(_r,{variant:"outline",className:"text-xs",children:T.replace("_"," ")},k))})]})]})})]}),i&&a.jsxs(lt,{children:[a.jsx(Ei,{className:"pb-3",children:a.jsxs(Yi,{className:"text-sm flex items-center gap-2",children:[a.jsx(Fr,{className:"h-4 w-4"}),"Participation"]})}),a.jsx(Ot,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-semibold text-blue-600",children:i.overview.active_participants}),a.jsx("div",{className:"text-xs text-gray-600",children:"Active"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-semibold text-green-600",children:i.overview.participant_messages}),a.jsx("div",{className:"text-xs text-gray-600",children:"Messages"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Balance:"}),a.jsx(_r,{variant:i.participation.participation_balance==="balanced"?"default":"secondary",children:i.participation.participation_balance.replace("_"," ")})]}),i.participation.dominant_participants.length>0&&a.jsxs("div",{className:"text-xs text-amber-600",children:["Dominant: ",i.participation.dominant_participants.length," participant(s)"]}),i.participation.quiet_participants.length>0&&a.jsxs("div",{className:"text-xs text-blue-600",children:["Quiet: ",i.participation.quiet_participants.length," participant(s)"]})]})]})})]}),i&&a.jsxs(lt,{children:[a.jsx(Ei,{className:"pb-3",children:a.jsxs(Yi,{className:"text-sm flex items-center gap-2",children:[a.jsx(mZ,{className:"h-4 w-4"}),"Sentiment"]})}),a.jsx(Ot,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm",children:"Overall:"}),a.jsx(_r,{className:A(i.sentiment_analysis.overall_sentiment),children:i.sentiment_analysis.overall_sentiment})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-xs",children:[a.jsxs("span",{children:["Positive: ",i.sentiment_analysis.sentiment_distribution.positive]}),a.jsxs("span",{children:["Neutral: ",i.sentiment_analysis.sentiment_distribution.neutral]}),a.jsxs("span",{children:["Negative: ",i.sentiment_analysis.sentiment_distribution.negative]})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Trend:"}),a.jsx("span",{className:"font-medium",children:i.sentiment_analysis.sentiment_trend})]})]})]})})]}),i&&a.jsxs(lt,{children:[a.jsx(Ei,{className:"pb-3",children:a.jsxs(Yi,{className:"text-sm flex items-center gap-2",children:[a.jsx(VJ,{className:"h-4 w-4"}),"Quality Metrics"]})}),a.jsx(Ot,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Engagement:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(i.quality_metrics.engagement_score),"/100"]})]}),a.jsx($l,{value:i.quality_metrics.engagement_score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Depth:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(i.quality_metrics.depth_score),"/100"]})]}),a.jsx($l,{value:i.quality_metrics.depth_score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Overall:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(i.quality_metrics.quality_score),"/100"]})]}),a.jsx($l,{value:i.quality_metrics.quality_score,className:"h-2"})]})]})})]}),d&&a.jsxs(lt,{children:[a.jsx(Ei,{className:"pb-3",children:a.jsxs(Yi,{className:"text-sm flex items-center gap-2",children:[a.jsx(hu,{className:"h-4 w-4"}),"AI Insights"]})}),a.jsx(Ot,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Energy:"}),a.jsx(_r,{variant:d.conversation_energy==="high"?"default":"secondary",children:d.conversation_energy})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Engagement:"}),a.jsx(_r,{variant:d.topic_engagement==="high"?"default":"secondary",children:d.topic_engagement})]}),d.next_suggested_action&&a.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-2 mt-2",children:a.jsxs("div",{className:"text-xs text-blue-800",children:[a.jsx("strong",{children:"Suggestion:"})," ",d.next_suggested_action]})})]})})]}),i&&i.recommendations.length>0&&a.jsxs(lt,{children:[a.jsx(Ei,{className:"pb-3",children:a.jsxs(Yi,{className:"text-sm flex items-center gap-2",children:[a.jsx(ME,{className:"h-4 w-4"}),"Recommendations"]})}),a.jsx(Ot,{className:"pt-0",children:a.jsx("div",{className:"space-y-2",children:i.recommendations.map((T,k)=>a.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-2",children:a.jsx("div",{className:"text-xs text-amber-800",children:T})},k))})})]})]})]}):null},O$e=({discussionGuide:t,moderatorStatus:e,onSectionSelect:n,onSetPosition:r,onSave:i,focusGroupId:s,isOpen:o,onToggle:c,className:l,onEditingChange:u})=>{const d=y.useRef(!1),f=y.useCallback(v=>{d.current=v,u==null||u(v)},[u]),[h,p]=y.useState(!1),g=async()=>{if(!t){ne.error("No discussion guide available",{description:"The discussion guide is not available for download"});return}p(!0);try{await bt.downloadDiscussionGuide(s),ne.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(v){console.error("Error downloading discussion guide:",v),ne.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{p(!1)}},m=t&&typeof t=="object"&&t.sections;return a.jsx("div",{className:Pe("w-full border-b bg-white shadow-sm",l),children:a.jsxs(jg,{open:o,onOpenChange:c,children:[a.jsx(Eg,{asChild:!0,children:a.jsxs("div",{className:"w-full px-4 py-3 flex items-center justify-between hover:bg-slate-50 transition-colors cursor-pointer",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(YJ,{className:"h-5 w-5 text-slate-600"}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-semibold text-slate-900",children:"Discussion Guide"}),m&&a.jsxs("p",{className:"text-xs text-slate-500",children:[t.title," • ",t.total_duration," minutes"]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(X,{variant:"ghost",size:"sm",onClick:v=>{v.stopPropagation(),g()},disabled:!t||h,className:"h-8",children:h?a.jsx(eo,{className:"h-4 w-4 animate-spin"}):a.jsx(Jc,{className:"h-4 w-4"})}),o?a.jsx(fu,{className:"h-4 w-4 text-slate-500"}):a.jsx(Da,{className:"h-4 w-4 text-slate-500"})]})]})}),a.jsx(Ng,{children:a.jsx("div",{className:"border-t bg-slate-50",children:a.jsx(lt,{className:"mx-4 mb-4 mt-2",children:a.jsx(Ot,{className:"p-4",children:a.jsx("div",{className:"max-h-[70vh] overflow-y-auto",children:a.jsx(KT,{discussionGuide:t,moderatorStatus:e,onSectionSelect:n,onSetPosition:r,onSave:i,showProgress:!0,collapsible:!0,defaultExpanded:!0,focusGroupId:s,onEditingChange:f})})})})})})]})})},I$e=({focusGroupId:t,focusGroupName:e="Focus Group",onNoteClick:n})=>{const[r,i]=y.useState([]),[s,o]=y.useState(!0),[c,l]=y.useState(null);y.useEffect(()=>{u()},[t]);const u=async()=>{try{o(!0);const x=await bt.getNotes(t);if(x.data&&Array.isArray(x.data)){const w=x.data.map(S=>({...S,timestamp:new Date(S.timestamp),createdAt:new Date(S.createdAt)}));i(v(w))}}catch(x){console.error("Error fetching notes:",x),ne.error("Failed to load notes",{description:"Please refresh the page to try again."})}finally{o(!1)}},d=async x=>{l(x);try{await bt.deleteNote(t,x),i(r.filter(w=>w.id!==x)),ne.success("Note deleted successfully")}catch(w){console.error("Error deleting note:",w),ne.error("Failed to delete note",{description:"Please try again."})}finally{l(null)}},f=x=>{x.associatedMessageId&&n?n(x.associatedMessageId):ne.info("No associated message",{description:"This note is not linked to a specific discussion point."})},h=()=>{if(r.length===0){ne.warning("No notes to export",{description:"Create some notes first before exporting."});return}const x=p(),w=document.createElement("a"),S=new Blob([x],{type:"text/markdown"});w.href=URL.createObjectURL(S),w.download=`${e.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_notes.md`,document.body.appendChild(w),w.click(),document.body.removeChild(w),ne.success("Notes exported successfully",{description:`Downloaded ${r.length} notes as Markdown file.`})},p=()=>{const x=[`# Notes: ${e}`,"",`Exported on: ${new Date().toLocaleString()}`,`Total notes: ${r.length}`,"","---",""];return r.forEach((w,S)=>{var C;x.push(`## Note ${S+1}`),x.push(""),x.push(`**Created:** ${w.createdAt.toLocaleString()}`),(C=w.sectionInfo)!=null&&C.sectionTitle&&x.push(`**Section:** ${w.sectionInfo.sectionTitle}`),x.push(`**Elapsed Time:** ${g(w.elapsedTime)}`),x.push(""),x.push("**Content:**"),x.push(w.content),x.push(""),x.push("---"),x.push("")}),x.join(` +`)},g=x=>{const w=Math.floor(x/1e3),S=Math.floor(w/60),C=w%60;return`${S}:${C.toString().padStart(2,"0")}`},m=x=>x.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),v=x=>[...x].sort((w,S)=>S.createdAt.getTime()-w.createdAt.getTime()),b=x=>{i(w=>v([...w,x]))};return y.useEffect(()=>(window.notesPanelAddNote=b,()=>{delete window.notesPanelAddNote}),[]),s?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(Wy,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Notes"}),r.length>0&&a.jsxs("span",{className:"ml-2 text-sm text-slate-500",children:["(",r.length,")"]})]}),a.jsxs(X,{variant:"outline",size:"sm",onClick:h,disabled:r.length===0,children:[a.jsx(Jc,{className:"mr-2 h-4 w-4"}),"Export Notes"]})]}),a.jsx(lw,{className:"flex-1",children:r.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center bg-slate-50 rounded-lg",children:[a.jsx(Wy,{className:"h-8 w-8 text-slate-400 mb-3"}),a.jsx("p",{className:"text-slate-600",children:"No notes yet."}),a.jsx("p",{className:"text-sm text-slate-500 mt-2",children:'Click the "Note" button during the session to add contextual notes.'})]}):a.jsx("div",{className:"space-y-4",children:r.map(x=>{var w;return a.jsxs(lt,{className:"hover:shadow-md transition-shadow cursor-pointer group",onClick:()=>f(x),children:[a.jsx(Ei,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(Yi,{className:"text-sm font-medium text-slate-600",children:m(x.createdAt)}),((w=x.sectionInfo)==null?void 0:w.sectionTitle)&&a.jsx("div",{className:"text-xs text-slate-500 mt-1",children:a.jsx("span",{children:x.sectionInfo.sectionTitle})})]}),a.jsxs("div",{className:"flex items-center space-x-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[x.associatedMessageId&&a.jsx(X,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:S=>{S.stopPropagation(),f(x)},title:"Go to discussion point",children:a.jsx(cZ,{className:"h-3 w-3"})}),a.jsx(X,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-600 hover:text-red-700",onClick:S=>{S.stopPropagation(),d(x.id)},disabled:c===x.id,title:"Delete note",children:a.jsx(ir,{className:"h-3 w-3"})})]})]})}),a.jsx(Ot,{className:"pt-0",children:a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:x.content})})]},x.id)})})})]})},R$e=({isOpen:t,onClose:e,focusGroupId:n,associatedMessageId:r,sectionInfo:i,messageTimestamp:s,onNoteSaved:o})=>{const[c,l]=y.useState(""),[u,d]=y.useState(!1),f=async()=>{if(!c.trim()){ne.error("Note content cannot be empty");return}d(!0);try{const p={content:c.trim(),associatedMessageId:r,sectionInfo:i,elapsedTime:0,timestamp:s.toISOString(),createdAt:new Date().toISOString()},g=await bt.createNote(n,p);if(g.data){const m={...g.data,timestamp:new Date(g.data.timestamp),createdAt:new Date(g.data.createdAt)},v=i!=null&&i.sectionTitle?`'${i.sectionTitle}'`:"current section",b=s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});ne.success("Quick note saved",{description:`Note linked to ${v} at ${b}`}),o&&o(m),l(""),e()}}catch(p){console.error("Error saving note:",p),ne.error("Failed to save note",{description:"Please try again or check your connection."})}finally{d(!1)}},h=()=>{l(""),e()};return a.jsx(eu,{open:t,onOpenChange:h,children:a.jsxs(Lc,{className:"sm:max-w-md",children:[a.jsx(Fc,{children:a.jsx(Bc,{children:"Quick Note"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"text-sm text-slate-600",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"Section:"})," ",(i==null?void 0:i.sectionTitle)||"Unknown section"]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Time:"})," ",s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),a.jsx(ht,{placeholder:"Enter your note here...",value:c,onChange:p=>l(p.target.value),className:"min-h-[100px] resize-none",autoFocus:!0})]}),a.jsxs(Uc,{children:[a.jsx(X,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(X,{onClick:f,disabled:u,children:u?"Saving...":"Save Note"})]})]})})},Xo=Object.create(null);Xo.open="0";Xo.close="1";Xo.ping="2";Xo.pong="3";Xo.message="4";Xo.upgrade="5";Xo.noop="6";const ly=Object.create(null);Object.keys(Xo).forEach(t=>{ly[Xo[t]]=t});const dj={type:"error",data:"parser error"},CW=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",_W=typeof ArrayBuffer=="function",AW=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,ik=({type:t,data:e},n,r)=>CW&&e instanceof Blob?n?r(e):k$(e,r):_W&&(e instanceof ArrayBuffer||AW(e))?n?r(e):k$(new Blob([e]),r):r(Xo[t]+(e||"")),k$=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function O$(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let kC;function M$e(t,e){if(CW&&t.data instanceof Blob)return t.data.arrayBuffer().then(O$).then(e);if(_W&&(t.data instanceof ArrayBuffer||AW(t.data)))return e(O$(t.data));ik(t,!1,n=>{kC||(kC=new TextEncoder),e(kC.encode(n))})}const I$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jh=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t{let e=t.length*.75,n=t.length,r,i=0,s,o,c,l;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const u=new ArrayBuffer(e),d=new Uint8Array(u);for(r=0;r>4,d[i++]=(o&15)<<4|c>>2,d[i++]=(c&3)<<6|l&63;return u},$$e=typeof ArrayBuffer=="function",sk=(t,e)=>{if(typeof t!="string")return{type:"message",data:jW(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:L$e(t.substring(1),e)}:ly[n]?t.length>1?{type:ly[n],data:t.substring(1)}:{type:ly[n]}:dj},L$e=(t,e)=>{if($$e){const n=D$e(t);return jW(n,e)}else return{base64:!0,data:t}},jW=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},EW="",F$e=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((s,o)=>{ik(s,!1,c=>{r[o]=c,++i===n&&e(r.join(EW))})})},U$e=(t,e)=>{const n=t.split(EW),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const s=new DataView(i.buffer);s.setUint8(0,126),s.setUint16(1,r)}else{i=new Uint8Array(9);const s=new DataView(i.buffer);s.setUint8(0,127),s.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(n)})}})}let OC;function Dv(t){return t.reduce((e,n)=>e+n.length,0)}function $v(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let i=0;iMath.pow(2,21)-1){c.enqueue(dj);break}i=d*Math.pow(2,32)+u.getUint32(4),r=3}else{if(Dv(n)t){c.enqueue(dj);break}}}})}const NW=4;function mr(t){if(t)return z$e(t)}function z$e(t){for(var e in mr.prototype)t[e]=mr.prototype[e];return t}mr.prototype.on=mr.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};mr.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};mr.prototype.off=mr.prototype.removeListener=mr.prototype.removeAllListeners=mr.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,i=0;iPromise.resolve().then(e):(e,n)=>n(e,0),xs=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),V$e="arraybuffer";function TW(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const G$e=xs.setTimeout,K$e=xs.clearTimeout;function tS(t,e){e.useNativeTimers?(t.setTimeoutFn=G$e.bind(xs),t.clearTimeoutFn=K$e.bind(xs)):(t.setTimeoutFn=xs.setTimeout.bind(xs),t.clearTimeoutFn=xs.clearTimeout.bind(xs))}const W$e=1.33;function q$e(t){return typeof t=="string"?Y$e(t):Math.ceil((t.byteLength||t.size)*W$e)}function Y$e(t){let e=0,n=0;for(let r=0,i=t.length;r=57344?n+=3:(r++,n+=4);return n}function PW(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Q$e(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function X$e(t){let e={},n=t.split("&");for(let r=0,i=n.length;r{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};U$e(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,F$e(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=PW()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let kW=!1;try{kW=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const eLe=kW;function tLe(){}class nLe extends Z$e{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,s)=>{this.onError("xhr post error",i,s)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}let Id=class uy extends mr{constructor(e,n,r){super(),this.createRequest=e,tS(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=TW(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=uy.requestsCount++,uy.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=tLe,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete uy.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Id.requestsCount=0;Id.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",R$);else if(typeof addEventListener=="function"){const t="onpagehide"in xs?"pagehide":"unload";addEventListener(t,R$,!1)}}function R$(){for(let t in Id.requests)Id.requests.hasOwnProperty(t)&&Id.requests[t].abort()}const rLe=function(){const t=OW({xdomain:!1});return t&&t.responseType!==null}();class iLe extends nLe{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=rLe&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Id(OW,this.uri(),e)}}function OW(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||eLe))return new XMLHttpRequest}catch{}if(!e)try{return new xs[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const IW=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class sLe extends ok{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=IW?{}:TW(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n{try{this.doWrite(r,s)}catch{}i&&eS(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=PW()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const IC=xs.WebSocket||xs.MozWebSocket;class oLe extends sLe{createSocket(e,n,r){return IW?new IC(e,n,r):n?new IC(e,n):new IC(e)}doWrite(e,n){this.ws.send(n)}}class aLe extends ok{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=H$e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),i=B$e();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const s=()=>{r.read().then(({done:c,value:l})=>{c||(this.onPacket(l),s())}).catch(c=>{})};s();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n{i&&eS(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const cLe={websocket:oLe,webtransport:aLe,polling:iLe},lLe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,uLe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function fj(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=lLe.exec(t||""),s={},o=14;for(;o--;)s[uLe[o]]=i[o]||"";return n!=-1&&r!=-1&&(s.source=e,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=dLe(s,s.path),s.queryKey=fLe(s,s.query),s}function dLe(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function fLe(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,s){i&&(n[i]=s)}),n}const hj=typeof addEventListener=="function"&&typeof removeEventListener=="function",dy=[];hj&&addEventListener("offline",()=>{dy.forEach(t=>t())},!1);class Gc extends mr{constructor(e,n){if(super(),this.binaryType=V$e,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=fj(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=fj(n.host).host);tS(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=X$e(this.opts.query)),hj&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},dy.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=NW,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Gc.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Gc.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,eS(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const s={type:e,data:n,options:r};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(Gc.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),hj&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=dy.indexOf(this._offlineEventListener);r!==-1&&dy.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}Gc.protocol=NW;class hLe extends Gc{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Gc.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=n.name,this.emitReserved("upgradeError",h)}}))};function s(){r||(r=!0,d(),n.close(),n=null)}const o=f=>{const h=new Error("probe error: "+f);h.transport=n.name,s(),this.emitReserved("upgradeError",h)};function c(){o("transport closed")}function l(){o("socket closed")}function u(f){n&&f.name!==n.name&&s()}const d=()=>{n.removeListener("open",i),n.removeListener("error",o),n.removeListener("close",c),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",o),n.once("close",c),this.once("close",l),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;rcLe[i]).filter(i=>!!i)),super(e,r)}};function mLe(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=fj(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const s=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port+e,r.href=r.protocol+"://"+s+(n&&n.port===r.port?"":":"+r.port),r}const gLe=typeof ArrayBuffer=="function",vLe=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,RW=Object.prototype.toString,yLe=typeof Blob=="function"||typeof Blob<"u"&&RW.call(Blob)==="[object BlobConstructor]",xLe=typeof File=="function"||typeof File<"u"&&RW.call(File)==="[object FileConstructor]";function ak(t){return gLe&&(t instanceof ArrayBuffer||vLe(t))||yLe&&t instanceof Blob||xLe&&t instanceof File}function fy(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n=0&&t.num{delete this.acks[e];for(let c=0;c{this.io.clearTimeoutFn(s),n.apply(this,c)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...n){return new Promise((r,i)=>{const s=(o,c)=>o?i(o):r(c);s.withError=!0,n.push(s),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...s)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...s)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Qt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Qt.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Qt.EVENT:case Qt.BINARY_EVENT:this.onevent(e);break;case Qt.ACK:case Qt.BINARY_ACK:this.onack(e);break;case Qt.DISCONNECT:this.ondisconnect();break;case Qt.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Qt.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Qt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r0&&t.jitter<=1?t.jitter:0,this.attempts=0}hh.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0};hh.prototype.reset=function(){this.attempts=0};hh.prototype.setMin=function(t){this.ms=t};hh.prototype.setMax=function(t){this.max=t};hh.prototype.setJitter=function(t){this.jitter=t};class gj extends mr{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,tS(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new hh({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||jLe;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new pLe(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Gs(n,"open",function(){r.onopen(),e&&e()}),s=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=Gs(n,"error",s);if(this._timeout!==!1){const c=this._timeout,l=this.setTimeoutFn(()=>{i(),s(new Error("timeout")),n.close()},c);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Gs(e,"ping",this.onping.bind(this)),Gs(e,"data",this.ondata.bind(this)),Gs(e,"error",this.onerror.bind(this)),Gs(e,"close",this.onclose.bind(this)),Gs(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){eS(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new MW(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;re()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Lh={};function hy(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=mLe(t,e.path||"/socket.io"),r=n.source,i=n.id,s=n.path,o=Lh[i]&&s in Lh[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let l;return c?l=new gj(r,e):(Lh[i]||(Lh[i]=new gj(r,e)),l=Lh[i]),n.query&&!e.query&&(e.query=n.queryKey),l.socket(n.path,e)}Object.assign(hy,{Manager:gj,Socket:MW,io:hy,connect:hy});const D$=window.location.origin,$$=new URLSearchParams(window.location.search).get("direct")==="1"?"/socket.io/":"/semblance_back/socket.io/";let kt=null,iu=null,L$=!1;function DW(t){if(kt)return kt.io.opts.auth={token:t()},kt;console.log("šŸ”§ [GPT-5] Creating singleton socket:",D$,$$),kt=hy(D$,{path:$$,transports:["websocket"],reconnection:!0,autoConnect:!1,timeout:6e4,pingInterval:45e3,pingTimeout:12e4,auth:n=>n({token:t()})}),kt.io.on("reconnect_attempt",()=>{console.log("šŸ”§ [GPT-5] Reconnect attempt - refreshing token"),kt.io.opts.auth={token:t()}});const e=()=>{console.log("šŸ”§ [GPT-5] Socket connected, rebinding listeners and rejoining room"),kLe(),iu&&PLe()};return kt.on("connect",e),kt.onAny((n,...r)=>{console.log(`šŸ”§ [GPT-5 onAny] ${n}:`,r);const i=r[0];switch(n){case"joined_focus_group":console.log("šŸ”§ [GPT-5] *** ROUTING joined_focus_group from onAny ***"),window.dispatchEvent(new CustomEvent("ws:joined_focus_group",{detail:i}));break;case"left_focus_group":console.log("šŸ”§ [GPT-5] *** ROUTING left_focus_group from onAny ***"),window.dispatchEvent(new CustomEvent("ws:left_focus_group",{detail:i}));break;case"message_update":console.log("šŸ”§ [GPT-5] *** ROUTING message_update from onAny ***");try{window.dispatchEvent(new CustomEvent("ws:message_update",{detail:i})),console.log("šŸ”§ [GPT-5] DISPATCHED window event ws:message_update SUCCESS (via onAny)")}catch(s){console.error("šŸ”§ [GPT-5] ERROR dispatching window event (via onAny):",s)}break;case"ai_status_update":console.log("šŸ”§ [GPT-5] *** ROUTING ai_status_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:ai_status_update",{detail:i}));break;case"moderator_status_update":console.log("šŸ”§ [GPT-5] *** ROUTING moderator_status_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:moderator_status_update",{detail:i}));break;case"theme_update":console.log("šŸ”§ [GPT-5] *** ROUTING theme_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:theme_update",{detail:i}));break;case"focus_group_update":console.log("šŸ”§ [GPT-5] *** ROUTING focus_group_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:focus_group_update",{detail:i}));break;case"connected":console.log("šŸ”§ [GPT-5] *** ROUTING connected from onAny ***");break;case"error":console.error("šŸ”§ [GPT-5] *** ROUTING error from onAny ***",i);break}}),kt.on("connect_error",n=>{console.error("šŸ”§ [GPT-5] Connect error:",n)}),kt.on("disconnect",n=>{console.log("šŸ”§ [GPT-5] Disconnected:",n)}),kt}function $W(){kt&&!kt.connected&&(console.log("šŸ”§ [GPT-5] Connecting socket"),kt.connect())}function NLe(t,e){if(console.log("šŸ”§ [GPT-5] Joining focus group:",t),iu=t,!(kt!=null&&kt.connected)){console.log("šŸ”§ [GPT-5] Socket not connected, will auto-rejoin on connect"),$W(),setTimeout(()=>{kt!=null&&kt.connected?(console.log("šŸ”§ [GPT-5] Retrying join after connection established"),kt.emit("join_focus_group",{focus_group_id:t},n=>{console.log("šŸ”§ [GPT-5] join_focus_group RETRY ACK:",n)})):console.log("šŸ”§ [GPT-5] Still not connected, will rejoin on next connect event")},1e3);return}kt.emit("join_focus_group",{focus_group_id:t},n=>{console.log("šŸ”§ [GPT-5] join_focus_group ACK:",n)})}function TLe(t){console.log("šŸ”§ [GPT-5] Leaving focus group:",t),iu===t&&(iu=null),kt!=null&&kt.connected&&kt.emit("leave_focus_group",{focus_group_id:t})}function PLe(){!(kt!=null&&kt.connected)||!iu||(console.log("šŸ”§ [GPT-5] Auto-rejoining room after reconnect:",iu),kt.emit("join_focus_group",{focus_group_id:iu}))}function kLe(){if(!kt){console.log("šŸ”§ [GPT-5] bindCoreListeners called but socket is null!");return}L$&&console.log("šŸ”§ [GPT-5] Listeners already bound, but rebinding anyway for safety"),console.log("šŸ”§ [GPT-5] bindCoreListeners called - socket exists, binding listeners");const t=c=>{console.log("šŸ”§ [GPT-5] joined_focus_group:",c),window.dispatchEvent(new CustomEvent("ws:joined_focus_group",{detail:c}))},e=c=>{console.log("šŸ”§ [GPT-5] left_focus_group:",c),window.dispatchEvent(new CustomEvent("ws:left_focus_group",{detail:c}))},n=c=>{console.log("šŸ”§ [GPT-5] *** MESSAGE_UPDATE LISTENER FIRED! ***"),console.log("šŸ”§ [GPT-5] message_update payload:",c),console.log("šŸ”§ [GPT-5] DISPATCHING window event ws:message_update");try{window.dispatchEvent(new CustomEvent("ws:message_update",{detail:c})),console.log("šŸ”§ [GPT-5] DISPATCHED window event ws:message_update SUCCESS")}catch(l){console.error("šŸ”§ [GPT-5] ERROR dispatching window event:",l)}},r=c=>{console.log("šŸ”§ [GPT-5] ai_status_update:",c),console.log("šŸ”§ [GPT-5] DISPATCHING window event ws:ai_status_update"),window.dispatchEvent(new CustomEvent("ws:ai_status_update",{detail:c})),console.log("šŸ”§ [GPT-5] DISPATCHED window event ws:ai_status_update")},i=c=>{console.log("šŸ”§ [GPT-5] moderator_status_update:",c),window.dispatchEvent(new CustomEvent("ws:moderator_status_update",{detail:c}))},s=c=>{console.log("šŸ”§ [GPT-5] theme_update:",c),window.dispatchEvent(new CustomEvent("ws:theme_update",{detail:c}))},o=c=>{console.log("šŸ”§ [GPT-5] focus_group_update:",c),window.dispatchEvent(new CustomEvent("ws:focus_group_update",{detail:c}))};console.log("šŸ”§ [GPT-5] BINDING specific listeners to socket"),kt.on("joined_focus_group",t),kt.on("left_focus_group",e),kt.on("message_update",n),kt.on("ai_status_update",r),kt.on("moderator_status_update",i),kt.on("theme_update",s),kt.on("focus_group_update",o),console.log("šŸ”§ [GPT-5] BOUND specific listeners to socket"),console.log("šŸ”§ [GPT-5] Socket listeners after binding:",kt.listeners("message_update").length),console.log("šŸ”§ [GPT-5] Socket hasListeners message_update:",kt.hasListeners("message_update")),setTimeout(()=>{kt!=null&&kt.connected&&(console.log("šŸ”§ [GPT-5] SELF-TEST: Emitting test event"),kt.emit("message_update",{test:"self-emit-test"}))},1e3),kt.on("connected",c=>{console.log("šŸ”§ [GPT-5] connected:",c)}),kt.on("error",c=>{console.error("šŸ”§ [GPT-5] socket error:",c)}),L$=!0}const OLe=()=>{const{id:t}=RE(),e=lr(),{token:n}=Zo(),[r,i]=y.useState([]),[s,o]=y.useState([]),[c,l]=y.useState([]),[u,d]=y.useState(null),[f,h]=y.useState([]),[p,g]=y.useState("chat"),[m,v]=y.useState(null),[b,x]=y.useState(!1),[w,S]=y.useState(!1),[C,_]=y.useState(!0),[A,j]=y.useState(!1),[T,k]=y.useState(!1),I=y.useRef(!1),[E,O]=y.useState(!1),M=y.useRef(u);M.current=u;const[U,D]=y.useState([]),[B,R]=y.useState(!1),[L,Y]=y.useState(""),[q,J]=y.useState("medium"),[me,F]=y.useState("medium"),[oe,se]=y.useState(!1),[le,ke]=y.useState(!1),[ue,we]=y.useState(null),[Ae,ee]=y.useState([]),[wt,et]=y.useState(!1),[Ct,Xe]=y.useState(!1),[nn,N]=y.useState(!1),[$,z]=y.useState(!0),[G,Q]=y.useState({isOpen:!1}),H=y.useRef(!1),[Z,he]=y.useState(""),xe=y.useRef(""),Oe=y.useRef(!1),be=y.useRef({wasConnected:!1,wasConnecting:!1,initialConnection:!0,hasShownFallbackNotification:!1}),We=SW(),[ot,Rt]=y.useState(!1),[Ke,Ze]=y.useState(!1),[_t,Kt]=y.useState(null),Qn=y.useCallback(()=>n||"",[n]);y.useEffect(()=>{console.log("šŸ”§ [GPT-5 Session] Initializing WebSocket"),DW(Qn)},[We,Qn]),y.useEffect(()=>{if(!t)return;(()=>{console.log("šŸ”§ [GPT-5 Session] Joining focus group:",t),NLe(t)})()},[t,We]),y.useEffect(()=>{Ze(!0),Rt(!1),Kt(null);const te=setTimeout(()=>{Rt(!0),Ze(!1)},1e3);return()=>{clearTimeout(te)}},[We]),y.useEffect(()=>{console.log("šŸ”§ [GPT-5 Session] Setting up window event listeners");const te=Ue=>{const nt=Ue.detail;console.log("šŸ”§ [GPT-5 Session] message_update:",nt),nt.focus_group_id&&(console.log("šŸ”§ [GPT-5] Message focus_group_id:",nt.focus_group_id),console.log("šŸ”§ [GPT-5] Current focus group from URL:",t));const ye=T$e(nt.message);if(!ye){console.error("šŸ”§ [GPT-5] convertWebSocketMessage returned null");return}i(Jt=>Jt.find(Zt=>Zt.id===ye.id)?(console.log("šŸ”§ [GPT-5] Message already exists, skipping"),Jt):(console.log("šŸ”§ [GPT-5] Adding new message, count:",Jt.length+1),[...Jt,ye]))},ae=Ue=>{const nt=Ue.detail;console.log("šŸ”§ [GPT-5 Session] ai_status_update:",nt),S(ye=>nt.status.status==="ai_mode"),he(ye=>nt.status.status)},Te=Ue=>{const nt=Ue.detail;console.log("šŸ”§ [GPT-5 Session] moderator_status_update:",nt),v(nt.moderator_status)},$e=Ue=>{const nt=Ue.detail;console.log("šŸ”§ [GPT-5 Session] theme_update:",nt);const ye=P$e(nt.theme);l(Jt=>{const ft=[...Jt],Zt=ft.findIndex(ln=>ln.id===ye.id);return Zt>=0?ft[Zt]=ye:ft.push(ye),ft})},Be=Ue=>{const nt=Ue.detail;console.log("šŸ”§ [GPT-5 Session] focus_group_update:",nt),d(ye=>ye?{...ye,...nt}:null)},Mt=Ue=>{const nt=Ue.detail;console.log("šŸ”§ [GPT-5 Session] joined_focus_group:",nt)};return console.log("šŸ”§ [GPT-5 Session] ADDING window event listeners"),window.addEventListener("ws:message_update",te),window.addEventListener("ws:ai_status_update",ae),window.addEventListener("ws:moderator_status_update",Te),window.addEventListener("ws:theme_update",$e),window.addEventListener("ws:focus_group_update",Be),window.addEventListener("ws:joined_focus_group",Mt),console.log("šŸ”§ [GPT-5 Session] ADDED all window event listeners"),()=>{console.log("šŸ”§ [GPT-5 Session] Cleaning up window event listeners"),window.removeEventListener("ws:message_update",te),window.removeEventListener("ws:ai_status_update",ae),window.removeEventListener("ws:moderator_status_update",Te),window.removeEventListener("ws:theme_update",$e),window.removeEventListener("ws:focus_group_update",Be),window.removeEventListener("ws:joined_focus_group",Mt),t&&TLe(t)}},[We,t]),y.useEffect(()=>{if(!t)return;const te=be.current;ot&&!te.wasConnected&&(te.initialConnection?Fe.success("Live updates enabled",{description:"Connected to real-time updates. Changes will appear instantly.",duration:3e3}):Fe.success("Real-time updates restored",{description:"WebSocket connection re-established. You'll now receive instant updates.",duration:4e3}),te.wasConnected=!0,te.initialConnection=!1),!ot&&!Ke&&te.wasConnected&&!te.initialConnection&&(Fe.warning("Connection lost",{description:"Real-time updates unavailable. Attempting to reconnect...",duration:5e3}),te.wasConnected=!1,z(!0)),_t&&!Ke&&!ot&&!te.initialConnection&&(Fe.error("Connection failed",{description:"Unable to establish real-time connection. Using periodic updates instead.",duration:6e3}),z(!0)),te.wasConnecting=Ke},[ot,Ke,_t,We,t]),y.useEffect(()=>{},[We,t,u]);const Xt=async()=>{var te;if(t)try{const ae=await er.getModeratorStatus(t);if((te=ae==null?void 0:ae.data)!=null&&te.status){const Te=ae.data.status;if(m){const $e=m.current_section_id!==Te.current_section_id||m.current_item_id!==Te.current_item_id||m.progress!==Te.progress}I.current||v(Te)}}catch(ae){console.error("Error fetching moderator status:",ae)}},at=async()=>{if(!t)return{aiActive:!1,sessionStatus:""};try{if(typeof(bt==null?void 0:bt.getById)!="function")return console.error("focusGroupsApi.getById is not a function:",typeof(bt==null?void 0:bt.getById)),{aiActive:w,sessionStatus:Z};const te=await bt.getById(t);if(!te||typeof te!="object")return console.error("Invalid response object received:",te),{aiActive:w,sessionStatus:Z};if(!te.data||typeof te.data!="object")return console.warn("Focus group response missing data property:",te),{aiActive:w,sessionStatus:Z};const ae=te.data.status;if(typeof ae>"u")return console.warn("Focus group response missing status field:",te.data),{aiActive:w,sessionStatus:Z};const Te=ae==="ai_mode";return ae==="autonomous_active"?console.warn('Detected legacy "autonomous_active" status - backend may need updating to "ai_mode"'):["ai_mode","active","completed","paused","draft","in-progress"].includes(ae)||console.warn("Unexpected focus group status value:",ae),{aiActive:Te,sessionStatus:ae}}catch(te){console.error("Error checking AI mode status:",te);const ae={focusGroupId:t,currentAiModeStatus:w,errorType:"unknown",timestamp:new Date().toISOString()};return te.response?(ae.errorType="api_error",ae.status=te.response.status,ae.data=te.response.data,console.error("API error response:",te.response.status,te.response.data),te.response.status===404?console.warn("Focus group not found - may have been deleted"):te.response.status===500&&console.error("Server error during status check - backend issue")):te.request?(ae.errorType="network_error",console.error("Network error - no response received, check connectivity")):(ae.errorType="request_setup",ae.message=te.message,console.error("Request setup error:",te.message)),console.debug("Status check error details:",ae),{aiActive:w,sessionStatus:Z,isGenerating:!1}}},Wt=async(te,ae)=>{if(!t||Oe.current)return;const Te=["completed","paused"],Be=["ai_mode","autonomous_active","active","in-progress"].includes(ae),Mt=Te.includes(te);if(Be&&Mt){Oe.current=!0;try{let Ue="session_ended";te==="completed"?Ue="auto_complete":te==="paused"&&(Ue="manual_stop");const nt=await er.endSession(t,Ue);nt!=null&&nt.data&&(Fe.success("Session concluded",{description:"The focus group session has ended with a concluding statement from the moderator."}),setTimeout(()=>{st()},1e3))}catch(Ue){console.error("āŒ Error ending session with concluding statement:",Ue),Fe.error("Error ending session",{description:"Failed to add concluding statement, but the session has ended."})}}},st=async()=>{var te;if(t)try{const ae=await bt.getMessages(t);console.log("šŸ” [FetchMessages] Raw API response:",ae==null?void 0:ae.data);let Te=[],$e=[];ae&&ae.data&&(Array.isArray(ae.data)?(Te=ae.data,$e=[]):ae.data.messages||ae.data.mode_events?(Te=ae.data.messages||[],$e=ae.data.mode_events||[]):(Te=Array.isArray(ae.data)?ae.data:[],$e=[]));const Be=Te.map(ye=>({id:ye._id||ye.id||`msg-${Date.now()}`,senderId:ye.senderId,text:ye.text,timestamp:new Date(ye.timestamp||ye.created_at||new Date),type:ye.type||"response",highlighted:ye.highlighted||!1,visualAsset:ye.visualAsset}));console.log("šŸ” [FetchMessages] Formatted messages with visual assets:",Be.filter(ye=>ye.visualAsset).map(ye=>({id:ye.id,senderId:ye.senderId,hasVisualAsset:!!ye.visualAsset,visualAsset:ye.visualAsset})));const Mt=$e.map(ye=>({id:ye._id||ye.id||`event-${Date.now()}`,focus_group_id:ye.focus_group_id,event_type:ye.event_type,timestamp:new Date(ye.timestamp||ye.created_at||new Date),user_id:ye.user_id,created_at:new Date(ye.created_at||new Date)}));o(Mt),Be.length>0?i(ye=>{if(ye.length===0)return Be;{const Jt=new Map;ye.forEach(Un=>Jt.set(Un.id,Un));const ft=Be.map(Un=>{if(Jt.has(Un.id)){const kr=Jt.get(Un.id);return{...Un,highlighted:kr.highlighted}}return Un}),Zt=new Set(ft.map(Un=>Un.id)),ln=ye.filter(Un=>!Zt.has(Un.id));return[...ft,...ln].sort((Un,kr)=>Un.timestamp.getTime()-kr.timestamp.getTime())}}):Be.length===0&&i(ye=>ye.length===0?[]:ye);const Ue=Be.filter(ye=>ye.highlighted),nt=Ue.length>0?Ue.map(ye=>({id:`theme-${ye.id}`,text:ye.text.substring(0,40)+(ye.text.length>40?"...":""),count:1,messages:[ye.id],source:"highlight"})):[];try{const ye=await er.getKeyThemes(t);if((te=ye==null?void 0:ye.data)!=null&&te.themes&&Array.isArray(ye.data.themes)){const Jt=ye.data.themes;l([...nt,...Jt])}else l(nt)}catch(ye){console.error("Error fetching AI-generated themes:",ye),l(nt)}}catch(ae){console.error("Error fetching messages:",ae),r.length===0&&Fe.error("Failed to fetch messages",{description:"Please try again later or restart the session."})}},Je=async()=>{if(!t)return!1;try{const ae=(await $r.getAll()).data||[],Te=await bt.getById(t);if(Te&&Te.data){const $e=Te.data;console.log("Focus group data from API:",$e);const Be={id:$e._id||$e.id,name:$e.name,status:$e.status||"in-progress",participants:$e.participants||[],date:$e.date||new Date().toISOString(),duration:$e.duration||60,topic:$e.topic||"general",discussionGuide:$e.discussionGuide||"",llm_model:$e.llm_model||"gemini-2.5-pro"};if(d(Be),Y(Be.llm_model||"gemini-2.5-pro"),J(Be.reasoning_effort||"medium"),F(Be.verbosity||"medium"),$e.participants_data&&Array.isArray($e.participants_data))h($e.participants_data.map(Ue=>({...Ue,id:Ue._id||Ue.id})));else if(Be.participants&&Array.isArray(Be.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:Be.participants,allPersonas:ae.map(nt=>({id:nt._id||nt.id,name:nt.name}))});const Ue=ae.filter(nt=>{const ye=nt._id||nt.id;return Be.participants.includes(ye)});console.log("Matched participants:",Ue.map(nt=>nt.name)),h(Ue)}await st(),await Xt();const Mt=await at();return S(Mt.aiActive),he(Mt.sessionStatus),H.current=Mt.aiActive,xe.current=Mt.sessionStatus,!0}return!1}catch(te){return console.error("Error fetching focus group:",te),!1}},fn=async(te,ae,Te)=>{if(console.log("šŸ”§ updateFocusGroupModel called with:",{id:t,focusGroup:!!u,newModel:te,reasoningEffort:ae,verbosity:Te}),!t||!u){console.log("āŒ updateFocusGroupModel: Missing id or focusGroup",{id:t,focusGroup:!!u});return}se(!0);try{const $e={llm_model:te};te==="gpt-5"&&($e.reasoning_effort=ae||q,$e.verbosity=Te||me),console.log("šŸ”§ Making API call to update focus group model:",{id:t,updateData:$e});const Be=await bt.update(t,$e);console.log("šŸ”§ API response:",Be),Be&&Be.data?(d(Mt=>Mt?{...Mt,llm_model:te,reasoning_effort:te==="gpt-5"?ae||q:Mt==null?void 0:Mt.reasoning_effort,verbosity:te==="gpt-5"?Te||me:Mt==null?void 0:Mt.verbosity}:null),Fe.success("AI Model Updated",{description:`Focus group will now use ${te==="gemini-2.5-pro"?"Gemini 2.5 Pro":te==="gpt-4.1"?"GPT-4.1":te==="gpt-5"?"GPT-5":te} for AI responses`}),R(!1),console.log("āœ… Model update successful")):console.log("āŒ API response missing data:",Be)}catch($e){console.error("āŒ Error updating focus group model:",$e),Fe.error("Failed to update AI model",{description:"There was an error updating the AI model. Please try again."})}finally{se(!1)}};y.useEffect(()=>{console.log("Looking for focus group with ID:",t);const te=async()=>{try{return(await $r.getAll()).data||[]}catch(Be){return console.error("Error fetching personas:",Be),[]}},ae=async Be=>{try{const Mt=await bt.getById(t);if(Mt&&Mt.data){const Ue=Mt.data;console.log("Focus group data from API:",Ue);const nt={id:Ue._id||Ue.id,name:Ue.name,status:Ue.status||"in-progress",participants:Ue.participants||[],date:Ue.date||new Date().toISOString(),duration:Ue.duration||60,topic:Ue.topic||"general",discussionGuide:Ue.discussionGuide||"",llm_model:Ue.llm_model||"gemini-2.5-pro"};if(d(nt),Y(nt.llm_model||"gemini-2.5-pro"),J(nt.reasoning_effort||"medium"),F(nt.verbosity||"medium"),Ue.participants_data&&Array.isArray(Ue.participants_data))h(Ue.participants_data.map(ye=>({...ye,id:ye._id||ye.id})));else if(nt.participants&&Array.isArray(nt.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:nt.participants,allPersonas:Be.map(Jt=>({id:Jt._id||Jt.id,name:Jt.name}))});const ye=Be.filter(Jt=>{const ft=Jt._id||Jt.id;return nt.participants.includes(ft)});console.log("Matched participants:",ye.map(Jt=>Jt.name)),h(ye)}return st(),Xt(),_(!1),!0}return!1}catch(Mt){return console.error("Error fetching focus group:",Mt),!1}};let Te,$e;return te().then(Be=>{ae(Be).then(Mt=>{Mt?_t&&(_t.includes("unavailable")||_t.includes("websocket error"))?(console.log("šŸ“” WebSocket connection failed, falling back to polling"),(()=>{st(),Xt(),Te&&window.clearInterval(Te);const ft=w?3e3:1e4;console.log("šŸ“” Setting up message polling:",{aiModeActive:w,pollInterval:ft,timestamp:new Date().toISOString()}),Te=window.setInterval(()=>{I.current?console.log("šŸ“” Skipping poll - editing discussion guide"):(console.log("šŸ“” Polling for messages...",new Date().toISOString()),st(),Xt())},ft)})(),$e=window.setInterval(async()=>{const ft=H.current,Zt=xe.current,ln=await at();if(H.current=ln.aiActive,xe.current=ln.sessionStatus,S(ln.aiActive),he(ln.sessionStatus),Zt&&Zt!==ln.sessionStatus&&await Wt(ln.sessionStatus,Zt),ft!==ln.aiActive&&Te){window.clearInterval(Te);const hn=ln.aiActive?3e3:1e4;Te=window.setInterval(()=>{I.current||(st(),Xt())},hn)}},15e3)):console.log("šŸ“” WebSocket enabled, skipping polling setup"):(console.error("Focus group not found with ID:",t),_(!1),Fe.error("Focus group not found",{description:`Could not find focus group with ID: ${t}`}))})}),()=>{Te&&window.clearInterval(Te),$e&&window.clearInterval($e)}},[t,e,We,_t]);const Is=te=>{if(!te||!te.sections||!Array.isArray(te.sections))return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const ae=te.sections[0];if(!ae)return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const Te=Be=>Be.questions&&Array.isArray(Be.questions)&&Be.questions.length>0?{content:Be.questions[0].content,itemId:Be.questions[0].id,type:"question"}:Be.activities&&Array.isArray(Be.activities)&&Be.activities.length>0?{content:Be.activities[0].content,itemId:Be.activities[0].id,type:"activity"}:null;let $e=Te(ae);if(!$e&&ae.subsections&&Array.isArray(ae.subsections)){for(const Be of ae.subsections)if($e=Te(Be),$e)break}return $e?{content:$e.content,sectionId:ae.id,itemId:$e.itemId}:{content:`Welcome to our focus group session on "${ae.title||"our topic"}". Let's begin our discussion.`,sectionId:ae.id,itemId:"section-intro"}},ra=async()=>{var te,ae,Te,$e,Be,Mt;if(t)try{Fe.info("Starting focus group session...",{description:"The session is now ready for AI moderation."});try{const Ue=await er.getModeratorStatus(t),nt=(ae=(te=Ue==null?void 0:Ue.data)==null?void 0:te.status)==null?void 0:ae.moderator_position;nt?console.log("šŸ“ Preserving existing moderator position:",nt):(await er.setModeratorPosition(t,((Be=($e=(Te=u==null?void 0:u.discussionGuide)==null?void 0:Te.sections)==null?void 0:$e[0])==null?void 0:Be.id)||"welcome"),console.log("šŸš€ Moderator position initialized to start of discussion guide (first time)"))}catch(Ue){console.warn("Failed to check/initialize moderator position:",Ue)}await bt.update(t,{status:"active"});try{const Ue=Is(u==null?void 0:u.discussionGuide),nt={id:`msg-${Date.now()}`,senderId:"moderator",text:Ue.content,timestamp:new Date,type:"question"},ye=await bt.sendMessage(t,{senderId:"moderator",text:nt.text,type:"question"});(Mt=ye==null?void 0:ye.data)!=null&&Mt.message_id&&(nt.id=ye.data.message_id),W(nt),console.log("šŸš€ Initial moderator message created:",{content:Ue.content,sectionId:Ue.sectionId,itemId:Ue.itemId})}catch(Ue){console.warn("Failed to create initial moderator message:",Ue)}Fe.success("Focus group session started",{description:"The discussion has begun. Use the control panel below to moderate."})}catch(Ue){console.error("Error starting session:",Ue),Fe.error("Error starting session",{description:"There was a problem connecting to the server."})}},W=te=>{i(ae=>ae.find($e=>$e.id===te.id)?(console.log("šŸ”§ [handleNewMessage] Message already exists, skipping:",te.id),ae):(console.log("šŸ”§ [handleNewMessage] Adding new message:",te.id),[...ae,te]))},Ie=async te=>{const ae=[...r],Te=ae.findIndex($e=>$e.id===te);if(Te!==-1){const $e=ae[Te],Be=!$e.highlighted;if(ae[Te]={...$e,highlighted:Be},i(ae),t)try{!te.startsWith("local-")&&!te.startsWith("msg-")?await bt.updateMessageHighlight(t,te,Be):console.log("Skipping database update for local message:",te)}catch(Mt){console.error("Error updating message highlight state:",Mt),Fe.error("Failed to save highlight state",{description:"The highlight may not persist if the page is refreshed."})}}},Ve=te=>f.find(ae=>ae.id===te||ae._id===te),ut=()=>{const te=r.map($e=>{var Ue;let Be;return $e.senderId==="moderator"?Be="AI Moderator":$e.senderId==="facilitator"?Be="Human Facilitator":Be=((Ue=Ve($e.senderId))==null?void 0:Ue.name)||"Unknown",`[${$e.timestamp.toLocaleTimeString()}] ${Be}: ${$e.text}`}).join(` + +`),ae=document.createElement("a"),Te=new Blob([te],{type:"text/plain"});ae.href=URL.createObjectURL(Te),ae.download=`focus-group-${t}-transcript.txt`,document.body.appendChild(ae),ae.click(),document.body.removeChild(ae),Fe.success("Transcript downloaded",{description:"The focus group transcript has been saved to your device."})},tt=(te,ae)=>{const Te=ft=>{const Zt=ft.match(/^\[([^\]]+)\]:\s*(.*)$/);return Zt?Zt[2].trim():ft.trim()},$e=ft=>ft.toLowerCase().replace(/[^\w\s]/g," ").replace(/\s+/g," ").trim(),Be=(ft,Zt)=>{const ln=$e(ft),hn=$e(Zt);if(ln===hn)return 1;if(ln.includes(hn)||hn.includes(ln))return Math.min(ln.length,hn.length)/Math.max(ln.length,hn.length);const Un=ln.split(" "),kr=hn.split(" "),xl=Un.filter(En=>kr.includes(En)&&En.length>2);return Un.length===0||kr.length===0?0:xl.length/Math.max(Un.length,kr.length)},Mt=typeof te=="object"&&te!==null,Ue=Mt?te.text:Te(te),nt=Mt?te.original:te;let ye=null,Jt="";if(ae&&(ye=r.find(ft=>ft.id===ae),ye?Jt="direct_message_id_match":console.warn(`Message ID ${ae} not found in current messages array`)),ye||(ye=r.find(ft=>ft.text.includes(nt)),ye&&(Jt="exact_full_match")),ye||(ye=r.find(ft=>ft.text.includes(Ue)),ye&&(Jt="exact_text_match")),ye||(ye=r.find(ft=>Ue.includes(ft.text.trim())),ye&&(Jt="reverse_exact_match")),!ye){const ft=Ue.toLowerCase();ye=r.find(Zt=>Zt.text.toLowerCase().includes(ft)||ft.includes(Zt.text.toLowerCase())),ye&&(Jt="case_insensitive_match")}if(!ye){const ft=r.map(Zt=>({message:Zt,similarity:Be(Ue,Zt.text)})).filter(Zt=>Zt.similarity>.7).sort((Zt,ln)=>ln.similarity-Zt.similarity);ft.length>0&&(ye=ft[0].message,Jt=`fuzzy_match_${Math.round(ft[0].similarity*100)}%`)}if(!ye){const Zt=$e(Ue).split(" ").filter(ln=>ln.length>3);Zt.length>0&&(ye=r.find(ln=>{const hn=$e(ln.text);return Zt.every(Un=>hn.includes(Un))}),ye&&(Jt="partial_word_match"))}ye?(console.log(`Quote match found using strategy: ${Jt}`,{quoteType:Mt?"QuoteData":"string",providedMessageId:ae,extractedText:Ue,matchedMessage:ye.text.substring(0,100),matchedMessageId:ye.id,originalQuote:nt.substring(0,100)}),g("chat"),setTimeout(()=>{const ft=document.getElementById(`message-${ye.id}`);ft&&(T||ft.scrollIntoView({behavior:"smooth",block:"center"}),ft.style.backgroundColor="#fbbf24",ft.style.transition="background-color 0.3s ease",setTimeout(()=>{ft.style.backgroundColor=""},2e3))},100)):(console.warn("Quote match failed",{quoteType:Mt?"QuoteData":"string",providedMessageId:ae,originalQuote:nt.substring(0,100),extractedText:Ue.substring(0,100),totalMessages:r.length,messageSample:r.slice(0,3).map(ft=>({id:ft.id,text:ft.text.substring(0,50)}))}),Fe.warning("Message not found",{description:"Could not locate the original message for this quote. The quote may have been paraphrased by the AI."}))},St=te=>{l(ae=>{const Te=new Set(ae.map(Be=>Be.id)),$e=te.filter(Be=>!Te.has(Be.id));return[...ae,...$e]})},on=async te=>{if(!t)return;const ae=c.find(Te=>Te.id===te);if(ae)try{"source"in ae&&ae.source==="generated"&&await er.deleteKeyTheme(t,te),l(c.filter(Te=>Te.id!==te))}catch(Te){console.error("Error deleting theme:",Te),Fe.error("Failed to delete theme",{description:"There was an error removing the theme. Please try again."})}},dt=y.useCallback(async(te,ae)=>{if(t)try{await er.setModeratorPosition(t,te,ae),Fe.success("Moderator position updated",{description:"The moderator has been moved to the selected section."})}catch(Te){console.error("Error setting moderator position:",Te),Fe.error("Failed to update moderator position",{description:"There was an error updating the moderator position."})}},[t]),_n=y.useCallback(async te=>{if(console.log("šŸ’¾ handleDiscussionGuideSave called:",{hasId:!!t,isEditingGuideContent:E,timestamp:new Date().toISOString()}),!!t)try{await bt.update(t,{discussionGuide:te}),E?(M.current&&(M.current={...M.current,discussionGuide:te}),console.log("āš ļø Skipping focus group state update during editing to preserve focus")):(console.log("šŸ”„ Updating focus group state (not editing)"),d(ae=>ae?{...ae,discussionGuide:te}:null))}catch(ae){throw console.error("Error saving discussion guide:",ae),ae}},[t,E]),an=y.useCallback(te=>{console.log("šŸ”„ handleGuideEditingStateChange called:",{editing:te,timestamp:new Date().toISOString(),currentIsEditingGuideContent:E}),k(te),O(te),!te&&M.current&&(console.log("šŸ“ Updating focus group state after editing ended"),d(M.current))},[E]),rn=y.useCallback(()=>{j(te=>!te)},[]),yr=y.useCallback((te,ae,Te,$e,Be,Mt,Ue)=>{Q({isOpen:!0,sectionId:te,itemId:ae,content:Te,sectionTitle:$e,itemTitle:Be,itemType:Mt,metadata:Ue})},[]),Rs=()=>{if(m)return{sectionId:m.current_section_id,sectionTitle:m.current_section,itemId:m.current_item_id,itemTitle:m.current_item}},Xn=()=>{if(r.length!==0)return r[r.length-1].id},V=()=>{const te=Xn();if(!te||r.length===0)return new Date;const ae=r.find(Te=>Te.id===te);return ae?ae.timestamp:new Date},ve=async()=>{if(t){et(!0),Xe(!1),N(!1),Fe.info("Analyzing discussion for key themes...",{description:"This may take a moment as we process the entire conversation."});try{const te=await er.generateKeyThemes(t);te.data&&te.data.themes?(Xe(!0),Fe.success(`Generated ${te.data.themes.length} key themes`,{description:"New themes have been added to the analysis."}),l(ae=>[...ae,...te.data.themes])):(Xe(!0),Fe.warning("No new themes were generated",{description:"Try again when the discussion has more content."}))}catch(te){console.error("Error generating key themes:",te),N(!0),Fe.error("Failed to generate key themes",{description:"There was an error analyzing the discussion. Please try again."})}}},de=()=>{et(!1),Xe(!1),N(!1)},Ee=()=>{ue||we(new Date),ke(!0)},jt=te=>{D(ae=>[...ae,te].sort((Te,$e)=>$e.createdAt.getTime()-Te.createdAt.getTime())),window.notesPanelAddNote&&window.notesPanelAddNote(te)},Gn=te=>{const ae=r.find(Te=>Te.id===te);ae?(g("chat"),setTimeout(()=>{const Te=document.getElementById(`message-${ae.id}`);Te&&(T||Te.scrollIntoView({behavior:"smooth",block:"center"}),Te.style.backgroundColor="#fbbf24",Te.style.transition="background-color 0.3s ease",setTimeout(()=>{Te.style.backgroundColor=""},2e3))},100)):Fe.info("Message not found",{description:"Could not locate the original message for this note."})};y.useEffect(()=>{r.length>0&&!ue&&we(new Date)},[r.length,ue]),y.useEffect(()=>{I.current=T,T||Xt()},[T]);const as=te=>{ee(ae=>ae.includes(te)?ae.filter(Te=>Te!==te):[...ae,te])};return C?a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(ja,{}),a.jsxs("div",{className:"max-w-7xl mx-auto text-center py-12",children:[a.jsx("div",{className:"flex justify-center items-center",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}),a.jsx("p",{className:"mt-4 text-slate-600",children:"Loading focus group..."})]})]}):u?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(ja,{}),$&&a.jsx("div",{className:`w-full transition-all duration-300 ${ot?"bg-green-500":Ke?"bg-yellow-500":"bg-red-500"}`,children:a.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex items-center justify-between py-2 text-white text-sm font-medium",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("div",{className:`w-2 h-2 rounded-full ${ot?"bg-white animate-pulse":Ke?"bg-white animate-spin":"bg-white"}`}),a.jsx("span",{children:ot?"Real-time updates active - Changes appear instantly":Ke?"Connecting to real-time updates...":"Real-time updates unavailable - Using periodic refresh"}),_t&&a.jsx("span",{className:"text-xs opacity-75 ml-2",title:_t,children:"(Connection error)"})]}),a.jsx("button",{onClick:()=>z(!1),className:"ml-4 text-white hover:text-gray-200 transition-colors",title:"Hide status bar","aria-label":"Hide connection status",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}),!$&&a.jsx("div",{className:"fixed top-20 right-4 z-40",children:a.jsx("button",{onClick:()=>z(!0),className:`px-3 py-1 rounded-full text-white text-xs font-medium shadow-lg transition-all duration-200 hover:shadow-xl ${ot?"bg-green-500 hover:bg-green-600":Ke?"bg-yellow-500 hover:bg-yellow-600":"bg-red-500 hover:bg-red-600"}`,title:ot?"WebSocket connected - Show status bar":Ke?"WebSocket connecting - Show status bar":"WebSocket disconnected - Show status bar",children:a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx("div",{className:`w-2 h-2 rounded-full bg-white ${ot?"animate-pulse":""}`}),a.jsx("span",{children:ot?"Live":Ke?"Connecting":"Offline"})]})})}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-4",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(X,{variant:"ghost",onClick:()=>e("/focus-groups"),className:"mr-2",children:a.jsx(Wp,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-2xl font-bold text-slate-900",children:u.name}),a.jsx("p",{className:"text-slate-600",children:new Date(u.date).toLocaleString()}),a.jsxs("div",{className:"flex items-center mt-1",children:[a.jsx(xa,{className:"h-3 w-3 text-slate-500 mr-1"}),a.jsx(_r,{variant:"secondary",className:"text-xs",children:u.llm_model==="gpt-4.1"?"GPT-4.1":u.llm_model==="gpt-5"?"GPT-5":"Gemini 2.5 Pro"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-4 mt-4 sm:mt-0",children:[a.jsxs(X,{variant:"outline",onClick:()=>x(!b),className:b?"bg-blue-50 text-blue-600":"",children:[a.jsx(B_,{className:"mr-2 h-4 w-4"}),"AI Dashboard"]}),a.jsxs(X,{variant:"outline",onClick:()=>R(!0),children:[a.jsx(UE,{className:"mr-2 h-4 w-4"}),"AI Model"]}),a.jsxs(X,{variant:"outline",onClick:ut,children:[a.jsx(Jc,{className:"mr-2 h-4 w-4"}),"Download Transcript"]})]})]}),wt&&a.jsx("div",{className:"mb-6",children:a.jsx(GT,{isActive:wt,isComplete:Ct,hasError:nn,label:"Analyzing discussion for key themes",onComplete:de,className:"max-w-4xl mx-auto"})}),a.jsx(O$e,{discussionGuide:u.discussionGuide,moderatorStatus:m,onSectionSelect:dt,onSetPosition:yr,onSave:_n,focusGroupId:t||"",isOpen:A,onToggle:rn,onEditingChange:an}),a.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 h-[calc(100vh-12rem)]",children:[a.jsx(fde,{participants:f,selectedParticipantIds:Ae,onToggleParticipantFilter:as}),a.jsx("div",{className:"flex-1 flex flex-col",children:a.jsxs(hl,{defaultValue:"chat",value:p,onValueChange:g,className:"w-full h-full flex flex-col",children:[a.jsxs(Ka,{className:"grid grid-cols-4 mb-4",children:[a.jsxs(gn,{value:"chat",className:"flex items-center",children:[a.jsx(To,{className:"h-4 w-4 mr-2"}),"Discussion"]}),a.jsxs(gn,{value:"themes",className:"flex items-center",children:[a.jsx(hu,{className:"h-4 w-4 mr-2"}),"Key Themes"]}),a.jsxs(gn,{value:"notes",className:"flex items-center",children:[a.jsx(Wy,{className:"h-4 w-4 mr-2"}),"Notes"]}),a.jsxs(gn,{value:"analytics",className:"flex items-center",children:[a.jsx(B_,{className:"h-4 w-4 mr-2"}),"Analytics"]})]}),a.jsx(vn,{value:"chat",className:"m-0 flex-1 flex flex-col h-0",children:r.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[a.jsx("p",{className:"text-lg text-slate-600",children:"No messages yet. Start the session to begin the discussion."}),a.jsxs(X,{onClick:ra,size:"lg",className:"flex items-center gap-2",children:[a.jsx(d5,{className:"h-5 w-5"}),"Start Session"]})]}):a.jsx(Bde,{messages:r,modeEvents:s,personas:f,isSpeaking:!1,focusGroupId:t||"",isAiModeActive:w,selectedParticipantIds:Ae,onToggleHighlight:Ie,onAdvanceDiscussion:()=>null,onNewMessage:W,onStatusChange:Je,isEditingDiscussionGuide:T})}),a.jsx(vn,{value:"themes",className:"m-0",children:a.jsx(zde,{themes:c,messages:r,personas:f,focusGroupId:t||"",onThemesGenerated:St,onThemeDelete:on,onQuoteClick:tt,onGenerateKeyThemes:ve})}),a.jsx(vn,{value:"notes",className:"m-0",style:{height:"calc(100% - 3.5rem)"},children:a.jsx("div",{className:"h-full",children:a.jsx(I$e,{focusGroupId:t||"",focusGroupName:u==null?void 0:u.name,onNoteClick:Gn})})}),a.jsx(vn,{value:"analytics",className:"m-0",children:a.jsx(N$e,{messages:r,themes:c,personas:f})})]})})]})]}),r.length>0&&a.jsx("div",{className:"fixed bottom-6 right-6 z-40",children:a.jsx(X,{onClick:Ee,className:"rounded-full h-12 w-12 p-0 shadow-lg",title:"Take a quick note",children:a.jsx(Wy,{className:"h-5 w-5"})})}),a.jsx(R$e,{isOpen:le,onClose:()=>ke(!1),focusGroupId:t||"",associatedMessageId:Xn(),sectionInfo:Rs(),messageTimestamp:V(),onNoteSaved:jt}),a.jsx(eu,{open:G.isOpen,onOpenChange:te=>Q(ae=>({...ae,isOpen:te})),children:a.jsxs(Lc,{children:[a.jsxs(Fc,{children:[a.jsx(Bc,{children:"Set Moderator Position"}),a.jsxs(tu,{children:['Are you sure you want to set the moderator position to "',G.itemTitle,'" in section "',G.sectionTitle,'"? This will make the moderator ask this question in the chat.']})]}),a.jsxs(Uc,{children:[a.jsx(X,{variant:"outline",disabled:G.isLoading,onClick:()=>Q({isOpen:!1}),children:"Cancel"}),a.jsxs(X,{disabled:G.isLoading,onClick:async()=>{var te,ae,Te,$e,Be,Mt,Ue,nt,ye,Jt;if(!(!t||!G.sectionId||!G.itemId||!G.content)){Q(ft=>({...ft,isLoading:!0}));try{await er.setModeratorPosition(t,G.sectionId,G.itemId);let ft=[],Zt=!1,ln=G.content;const hn=(te=G.metadata)==null?void 0:te.visual_asset,Un=!!(hn!=null&&hn.filename),kr=hn==null?void 0:hn.filename;if(console.log("šŸ” MANUAL POSITION DEBUG:",{itemType:G.itemType,hasImageAttached:Un,visualAsset:hn,assetFilename:kr,content:G.content,sectionTitle:G.sectionTitle,itemTitle:G.itemTitle,contentLength:(ae=G.content)==null?void 0:ae.length}),Un&&G.content&&kr)if(console.log("šŸ” VISUAL ASSET DEBUG:",{originalContent:G.content,visualAsset:hn,displayReference:hn==null?void 0:hn.display_reference,filename:kr,contentLength:G.content.length}),kr){ft=[kr],Zt=!0,console.log("šŸŽØ MANUAL POSITION: Creative review detected, will activate visual context for:",kr);try{console.log("šŸŽØ MANUAL MODE: Requesting AI description for",kr);const En=await bt.describeAsset(t,kr);if(En.data.description){const lk=(hn==null?void 0:hn.display_reference)||"the asset";ln=G.content.replace(lk,`${lk} - ${En.data.description}`),console.log("āœ… MANUAL MODE: Enhanced question with AI description"),console.log("šŸ” Original:",G.content),console.log("šŸ” Enhanced:",ln)}}catch(En){console.error("āš ļø MANUAL MODE: Failed to generate AI description:",En),console.error("āš ļø Error response data:",(Te=En.response)==null?void 0:Te.data),console.error("āš ļø Error status:",($e=En.response)==null?void 0:$e.status),console.error("āš ļø Error headers:",(Be=En.response)==null?void 0:Be.headers),console.error("āš ļø Full axios error:",{message:En.message,code:En.code,status:(Mt=En.response)==null?void 0:Mt.status,statusText:(Ue=En.response)==null?void 0:Ue.statusText,url:(nt=En.config)==null?void 0:nt.url,method:(ye=En.config)==null?void 0:ye.method}),Fe.warning("AI description failed",{description:"Using original question text. Image will still be available to participants."})}}else console.warn("āš ļø MANUAL POSITION: Creative review detected but no asset filename extracted from content");const xl={id:`msg-${Date.now()}`,senderId:"moderator",text:ln,timestamp:new Date,type:"question",visualAsset:Un&&hn?{filename:kr,displayReference:hn.display_reference}:void 0};console.log("šŸ“¤ Sending moderator message to API:",{text:ln,attachedAssets:ft,activatesVisualContext:Zt});try{const En=await bt.sendMessage(t,{senderId:"moderator",text:ln,type:"question",attached_assets:ft,activates_visual_context:Zt,visualAsset:Un&&hn?{filename:kr,displayReference:hn.display_reference}:void 0});(Jt=En==null?void 0:En.data)!=null&&Jt.message_id?(xl.id=En.data.message_id,console.log("āœ… Message API call successful, assigned ID:",xl.id)):console.warn("āš ļø Message API call succeeded but no message_id returned:",En==null?void 0:En.data)}catch(En){console.error("āŒ Failed to save message to API:",En),Fe.warning("Message display only",{description:"The moderator message is shown locally but may not be saved to the server."})}console.log("šŸ“Ø Adding moderator message to UI:",{messageId:xl.id,text:xl.text,hasAssets:ft.length>0}),W(xl),Q({isOpen:!1}),console.log("āœ… Set position complete, moderator message added to UI"),Fe.success("Moderator position set",{description:`Position set to "${G.itemTitle}" in "${G.sectionTitle}"`})}catch(ft){console.error("Error setting moderator position:",ft),Q(Zt=>({...Zt,isLoading:!1})),Fe.error("Failed to set moderator position",{description:"There was an error setting the moderator position."})}}},className:"flex items-center gap-2",children:[G.isLoading&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),G.isLoading?"Generating detailed image description...":"Confirm"]})]})]})}),a.jsx(eu,{open:B,onOpenChange:R,children:a.jsxs(Lc,{children:[a.jsxs(Fc,{children:[a.jsx(Bc,{children:"AI Model Settings"}),a.jsx(tu,{children:"Choose which AI model to use for generating responses and discussion guides in this focus group."})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(xa,{className:"h-4 w-4 text-slate-500"}),a.jsx("span",{className:"text-sm font-medium",children:"Current Model:"}),a.jsx(_r,{variant:"secondary",children:(u==null?void 0:u.llm_model)==="gpt-4.1"?"GPT-4.1":(u==null?void 0:u.llm_model)==="gpt-5"?"GPT-5":"Gemini 2.5 Pro"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Select AI Model:"}),a.jsxs(Bn,{value:L,onValueChange:te=>{console.log("šŸ”§ Model selection changed:",{from:L,to:te}),Y(te)},children:[a.jsx($n,{className:"mt-1",children:a.jsx(Hn,{placeholder:"Select AI model"})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(ie,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(ie,{value:"gpt-5",children:"GPT-5"})]})]})]}),L==="gpt-5"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Reasoning Effort:"}),a.jsxs(Bn,{value:q,onValueChange:J,children:[a.jsx($n,{className:"mt-1",children:a.jsx(Hn,{placeholder:"Select reasoning effort"})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"minimal",children:"Minimal - Fast responses"}),a.jsx(ie,{value:"low",children:"Low - Quick thinking"}),a.jsx(ie,{value:"medium",children:"Medium - Balanced (default)"}),a.jsx(ie,{value:"high",children:"High - Deep reasoning"})]})]}),a.jsx("p",{className:"text-xs text-slate-600 mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx("p",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how thoroughly GPT-5 thinks and how detailed responses are"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Response Verbosity:"}),a.jsxs(Bn,{value:me,onValueChange:F,children:[a.jsx($n,{className:"mt-1",children:a.jsx(Hn,{placeholder:"Select verbosity level"})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"low",children:"Low - Concise responses"}),a.jsx(ie,{value:"medium",children:"Medium - Balanced length (default)"}),a.jsx(ie,{value:"high",children:"High - Detailed responses"})]})]}),a.jsx("p",{className:"text-xs text-slate-600 mt-1",children:"Controls how detailed and lengthy GPT-5's responses will be"}),a.jsx("p",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how thoroughly GPT-5 thinks and how detailed responses are"})]})]}),a.jsxs("div",{className:"text-xs text-slate-600",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Gemini 2.5 Pro:"})," Google's advanced model, great for creative and analytical tasks."]}),a.jsxs("p",{children:[a.jsx("strong",{children:"GPT-4.1:"})," OpenAI's latest model, excellent for conversational and reasoning tasks."]}),a.jsxs("p",{children:[a.jsx("strong",{children:"GPT-5:"})," OpenAI's newest model with advanced reasoning and customizable response styles."]})]})]}),a.jsxs(Uc,{children:[a.jsx(X,{variant:"outline",onClick:()=>R(!1),disabled:oe,children:"Cancel"}),a.jsxs(X,{onClick:()=>{console.log("šŸ”§ Update button clicked:",{selectedModel:L,selectedReasoningEffort:q,selectedVerbosity:me,currentModel:u==null?void 0:u.llm_model,isDisabled:oe||L===(u==null?void 0:u.llm_model)&&(L!=="gpt-5"||q===(u==null?void 0:u.reasoning_effort)&&me===(u==null?void 0:u.verbosity))}),fn(L,q,me)},disabled:oe||L===(u==null?void 0:u.llm_model)&&(L!=="gpt-5"||q===((u==null?void 0:u.reasoning_effort)||"medium")&&me===((u==null?void 0:u.verbosity)||"medium")),children:[oe&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),oe?"Updating...":"Update Model"]})]})]})}),a.jsx(k$e,{focusGroupId:t,personas:f,isVisible:b,onToggle:()=>x(!b)})]}):a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(ja,{}),a.jsxs("div",{className:"max-w-7xl mx-auto text-center py-12",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Focus group not found"}),a.jsx("p",{className:"mt-2 text-slate-600",children:"We couldn't find the focus group you're looking for."}),a.jsxs(X,{onClick:()=>e("/focus-groups"),className:"mt-4",children:[a.jsx(Wp,{className:"mr-2 h-4 w-4"})," Back to Focus Groups"]})]})]})},ILe=({title:t,description:e})=>a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:t}),a.jsx("p",{className:"text-slate-600 mt-1",children:e})]}),a.jsxs("div",{className:"mt-4 sm:mt-0 flex gap-2",children:[a.jsx(X,{variant:"outline",children:"Export Data"}),a.jsx(X,{children:"Generate Report"})]})]}),RC=({title:t,value:e,changePercentage:n,icon:r})=>a.jsx(lt,{className:"p-6 hover:shadow-md transition-shadow",children:a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-muted-foreground text-sm",children:t}),a.jsx("h3",{className:"text-2xl font-bold mt-1",children:e}),a.jsxs("p",{className:`${n>=0?"text-green-500":"text-red-500"} text-xs mt-1`,children:[n>=0?"↑":"↓"," ",Math.abs(n),"% from last month"]})]}),a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:a.jsx(r,{className:"h-6 w-6 text-primary"})})]})}),RLe=[{name:"Jan",users:20,groups:3,interactions:120},{name:"Feb",users:25,groups:4,interactions:160},{name:"Mar",users:30,groups:5,interactions:220},{name:"Apr",users:40,groups:6,interactions:280},{name:"May",users:45,groups:7,interactions:350},{name:"Jun",users:48,groups:7,interactions:420}],MLe=[{id:"1",title:"User Interface Feedback",description:"Users consistently mentioned difficulty with the navigation menu on mobile devices.",source:"Mobile App Focus Group",date:"2023-06-12",sentiment:"negative"},{id:"2",title:"Feature Adoption",description:'The new search functionality is well-received, with 85% of users rating it as "very useful".',source:"Product Testing Group",date:"2023-06-10",sentiment:"positive"},{id:"3",title:"Pricing Strategy",description:"Price-conscious users expressed willingness to pay up to 20% more for premium features.",source:"Pricing Model Analysis",date:"2023-06-08",sentiment:"positive"},{id:"4",title:"Competitive Analysis",description:"Users who switched from competitor products cited our streamlined onboarding as a key factor.",source:"Customer Journey Mapping",date:"2023-06-05",sentiment:"positive"}],DLe=()=>a.jsxs("div",{className:"space-y-6",children:[a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Research Activity"}),a.jsx("div",{className:"h-64",children:a.jsx(zc,{width:"100%",height:"100%",children:a.jsxs(wW,{data:RLe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(ig,{strokeDasharray:"3 3"}),a.jsx(sl,{dataKey:"name"}),a.jsx(ol,{}),a.jsx(ni,{}),a.jsx(so,{type:"monotone",dataKey:"users",stackId:"1",stroke:"#8884d8",fill:"#8884d8",name:"Synthetic Users"}),a.jsx(so,{type:"monotone",dataKey:"groups",stackId:"2",stroke:"#82ca9d",fill:"#82ca9d",name:"Focus Groups"}),a.jsx(so,{type:"monotone",dataKey:"interactions",stackId:"3",stroke:"#ffc658",fill:"#ffc658",name:"Interactions"})]})})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Recent AI Insights"}),a.jsxs("div",{className:"space-y-4",children:[MLe.slice(0,3).map(t=>a.jsx("div",{className:"border-b pb-4 last:border-b-0 last:pb-0",children:a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:`p-2 rounded-full mr-3 ${t.sentiment==="positive"?"bg-green-100":t.sentiment==="negative"?"bg-red-100":"bg-slate-100"}`,children:a.jsx(du,{className:`h-4 w-4 ${t.sentiment==="positive"?"text-green-600":t.sentiment==="negative"?"text-red-600":"text-slate-600"}`})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:t.title}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.description}),a.jsxs("div",{className:"flex items-center text-xs text-muted-foreground mt-2",children:[a.jsx("span",{children:t.source}),a.jsx("span",{className:"mx-2",children:"•"}),a.jsx("span",{children:t.date})]})]})]})},t.id)),a.jsx(X,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"View All Insights"})]})]}),a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Upcoming Research Tasks"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-blue-100 p-2 rounded-full mr-3",children:a.jsx(uv,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Website Redesign Feedback"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Focus group scheduled for Jun 20"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-purple-100 p-2 rounded-full mr-3",children:a.jsx(uv,{className:"h-4 w-4 text-purple-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Mobile App User Testing"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"8 participants needed by Jun 25"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-amber-100 p-2 rounded-full mr-3",children:a.jsx(uv,{className:"h-4 w-4 text-amber-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Pricing Strategy Evaluation"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Create discussion guide by Jun 22"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-green-100 p-2 rounded-full mr-3",children:a.jsx(uv,{className:"h-4 w-4 text-green-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Product Onboarding Flow"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Results analysis due Jun 30"})]})]}),a.jsx(X,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"Manage Research Calendar"})]})]})]})]}),$Le=[{name:"18-24",value:15},{name:"25-34",value:35},{name:"35-44",value:25},{name:"45-54",value:15},{name:"55+",value:10}],LLe=()=>a.jsxs(lt,{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold",children:"Synthetic Persona Analytics"}),a.jsx(X,{variant:"outline",size:"sm",children:"View Demographics"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Persona Demographics"}),a.jsx("div",{className:"h-60",children:a.jsx(zc,{width:"100%",height:"100%",children:a.jsxs(rk,{children:[a.jsx(ni,{}),a.jsx(bo,{data:$Le,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,fill:"#FFDEE2",label:!0})]})})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Persona Distribution"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Age: 25-34"}),a.jsx("span",{children:"35%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-400 rounded-full",style:{width:"35%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Tech Savvy"}),a.jsx("span",{children:"72%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-300 rounded-full",style:{width:"72%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Brand Loyal"}),a.jsx("span",{children:"58%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-500 rounded-full",style:{width:"58%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Price Sensitive"}),a.jsx("span",{children:"67%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-200 rounded-full",style:{width:"67%"}})})]})]})]})]}),a.jsx("div",{className:"flex justify-center mt-6",children:a.jsx(X,{onClick:()=>window.location.href="/synthetic-users",children:"Manage Synthetic Personas"})})]}),FLe=[{name:"Jan",users:20,groups:3,interactions:120},{name:"Feb",users:25,groups:4,interactions:160},{name:"Mar",users:30,groups:5,interactions:220},{name:"Apr",users:40,groups:6,interactions:280},{name:"May",users:45,groups:7,interactions:350},{name:"Jun",users:48,groups:7,interactions:420}],F$=[{name:"Very Positive",value:25,color:"#4ade80"},{name:"Positive",value:40,color:"#a3e635"},{name:"Neutral",value:20,color:"#93c5fd"},{name:"Negative",value:10,color:"#fb923c"},{name:"Very Negative",value:5,color:"#f87171"}],ULe=[{name:"Navigation",count:42},{name:"Performance",count:28},{name:"UX Design",count:36},{name:"Features",count:22},{name:"Onboarding",count:18}],BLe=()=>{const t=lr();return a.jsxs(lt,{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold",children:"Focus Group Insights"}),a.jsx(X,{variant:"outline",size:"sm",onClick:()=>t("/focus-groups"),children:"View All Sessions"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Session Analytics"}),a.jsx("div",{className:"h-60",children:a.jsx(zc,{width:"100%",height:"100%",children:a.jsxs(wW,{data:FLe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(ig,{strokeDasharray:"3 3"}),a.jsx(sl,{dataKey:"name"}),a.jsx(ol,{}),a.jsx(ni,{}),a.jsx(so,{type:"monotone",dataKey:"interactions",stroke:"#8884d8",fill:"#8884d8",name:"User Interactions"})]})})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Feedback Sentiment"}),a.jsx("div",{className:"h-60",children:a.jsx(zc,{width:"100%",height:"100%",children:a.jsxs(rk,{children:[a.jsx(ni,{}),a.jsx(bo,{data:F$,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:e,percent:n})=>`${e} ${(n*100).toFixed(0)}%`,children:F$.map((e,n)=>a.jsx(Rg,{fill:e.color},`cell-${n}`))}),a.jsx(Na,{})]})})})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Topic Frequency Analysis"}),a.jsx("div",{className:"h-60",children:a.jsx(zc,{width:"100%",height:"100%",children:a.jsxs(bW,{data:ULe,margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(ig,{strokeDasharray:"3 3"}),a.jsx(sl,{dataKey:"name"}),a.jsx(ol,{}),a.jsx(ni,{}),a.jsx(Na,{}),a.jsx(yl,{dataKey:"count",name:"Mentions",fill:"#8884d8"})]})})})]}),a.jsx("div",{className:"flex justify-center",children:a.jsx(X,{onClick:()=>t("/focus-groups"),children:"Manage Focus Groups"})})]})},HLe=()=>{const[t,e]=y.useState("overview");return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(ja,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsx(ILe,{title:"Dashboard",description:"Monitor and analyze your research insights"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-8",children:[a.jsx(RC,{title:"Total Synthetic Users",value:48,changePercentage:12,icon:Fr}),a.jsx(RC,{title:"Active Focus Groups",value:7,changePercentage:5,icon:Wo}),a.jsx(RC,{title:"Research Insights",value:124,changePercentage:18,icon:hu})]}),a.jsxs(hl,{value:t,onValueChange:e,className:"glass-panel rounded-xl p-6",children:[a.jsxs(Ka,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(gn,{value:"overview",children:"Overview"}),a.jsx(gn,{value:"users",children:"Synthetic Users"}),a.jsx(gn,{value:"focus-groups",children:"Focus Groups"})]}),a.jsx(vn,{value:"overview",children:a.jsx(DLe,{})}),a.jsx(vn,{value:"users",children:a.jsx(LLe,{})}),a.jsx(vn,{value:"focus-groups",children:a.jsx(BLe,{})})]})]})]})},LW=y.forwardRef(({...t},e)=>a.jsx("nav",{ref:e,"aria-label":"breadcrumb",...t}));LW.displayName="Breadcrumb";const FW=y.forwardRef(({className:t,...e},n)=>a.jsx("ol",{ref:n,className:Pe("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...e}));FW.displayName="BreadcrumbList";const py=y.forwardRef(({className:t,...e},n)=>a.jsx("li",{ref:n,className:Pe("inline-flex items-center gap-1.5",t),...e}));py.displayName="BreadcrumbItem";const vj=y.forwardRef(({asChild:t,className:e,...n},r)=>{const i=t?Go:"a";return a.jsx(i,{ref:r,className:Pe("transition-colors hover:text-foreground",e),...n})});vj.displayName="BreadcrumbLink";const UW=y.forwardRef(({className:t,...e},n)=>a.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:Pe("font-normal text-foreground",t),...e}));UW.displayName="BreadcrumbPage";const yj=({children:t,className:e,...n})=>a.jsx("li",{role:"presentation","aria-hidden":"true",className:Pe("[&>svg]:size-3.5",e),...n,children:t??a.jsx(fs,{})});yj.displayName="BreadcrumbSeparator";function zLe({persona:t}){const e=t.id==="0",n=t.id==="1";return a.jsxs(lt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx("div",{className:"h-16 w-16 rounded-full bg-muted flex items-center justify-center",children:a.jsx("img",{src:Ag(t),alt:t.name,className:"h-16 w-16 rounded-full object-cover"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-sf text-xl font-semibold",children:t.name}),a.jsx("p",{className:"text-muted-foreground",children:t.occupation})]})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Fr,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Demographics"}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[t.age," ",t.gender?a.jsxs(a.Fragment,{children:["• ",t.gender]}):null,t.ethnicity?a.jsxs(a.Fragment,{children:[" • ",t.ethnicity]}):null]}),t.education&&a.jsx("p",{className:"sidebar-sub-item",children:t.education}),t.socialGrade&&a.jsxs("p",{className:"sidebar-sub-item",children:["Social Grade: ",t.socialGrade]}),t.householdIncome&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household Income: ",t.householdIncome]}),t.householdComposition&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household: ",t.householdComposition]})]})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(rZ,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Location"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.location}),t.livingSituation&&a.jsx("p",{className:"sidebar-sub-item",children:t.livingSituation})]})]}),t.interests&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(V_,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Interests"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.interests})]})]}),t.mediaConsumption&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(RS,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Media"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.mediaConsumption})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-sm mb-3",children:"Digital Behavior"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Tech Savviness"}),a.jsxs("span",{children:[t.techSavviness,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-blue-500 rounded-full",style:{width:`${t.techSavviness}%`}})})]}),t.brandLoyalty!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Brand Loyalty"}),a.jsxs("span",{children:[t.brandLoyalty,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-purple-500 rounded-full",style:{width:`${t.brandLoyalty}%`}})})]}),t.priceConsciousness!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Price Sensitivity"}),a.jsxs("span",{children:[t.priceConsciousness,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-amber-500 rounded-full",style:{width:`${t.priceConsciousness}%`}})})]}),t.environmentalConcern!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Environmental Concern"}),a.jsxs("span",{children:[t.environmentalConcern,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:`${t.environmentalConcern}%`}})})]}),t.deviceUsage&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-medium mt-3",children:"Device Usage"}),a.jsx("p",{className:"sidebar-sub-item text-xs",children:t.deviceUsage})]}),t.shoppingHabits&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-medium mt-3",children:"Shopping Habits"}),a.jsx("p",{className:"sidebar-sub-item text-xs",children:t.shoppingHabits})]})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-sm mb-3",children:"Additional Information"}),a.jsxs("div",{className:"space-y-2",children:[t.brandPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(V_,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.brandPreferences})]}),t.communicationPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Qp,{className:"sidebar-icon"}),a.jsxs("span",{className:"text-muted-foreground text-sm",children:["Prefers: ",t.communicationPreferences]})]}),t.deviceUsage&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(sZ,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.deviceUsage})]}),t.shoppingHabits&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(lZ,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.shoppingHabits})]}),t.additionalInformation&&typeof t.additionalInformation=="string"&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(ZJ,{className:"sidebar-icon"}),a.jsx("div",{className:"sidebar-sub-item",children:t.additionalInformation.split(` +`).map((r,i)=>a.jsx("div",{className:"mb-1",children:r.trim().startsWith("•")||r.trim().startsWith("-")?r.trim().substring(1).trim():r.trim()},i))})]}),e&&a.jsxs("div",{className:"pt-2 space-y-2",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(XO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Maintains an extensive network of financial and luxury industry contacts"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Ky,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Owns vacation properties in the Cotswolds and South of France"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(RS,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Collector of rare first-edition books and limited-edition art prints"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(JO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Significant investment portfolio with focus on sustainable luxury ventures"})]})]}),n&&a.jsxs("div",{className:"pt-2 space-y-2",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(RS,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Active in industry panels, luxury brand collaborations, follows influencers in luxury & design"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Ky,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Modern flat in exclusive Chelsea, accessible to boutique services"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(JO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Uses premium digital payment & secure banking for HNWIs"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(XO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Respected network in London's luxury sector; attends exclusive events"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Qp,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Seeks autonomy, bespoke service, and acknowledgment for taste"})]})]})]})]})]})]})}function VLe({persona:t}){var e,n,r,i,s,o,c,l,u;return a.jsxs("div",{className:"space-y-6",children:[a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(Xv,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Goals"})]}),a.jsx("ul",{className:"space-y-2",children:(e=t.goals)==null?void 0:e.map((d,f)=>a.jsxs("li",{className:"flex items-start",children:[a.jsx("div",{className:"h-5 w-5 rounded-full bg-primary/10 flex items-center justify-center mt-0.5 mr-3",children:a.jsx("span",{className:"text-xs text-primary font-medium",children:f+1})}),a.jsx("p",{className:"text-sm",children:d})]},f))})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(p5,{className:"h-5 w-5 text-amber-500 mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Frustrations"})]}),a.jsx("ul",{className:"space-y-2",children:(n=t.frustrations)==null?void 0:n.map((d,f)=>a.jsxs("li",{className:"text-sm flex items-start",children:[a.jsx("span",{className:"text-amber-500 mr-2",children:"•"}),a.jsx("span",{children:d})]},f))})]})}),a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(ma,{className:"h-5 w-5 text-green-500 mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Motivations"})]}),a.jsx("ul",{className:"space-y-2",children:(r=t.motivations)==null?void 0:r.map((d,f)=>a.jsxs("li",{className:"text-sm flex items-start",children:[a.jsx("span",{className:"text-green-500 mr-2",children:"•"}),a.jsx("span",{children:d})]},f))})]})})]}),a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(du,{className:"h-5 w-5 text-blue-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Thinks"})]}),a.jsx("ul",{className:"space-y-2",children:(s=(i=t.thinkFeelDo)==null?void 0:i.thinks)==null?void 0:s.map((d,f)=>a.jsxs("li",{className:"text-sm bg-blue-50 p-2 rounded-md",children:['"',d,'"']},f))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(V_,{className:"h-5 w-5 text-red-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Feels"})]}),a.jsx("ul",{className:"space-y-2",children:(c=(o=t.thinkFeelDo)==null?void 0:o.feels)==null?void 0:c.map((d,f)=>a.jsxs("li",{className:"text-sm bg-red-50 p-2 rounded-md",children:['"',d,'"']},f))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(ma,{className:"h-5 w-5 text-green-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Does"})]}),a.jsx("ul",{className:"space-y-2",children:(u=(l=t.thinkFeelDo)==null?void 0:l.does)==null?void 0:u.map((d,f)=>a.jsxs("li",{className:"text-sm bg-green-50 p-2 rounded-md",children:['"',d,'"']},f))})]})]})]})})]})}function GLe({persona:t}){var n,r,i,s,o;const e=[{trait:"Openness",value:((n=t.oceanTraits)==null?void 0:n.openness)||50},{trait:"Conscientiousness",value:((r=t.oceanTraits)==null?void 0:r.conscientiousness)||50},{trait:"Extraversion",value:((i=t.oceanTraits)==null?void 0:i.extraversion)||50},{trait:"Agreeableness",value:((s=t.oceanTraits)==null?void 0:s.agreeableness)||50},{trait:"Neuroticism",value:((o=t.oceanTraits)==null?void 0:o.neuroticism)||50}];return a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx("div",{className:"h-80",children:a.jsx(zc,{width:"100%",height:"100%",children:a.jsxs(E$e,{outerRadius:90,data:e,children:[a.jsx(gK,{}),a.jsx(dh,{dataKey:"trait"}),a.jsx(uh,{domain:[0,100]}),a.jsx(Ug,{name:"Personality",dataKey:"value",stroke:"#8884d8",fill:"#8884d8",fillOpacity:.5})]})})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Openness to Experience"}),a.jsxs("span",{className:"font-medium",children:[e[0].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-purple-500 rounded-full",style:{width:`${e[0].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[0].value>75?"Highly creative and curious":e[0].value>50?"Somewhat imaginative and open to new ideas":"Practical and prefers routine"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Conscientiousness"}),a.jsxs("span",{className:"font-medium",children:[e[1].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-blue-500 rounded-full",style:{width:`${e[1].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[1].value>75?"Highly organized and responsible":e[1].value>50?"Generally reliable and hardworking":"Spontaneous and flexible"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Extraversion"}),a.jsxs("span",{className:"font-medium",children:[e[2].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:`${e[2].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[2].value>75?"Highly sociable and outgoing":e[2].value>50?"Moderately social and talkative":"Reserved and reflective"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Agreeableness"}),a.jsxs("span",{className:"font-medium",children:[e[3].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-amber-500 rounded-full",style:{width:`${e[3].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[3].value>75?"Highly cooperative and compassionate":e[3].value>50?"Generally kind and helpful":"Competitive and challenging"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Neuroticism"}),a.jsxs("span",{className:"font-medium",children:[e[4].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-red-500 rounded-full",style:{width:`${e[4].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[4].value>75?"Highly sensitive and prone to stress":e[4].value>50?"Moderately reactive to challenges":"Emotionally stable and resilient"})]})]})]})]})})}function KLe({persona:t}){var r;const e=(i,s)=>{const o=[a.jsx(tZ,{className:"sidebar-icon"},"grid"),a.jsx(uZ,{className:"sidebar-icon"},"smartphone"),a.jsx(eZ,{className:"sidebar-icon"},"laptop"),a.jsx(JJ,{className:"sidebar-icon"},"grid2x2")];return o[s%o.length]},n=()=>t.scenarioType?t.scenarioType:"Life Scenarios";return a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:n()}),a.jsx("div",{className:"space-y-4",children:(r=t.scenarios)==null?void 0:r.map((i,s)=>a.jsx("div",{className:"bg-slate-50 p-4 rounded-lg border",children:a.jsxs("div",{className:"sidebar-section",children:[e(i,s),a.jsxs("div",{children:[a.jsxs("h4",{className:"font-medium text-sm mb-2",children:["Scenario ",s+1]}),a.jsx("p",{className:"text-sm",children:i})]})]})},s))})]})})}function WLe(){const t=lr();return a.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:a.jsxs(lt,{className:"w-96 text-center p-6",children:[a.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Persona Not Found"}),a.jsx("p",{className:"text-muted-foreground mb-6",children:"The persona you're looking for couldn't be found."}),a.jsx(X,{onClick:()=>t("/synthetic-users"),children:"Return to Personas"})]})})}function Ut({className:t,...e}){return a.jsx("div",{className:Pe("animate-pulse rounded-md bg-muted",t),...e})}function qLe(){return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(ja,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex items-center mb-6 relative",children:[a.jsx(Ut,{className:"absolute left-0 top-0 h-10 w-20"}),a.jsx(Ut,{className:"h-8 w-48 mx-auto"}),a.jsx(Ut,{className:"absolute right-0 top-0 h-10 w-32"})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mt-10",children:[a.jsx("div",{className:"lg:col-span-1",children:a.jsxs(lt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx(Ut,{className:"h-16 w-16 rounded-full"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Ut,{className:"h-6 w-32 mb-2"}),a.jsx(Ut,{className:"h-4 w-24"})]})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"flex items-start",children:[a.jsx(Ut,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Ut,{className:"h-4 w-20 mb-2"}),a.jsx(Ut,{className:"h-3 w-40 mb-1"}),a.jsx(Ut,{className:"h-3 w-36"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Ut,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Ut,{className:"h-4 w-16 mb-2"}),a.jsx(Ut,{className:"h-3 w-32"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Ut,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Ut,{className:"h-4 w-16 mb-2"}),a.jsx(Ut,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Ut,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Ut,{className:"h-4 w-12 mb-2"}),a.jsx(Ut,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(Ut,{className:"h-4 w-32 mb-3"}),a.jsx("div",{className:"space-y-3",children:[...Array(4)].map((t,e)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx(Ut,{className:"h-3 w-24"}),a.jsx(Ut,{className:"h-3 w-8"})]}),a.jsx(Ut,{className:"h-1.5 w-full rounded-full"})]},e))})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(Ut,{className:"h-4 w-36 mb-3"}),a.jsx("div",{className:"space-y-2",children:[...Array(3)].map((t,e)=>a.jsxs("div",{className:"flex items-center",children:[a.jsx(Ut,{className:"h-4 w-4 mr-2"}),a.jsx(Ut,{className:"h-3 w-40"})]},e))})]})]})]})}),a.jsxs("div",{className:"lg:col-span-2",children:[a.jsxs("div",{className:"grid w-full grid-cols-3 gap-2 mb-6",children:[a.jsx(Ut,{className:"h-10 w-full"}),a.jsx(Ut,{className:"h-10 w-full"}),a.jsx(Ut,{className:"h-10 w-full"})]}),a.jsx(lt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(Ut,{className:"h-6 w-48"}),a.jsx(Ut,{className:"h-4 w-full"}),a.jsx(Ut,{className:"h-4 w-full"}),a.jsx(Ut,{className:"h-4 w-3/4"}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(Ut,{className:"h-6 w-32"}),a.jsx(Ut,{className:"h-4 w-full"}),a.jsx(Ut,{className:"h-4 w-full"}),a.jsx(Ut,{className:"h-4 w-2/3"})]}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(Ut,{className:"h-6 w-40"}),a.jsx(Ut,{className:"h-4 w-full"}),a.jsx(Ut,{className:"h-4 w-full"}),a.jsx(Ut,{className:"h-4 w-5/6"})]})]})})]})]})]})]})}function YLe({message:t,onLoginSuccess:e,onCancel:n}){const{login:r}=Zo(),i=lr(),[s,o]=y.useState("user"),[c,l]=y.useState("pass"),[u,d]=y.useState(!1),f=async()=>{if(!s||!c){ne.error("Please enter username and password");return}d(!0);try{await r(s,c),ne.success("Login successful"),e&&e()}catch(p){console.error("Login error:",p),ne.error("Login failed",{description:"Please check your credentials and try again"})}finally{d(!1)}},h=()=>{n?n():i("/synthetic-users")};return a.jsxs(lt,{className:"max-w-md mx-auto shadow-lg",children:[a.jsxs(Ei,{children:[a.jsx(Yi,{children:"Login Required"}),a.jsx(fT,{children:t||"You need to log in to save personas to the database"})]}),a.jsxs(Ot,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(ms,{htmlFor:"username",children:"Username"}),a.jsx(Ht,{id:"username",placeholder:"Username",value:s,onChange:p=>o(p.target.value),disabled:u})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(ms,{htmlFor:"password",children:"Password"}),a.jsx(Ht,{id:"password",type:"password",placeholder:"Password",value:c,onChange:p=>l(p.target.value),disabled:u})]}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Default credentials: user / pass"})]}),a.jsxs(hT,{className:"flex justify-between",children:[a.jsx(X,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(X,{onClick:f,disabled:u,children:u?a.jsxs(a.Fragment,{children:[a.jsx(eo,{className:"h-4 w-4 mr-2 animate-spin"}),"Logging in..."]}):"Login"})]})]})}function QLe({persona:t,onSave:e,onCancel:n}){var j,T,k,I,E,O,M,U,D,B,R,L,Y,q,J,me;const r={...t,education:t.education||"",interests:t.interests||"",brandLoyalty:t.brandLoyalty||0,priceConsciousness:t.priceConsciousness||0,environmentalConcern:t.environmentalConcern||0,hasPurchasingPower:t.hasPurchasingPower||!1,hasChildren:t.hasChildren||!1,goals:t.goals||[],frustrations:t.frustrations||[],motivations:t.motivations||[],scenarios:t.scenarios||[],oceanTraits:t.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:t.thinkFeelDo||{thinks:[],feels:[],does:[]}},[i,s]=y.useState(r),[o,c]=y.useState(!1),[l,u]=y.useState(!1),[d,f]=y.useState(null);y.useState(!1);const{isAuthenticated:h,token:p}=Zo();y.useEffect(()=>{(async()=>{l&&h&&p&&(u(!1),d&&await A())})()},[h,p,l]);const g=(F,oe)=>{s(se=>({...se,[F]:oe}))},m=(F,oe)=>{s(se=>({...se,oceanTraits:{...se.oceanTraits,[F]:oe}}))},v=F=>{s(oe=>({...oe,[F]:[...oe[F]||[],""]}))},b=(F,oe,se)=>{s(le=>{const ke=[...le[F]||[]];return ke[oe]=se,{...le,[F]:ke}})},x=(F,oe)=>{s(se=>{const le=[...se[F]||[]];return le.splice(oe,1),{...se,[F]:le}})},w=(F,oe,se)=>{s(le=>{const ke={...le.thinkFeelDo},ue=[...ke[F]||[]];return ue[oe]=se,ke[F]=ue,{...le,thinkFeelDo:ke}})},S=F=>{s(oe=>{var le;const se={...oe.thinkFeelDo,[F]:[...((le=oe.thinkFeelDo)==null?void 0:le[F])||[],""]};return{...oe,thinkFeelDo:se}})},C=(F,oe)=>{s(se=>{const le={...se.thinkFeelDo},ke=[...le[F]||[]];return ke.splice(oe,1),le[F]=ke,{...se,thinkFeelDo:le}})},_=()=>{d&&(ne.error("Login canceled - Persona changes not saved"),u(!1),f(null),n())},A=async()=>{if(d){c(!0);try{const F={...d};delete F._id,delete F.isDbPersona;const oe=await $r.create(F),se={...d,id:oe.data._id||oe.data.id,_id:oe.data._id||oe.data.id,isDbPersona:!0};ne.success("Persona saved to database successfully"),u(!1),f(null),e(se)}catch(F){console.error("Error saving after login:",F),ne.error("Failed to save to database after login"),u(!1),f(null)}finally{c(!1)}}};return l?a.jsxs("div",{className:"max-w-5xl mx-auto bg-background p-6",children:[a.jsx("div",{className:"flex justify-between items-center mb-6",children:a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Authentication Required"})}),a.jsx("p",{className:"mb-6 text-muted-foreground",children:"Login is required to save personas to the database. You can either:"}),a.jsxs("ul",{className:"list-disc ml-6 mt-2 mb-6",children:[a.jsx("li",{children:"Log in to save this persona to the database"}),a.jsx("li",{children:"Cancel to discard your changes"})]}),a.jsx(YLe,{message:"Login is required to save your persona to the database",onLoginSuccess:A,onCancel:_})]}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(X,{variant:"ghost",onClick:n,className:"mr-2",children:a.jsx(Wp,{className:"h-5 w-5"})}),a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Edit Persona"})]}),a.jsxs(X,{onClick:async()=>{c(!0);try{const F=i._id||i.id,oe={...i};oe._id&&delete oe._id,delete oe.isDbPersona;let se;if(F&&typeof F=="string"&&F.startsWith("local-")){console.log("Creating new persona instead of updating local ID"),se=await $r.create(oe),ne.success("Persona saved to database");const le={...i,id:se.data._id||se.data.id,_id:se.data._id||se.data.id,isDbPersona:!0};e(le)}else if(F){se=await $r.update(F,oe),ne.success("Persona updated successfully");const le={...i,isDbPersona:!0};e(le)}else{se=await $r.create(oe);const le={...i,id:se.data._id||se.data.id,_id:se.data._id||se.data.id,isDbPersona:!0};ne.success("Persona created successfully"),e(le)}}catch(F){console.error("Error saving persona:",F),F.response&&F.response.status===401?h&&p?(console.log("Auth error despite having token - token likely invalid"),ne.error("Authentication error - saving locally instead"),e(i)):(f(i),u(!0)):(ne.error("Failed to save persona"),e(i))}finally{c(!1)}},disabled:o,children:[o?a.jsx(eo,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(LE,{className:"h-4 w-4 mr-2"}),o?"Saving...":"Save Changes"]})]}),a.jsxs(hl,{defaultValue:"basic",children:[a.jsxs(Ka,{className:"grid w-full grid-cols-6",children:[a.jsx(gn,{value:"basic",children:"Basic"}),a.jsx(gn,{value:"cooper",children:"Cooper"}),a.jsx(gn,{value:"personality",children:"Personality"}),a.jsx(gn,{value:"demographics",children:"Demographics"}),a.jsx(gn,{value:"lifestyle",children:"Lifestyle"}),a.jsx(gn,{value:"extended",children:"Extended"})]}),a.jsx(vn,{value:"basic",className:"mt-6",children:a.jsx(lt,{children:a.jsx(Ot,{className:"p-6",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Name"}),a.jsx(Ht,{value:i.name||"",onChange:F=>g("name",F.target.value)})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Age Range"}),a.jsxs(Bn,{value:i.age||"",onValueChange:F=>g("age",F),children:[a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select age range"})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"18-24",children:"18-24"}),a.jsx(ie,{value:"25-34",children:"25-34"}),a.jsx(ie,{value:"35-44",children:"35-44"}),a.jsx(ie,{value:"45-54",children:"45-54"}),a.jsx(ie,{value:"55-64",children:"55-64"}),a.jsx(ie,{value:"65+",children:"65+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Gender"}),a.jsxs(Bn,{value:i.gender||"",onValueChange:F=>g("gender",F),children:[a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select gender"})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"Male",children:"Male"}),a.jsx(ie,{value:"Female",children:"Female"}),a.jsx(ie,{value:"Non-binary",children:"Non-binary"}),a.jsx(ie,{value:"Other",children:"Other"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Occupation"}),a.jsx(Ht,{value:i.occupation||"",onChange:F=>g("occupation",F.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Education"}),a.jsxs(Bn,{value:i.education||"",onValueChange:F=>g("education",F),children:[a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select education level"})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"High School",children:"High School"}),a.jsx(ie,{value:"Some College",children:"Some College"}),a.jsx(ie,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(ie,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(ie,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(ie,{value:"PhD",children:"PhD"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Location"}),a.jsx(Ht,{value:i.location||"",onChange:F=>g("location",F.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Ethnicity (Optional)"}),a.jsxs(Bn,{value:i.ethnicity||"",onValueChange:F=>g("ethnicity",F),children:[a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select ethnicity"})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"white",children:"White"}),a.jsx(ie,{value:"black",children:"Black"}),a.jsx(ie,{value:"asian",children:"Asian"}),a.jsx(ie,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(ie,{value:"native-american",children:"Native American"}),a.jsx(ie,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(ie,{value:"mixed",children:"Mixed"}),a.jsx(ie,{value:"other",children:"Other"}),a.jsx(ie,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Personality"}),a.jsx(ht,{value:i.personality||"",onChange:F=>g("personality",F.target.value),rows:3})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Interests"}),a.jsx(ht,{value:i.interests||"",onChange:F=>g("interests",F.target.value),rows:3,placeholder:"Tech, travel, cooking, etc."})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm",children:[i.techSavviness,"%"]})]}),a.jsx(Sr,{value:[i.techSavviness],onValueChange:F=>g("techSavviness",F[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm",children:[i.brandLoyalty||0,"%"]})]}),a.jsx(Sr,{value:[i.brandLoyalty||0],onValueChange:F=>g("brandLoyalty",F[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm",children:[i.priceConsciousness||0,"%"]})]}),a.jsx(Sr,{value:[i.priceConsciousness||0],onValueChange:F=>g("priceConsciousness",F[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm",children:[i.environmentalConcern||0,"%"]})]}),a.jsx(Sr,{value:[i.environmentalConcern||0],onValueChange:F=>g("environmentalConcern",F[0]),max:100,step:1})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Purchasing Power"}),a.jsx(bm,{checked:i.hasPurchasingPower||!1,onCheckedChange:F=>g("hasPurchasingPower",F)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Has Children"}),a.jsx(bm,{checked:i.hasChildren||!1,onCheckedChange:F=>g("hasChildren",F)})]})]})]})]})})})}),a.jsxs(vn,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Goals"}),(i.goals||[]).map((F,oe)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:se=>b("goals",oe,se.target.value)}),a.jsx(X,{variant:"ghost",size:"icon",onClick:()=>x("goals",oe),children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},oe)),a.jsxs(X,{variant:"outline",size:"sm",onClick:()=>v("goals"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Goal"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Frustrations"}),(i.frustrations||[]).map((F,oe)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:se=>b("frustrations",oe,se.target.value)}),a.jsx(X,{variant:"ghost",size:"icon",onClick:()=>x("frustrations",oe),children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},oe)),a.jsxs(X,{variant:"outline",size:"sm",onClick:()=>v("frustrations"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Frustration"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Motivations"}),(i.motivations||[]).map((F,oe)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:se=>b("motivations",oe,se.target.value)}),a.jsx(X,{variant:"ghost",size:"icon",onClick:()=>x("motivations",oe),children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},oe)),a.jsxs(X,{variant:"outline",size:"sm",onClick:()=>v("motivations"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Thinks"}),(((j=i.thinkFeelDo)==null?void 0:j.thinks)||[]).map((F,oe)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:se=>w("thinks",oe,se.target.value)}),a.jsx(X,{variant:"ghost",size:"icon",onClick:()=>C("thinks",oe),children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},oe)),a.jsxs(X,{variant:"outline",size:"sm",onClick:()=>S("thinks"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Thought"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Feels"}),(((T=i.thinkFeelDo)==null?void 0:T.feels)||[]).map((F,oe)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:se=>w("feels",oe,se.target.value)}),a.jsx(X,{variant:"ghost",size:"icon",onClick:()=>C("feels",oe),children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},oe)),a.jsxs(X,{variant:"outline",size:"sm",onClick:()=>S("feels"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Feeling"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Does"}),(((k=i.thinkFeelDo)==null?void 0:k.does)||[]).map((F,oe)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:se=>w("does",oe,se.target.value)}),a.jsx(X,{variant:"ghost",size:"icon",onClick:()=>C("does",oe),children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},oe)),a.jsxs(X,{variant:"outline",size:"sm",onClick:()=>S("does"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("div",{className:"space-y-4 mb-6",children:a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Scenario Section Title"}),a.jsx(Ht,{value:i.scenarioType||"",onChange:F=>g("scenarioType",F.target.value),placeholder:"Life Scenarios"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'})]})}),a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(i.scenarios||[]).map((F,oe)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(ht,{value:F||"",onChange:se=>b("scenarios",oe,se.target.value),rows:2}),a.jsx(X,{variant:"ghost",size:"icon",onClick:()=>x("scenarios",oe),children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},oe)),a.jsxs(X,{variant:"outline",size:"sm",onClick:()=>v("scenarios"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})})]}),a.jsx(vn,{value:"personality",className:"mt-6",children:a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Openness to Experience"}),a.jsxs("span",{className:"text-sm",children:[((I=i.oceanTraits)==null?void 0:I.openness)||50,"%"]})]}),a.jsx(Sr,{value:[((E=i.oceanTraits)==null?void 0:E.openness)||50],onValueChange:F=>m("openness",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Creativity, curiosity, and openness to new ideas"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Conscientiousness"}),a.jsxs("span",{className:"text-sm",children:[((O=i.oceanTraits)==null?void 0:O.conscientiousness)||50,"%"]})]}),a.jsx(Sr,{value:[((M=i.oceanTraits)==null?void 0:M.conscientiousness)||50],onValueChange:F=>m("conscientiousness",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization, responsibility, and self-discipline"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Extraversion"}),a.jsxs("span",{className:"text-sm",children:[((U=i.oceanTraits)==null?void 0:U.extraversion)||50,"%"]})]}),a.jsx(Sr,{value:[((D=i.oceanTraits)==null?void 0:D.extraversion)||50],onValueChange:F=>m("extraversion",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Sociability, assertiveness, and talkativeness"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Agreeableness"}),a.jsxs("span",{className:"text-sm",children:[((B=i.oceanTraits)==null?void 0:B.agreeableness)||50,"%"]})]}),a.jsx(Sr,{value:[((R=i.oceanTraits)==null?void 0:R.agreeableness)||50],onValueChange:F=>m("agreeableness",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Compassion, cooperation, and concern for others"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Neuroticism"}),a.jsxs("span",{className:"text-sm",children:[((L=i.oceanTraits)==null?void 0:L.neuroticism)||50,"%"]})]}),a.jsx(Sr,{value:[((Y=i.oceanTraits)==null?void 0:Y.neuroticism)||50],onValueChange:F=>m("neuroticism",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Emotional reactivity, anxiety, and sensitivity to stress"})]})]})]})})}),a.jsx(vn,{value:"demographics",className:"mt-6",children:a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Demographic Information"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Social Grade"}),a.jsxs(Bn,{value:i.socialGrade||"",onValueChange:F=>g("socialGrade",F),children:[a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select social grade"})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"A",children:"A - Higher managerial"}),a.jsx(ie,{value:"B",children:"B - Intermediate managerial"}),a.jsx(ie,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(ie,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(ie,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(ie,{value:"E",children:"E - State pensioners, unemployed"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Household Income"}),a.jsxs(Bn,{value:i.householdIncome||"",onValueChange:F=>g("householdIncome",F),children:[a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select income range"})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"Under $25k",children:"Under $25,000"}),a.jsx(ie,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(ie,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(ie,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(ie,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(ie,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(ie,{value:"Over $250k",children:"Over $250,000"}),a.jsx(ie,{value:"Prefer not to say",children:"Prefer not to say"})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Household Composition"}),a.jsxs(Bn,{value:i.householdComposition||"",onValueChange:F=>g("householdComposition",F),children:[a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select household type"})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"Single person",children:"Single person"}),a.jsx(ie,{value:"Couple without children",children:"Couple without children"}),a.jsx(ie,{value:"Couple with children",children:"Couple with children"}),a.jsx(ie,{value:"Single parent",children:"Single parent"}),a.jsx(ie,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(ie,{value:"Shared housing",children:"Shared housing"}),a.jsx(ie,{value:"Other",children:"Other"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Living Situation"}),a.jsxs(Bn,{value:i.livingSituation||"",onValueChange:F=>g("livingSituation",F),children:[a.jsx($n,{children:a.jsx(Hn,{placeholder:"Select living situation"})}),a.jsxs(Ln,{children:[a.jsx(ie,{value:"Own home",children:"Own home"}),a.jsx(ie,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(ie,{value:"Rent house",children:"Rent house"}),a.jsx(ie,{value:"Live with family",children:"Live with family"}),a.jsx(ie,{value:"Student housing",children:"Student housing"}),a.jsx(ie,{value:"Assisted living",children:"Assisted living"}),a.jsx(ie,{value:"Other",children:"Other"})]})]})]})]})]})]})})}),a.jsx(vn,{value:"lifestyle",className:"mt-6",children:a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Lifestyle & Behavior"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Media Consumption"}),a.jsx(ht,{value:i.mediaConsumption||"",onChange:F=>g("mediaConsumption",F.target.value),rows:3,placeholder:"TV shows, podcasts, news sources, social media platforms"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Describe media consumption habits and preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Device Usage"}),a.jsx(ht,{value:i.deviceUsage||"",onChange:F=>g("deviceUsage",F.target.value),rows:3,placeholder:"Smartphone, laptop, tablet, smart TV, gaming console"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Primary devices and usage patterns"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Shopping Habits"}),a.jsx(ht,{value:i.shoppingHabits||"",onChange:F=>g("shoppingHabits",F.target.value),rows:3,placeholder:"Online vs in-store, frequency, preferred retailers"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Shopping behavior and preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Brand Preferences"}),a.jsx(ht,{value:i.brandPreferences||"",onChange:F=>g("brandPreferences",F.target.value),rows:3,placeholder:"Favorite brands, brand values alignment"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred brands and reasoning"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Communication Preferences"}),a.jsx(ht,{value:i.communicationPreferences||"",onChange:F=>g("communicationPreferences",F.target.value),rows:3,placeholder:"Email, phone, text, video calls, in-person"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred communication methods and channels"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Payment Methods"}),a.jsx(ht,{value:i.paymentMethods||"",onChange:F=>g("paymentMethods",F.target.value),rows:3,placeholder:"Credit cards, digital wallets, cash, BNPL"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred payment methods and financial tools"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Purchase Behavior"}),a.jsx(ht,{value:i.purchaseBehaviour||"",onChange:F=>g("purchaseBehaviour",F.target.value),rows:3,placeholder:"Research habits, decision factors, impulse vs planned buying"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"How they approach making purchase decisions"})]})]})]})]})})}),a.jsxs(vn,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(lt,{children:a.jsxs(Ot,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Extended Profile"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Core Values"}),a.jsx(ht,{value:i.coreValues||"",onChange:F=>g("coreValues",F.target.value),rows:3,placeholder:"Key principles and values that guide decisions"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Lifestyle Choices"}),a.jsx(ht,{value:i.lifestyleChoices||"",onChange:F=>g("lifestyleChoices",F.target.value),rows:3,placeholder:"Health, fitness, diet, work-life balance preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Social Activities"}),a.jsx(ht,{value:i.socialActivities||"",onChange:F=>g("socialActivities",F.target.value),rows:3,placeholder:"Social hobbies, community involvement, networking"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Category Knowledge"}),a.jsx(ht,{value:i.categoryKnowledge||"",onChange:F=>g("categoryKnowledge",F.target.value),rows:3,placeholder:"Expertise in specific product/service categories"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Decision Influences"}),a.jsx(ht,{value:i.decisionInfluences||"",onChange:F=>g("decisionInfluences",F.target.value),rows:3,placeholder:"What factors most influence their decisions"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Pain Points"}),a.jsx(ht,{value:i.painPoints||"",onChange:F=>g("painPoints",F.target.value),rows:3,placeholder:"Common challenges and friction points"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Journey Context"}),a.jsx(ht,{value:i.journeyContext||"",onChange:F=>g("journeyContext",F.target.value),rows:3,placeholder:"Current life stage and contextual factors"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Key Touchpoints"}),a.jsx(ht,{value:i.keyTouchpoints||"",onChange:F=>g("keyTouchpoints",F.target.value),rows:3,placeholder:"Important interaction points and channels"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Autonomy"}),a.jsx(ht,{value:((q=i.selfDeterminationNeeds)==null?void 0:q.autonomy)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,autonomy:F.target.value}),rows:2,placeholder:"Need for independence and self-direction"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Competence"}),a.jsx(ht,{value:((J=i.selfDeterminationNeeds)==null?void 0:J.competence)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,competence:F.target.value}),rows:2,placeholder:"Need to feel capable and effective"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Relatedness"}),a.jsx(ht,{value:((me=i.selfDeterminationNeeds)==null?void 0:me.relatedness)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,relatedness:F.target.value}),rows:2,placeholder:"Need for connection and belonging"})]})]})]})]})]})}),a.jsx(lt,{children:a.jsx(Ot,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Fears & Concerns"}),(i.fears||[]).map((F,oe)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F,onChange:se=>b("fears",oe,se.target.value),placeholder:"Enter a fear or concern"}),a.jsx(X,{variant:"ghost",size:"icon",onClick:()=>x("fears",oe),children:a.jsx(ir,{className:"h-4 w-4 text-muted-foreground"})})]},oe)),a.jsxs(X,{variant:"outline",size:"sm",onClick:()=>v("fears"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Personal Narrative"}),a.jsx(ht,{value:i.narrative||"",onChange:F=>g("narrative",F.target.value),rows:4,placeholder:"Personal story, background, key life experiences"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"A brief narrative that captures their personal story"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Additional Information"}),a.jsx(ht,{value:i.additionalInformation||"",onChange:F=>g("additionalInformation",F.target.value),rows:4,placeholder:"Any other relevant details or context"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Additional context or details not covered elsewhere"})]})]})})})]})]})]})}function XLe(){const{id:t}=RE(),e=Bi(),n=lr(),{navigationState:r,clearNavigationState:i}=ow(),[s,o]=y.useState(void 0),[c,l]=y.useState(!1),[u,d]=y.useState(!1),[f,h]=y.useState(!0);return y.useEffect(()=>{if(!t){h(!1);return}let m=!0;const b=new URLSearchParams(e.search).get("fromReview")==="true";return l(b),h(!0),(async()=>{try{const w=t.startsWith("local-")?t.substring(6):t,S=await $r.getById(w);if(S&&S.data){const C=S.data;if(m){console.log("Found persona in database:",C),o({...C,id:C.id||C._id,isDbPersona:!0}),h(!1);return}}console.error("Could not find persona with id:",t),m&&(o(void 0),h(!1),ne.error("Persona not found"))}catch(w){console.error("Error fetching persona:",w),m&&(o(void 0),h(!1),ne.error("Failed to load persona details"))}})(),()=>{m=!1}},[t,e.search]),{currentPersona:s,isEditing:u,isFromReview:c,isLoading:f,setIsEditing:d,handleGoBack:()=>{r.previousRoute&&r.previousRoute.startsWith("/focus-groups/")&&r.focusGroupId?n(`/focus-groups/${r.focusGroupId}`):r.previousRoute==="/focus-groups"&&r.focusGroupTab?r.isNewFocusGroup?n(`/focus-groups?mode=create&tab=${r.focusGroupTab}`):r.focusGroupId?n(`/focus-groups?mode=edit&id=${r.focusGroupId}&tab=${r.focusGroupTab}`):n("/focus-groups?mode=create&tab=participants"):n(c?"/synthetic-users?mode=create&tab=ai&step=review":"/synthetic-users")},handleSaveEdit:async m=>{try{d(!1);const v=m.isDbPersona||t&&t.length===24&&/^[0-9a-f]{24}$/i.test(t),b={...m};if(b._id&&delete b._id,delete b.isDbPersona,v&&t&&t.length===24&&/^[0-9a-f]{24}$/i.test(t)){const x=await $r.update(t,b);console.log("Updated persona in database:",x);const w={...m,isDbPersona:!0};o(w),ne.success("Persona updated in database successfully")}else{const x=await $r.create(b);console.log("Created new persona in database:",x.data);const w={...m,id:x.data._id||x.data.id,_id:x.data._id||x.data.id,isDbPersona:!0};o(w),ne.success("Persona saved to database successfully")}}catch(v){return console.error("Error saving persona:",v),v.response&&v.response.status===401?ne.error("Authentication error - Please log in to save personas"):v.response&&v.response.status===404?ne.error("API endpoint not found - Database service may be unavailable"):ne.error("Failed to save persona to database: "+(v.message||"Unknown error")),!1}return!0}}}function U$(){var g;const{currentPersona:t,isEditing:e,isFromReview:n,isLoading:r,setIsEditing:i,handleGoBack:s,handleSaveEdit:o}=XLe(),{navigationState:c}=ow(),[l,u]=y.useState(""),[d,f]=y.useState(!1);y.useEffect(()=>{var m;c.focusGroupId&&((m=c.previousRoute)!=null&&m.startsWith("/focus-groups/"))&&(async()=>{var b;try{const x=await bt.getById(c.focusGroupId);(b=x==null?void 0:x.data)!=null&&b.name&&u(x.data.name)}catch(x){console.error("Error fetching focus group name:",x)}})()},[c.focusGroupId,c.previousRoute]);const h=((g=c.previousRoute)==null?void 0:g.startsWith("/focus-groups/"))&&c.focusGroupId,p=async()=>{var m;if(t){f(!0);try{Fe.info("Generating persona profile...",{description:"Using GPT-4.1 to create a beautifully formatted markdown profile"});const v=t._id||t.id;console.log(`šŸ”½ Frontend: Exporting profile for persona ${t.name} (ID: ${v})`);const b=await $r.exportProfile(v,{llm_model:"gpt-4.1",temperature:.3}),{markdown_content:x,persona_name:w,model_used:S,warning:C}=b.data;if(x){const _=new Date().toISOString().split("T")[0],j=`${w.replace(/[^a-zA-Z0-9\-\s]/g,"").replace(/\s+/g,"-").toLowerCase()}-profile-${_}.md`,T=document.createElement("a"),k=new Blob([x],{type:"text/markdown"});if(T.href=URL.createObjectURL(k),T.download=j,document.body.appendChild(T),T.click(),document.body.removeChild(T),C)Fe.success("Profile downloaded with fallback formatting",{description:`${w} profile saved as ${j}`});else{const I=S==="gpt-4.1"?"GPT-4.1":S;Fe.success("Profile downloaded successfully",{description:`${w} profile processed with ${I} and saved as ${j}`})}}else throw new Error("No markdown content received")}catch(v){console.error("Error exporting persona profile:",v),v.response?Fe.error("Failed to export profile",{description:((m=v.response.data)==null?void 0:m.error)||"Server error occurred"}):v.request?Fe.error("Network error",{description:"Unable to connect to the server"}):Fe.error("Export failed",{description:v.message||"An unexpected error occurred"})}finally{f(!1)}}};return r?a.jsx(qLe,{}):t?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(ja,{}),a.jsx("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:e?a.jsx(QLe,{persona:t,onSave:o,onCancel:()=>i(!1)}):a.jsxs(a.Fragment,{children:[h&&a.jsx("div",{className:"mb-4",children:a.jsx(LW,{children:a.jsxs(FW,{children:[a.jsx(py,{children:a.jsxs(vj,{href:"/focus-groups",className:"flex items-center",children:[a.jsx(Ky,{className:"h-4 w-4 mr-1"}),"Focus Groups"]})}),a.jsx(yj,{}),a.jsx(py,{children:a.jsxs(vj,{href:`/focus-groups/${c.focusGroupId}`,className:"flex items-center",children:[a.jsx(Fr,{className:"h-4 w-4 mr-1"}),l||"Focus Group Session"]})}),a.jsx(yj,{}),a.jsx(py,{children:a.jsxs(UW,{className:"flex items-center",children:[a.jsx(Qp,{className:"h-4 w-4 mr-1"}),(t==null?void 0:t.name)||"Participant"]})})]})})}),a.jsxs("div",{className:"flex items-center mb-6 relative",children:[a.jsx(X,{variant:"ghost",onClick:s,className:"absolute left-0 top-0 flex items-center",children:a.jsx(Wp,{className:"h-5 w-5"})}),a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900 mx-auto",children:"Persona Profile"}),a.jsxs("div",{className:"absolute right-0 top-0 flex items-center gap-3",children:[a.jsxs(X,{variant:"outline",onClick:p,disabled:d,className:"hover-transition",children:[a.jsx(Jc,{className:"h-4 w-4 mr-2"}),d?"Generating...":"Download Profile"]}),a.jsxs(X,{onClick:()=>i(!0),children:[a.jsx(fZ,{className:"h-4 w-4 mr-2"}),"Edit Persona"]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mt-10",children:[a.jsx("div",{className:"lg:col-span-1",children:a.jsx(zLe,{persona:t})}),a.jsx("div",{className:"lg:col-span-2",children:a.jsxs(hl,{defaultValue:"cooper-profile",children:[a.jsxs(Ka,{className:"grid w-full grid-cols-3",children:[a.jsx(gn,{value:"cooper-profile",children:"Cooper Profile"}),a.jsx(gn,{value:"personality",children:"Personality"}),a.jsx(gn,{value:"scenarios",children:"Scenarios"})]}),a.jsx(vn,{value:"cooper-profile",className:"mt-6",children:a.jsx(VLe,{persona:t})}),a.jsx(vn,{value:"personality",className:"mt-6",children:a.jsx(GLe,{persona:t})}),a.jsx(vn,{value:"scenarios",className:"mt-6",children:a.jsx(KLe,{persona:t})})]})})]})]})})]}):a.jsx(WLe,{})}const JLe=Re.object({username:Re.string().min(3,"Username must be at least 3 characters"),password:Re.string().min(4,"Password must be at least 4 characters")});function ZLe(){var h;const t=lr(),e=Bi(),{login:n,loginWithMicrosoft:r,isAuthenticated:i,isMsalLoading:s}=Zo(),[o,c]=y.useState(!1),l=((h=e.state)==null?void 0:h.from)||"/";console.log("Login page - destination path:",l),y.useEffect(()=>{i&&(console.log("User already authenticated, redirecting from login page"),t("/",{replace:!0}))},[i,t]);const u=V0({resolver:G0(JLe),defaultValues:{username:"",password:""}});async function d(p){c(!0);try{await n(p.username,p.password)?(console.log("Login successful, received token, navigating to:",l),t(l,{replace:!0})):(console.error("Login succeeded but no token received"),c(!1))}catch(g){console.error("Login error in form handler:",g),c(!1)}}async function f(){try{await r(),console.log("Microsoft login successful, navigating to:",l),t(l,{replace:!0})}catch(p){console.error("Microsoft login error in form handler:",p)}}return a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gradient-to-br from-gray-100 to-gray-200 dark:from-gray-900 dark:to-gray-800 px-4",children:a.jsxs(lt,{className:"w-full max-w-md",children:[a.jsxs(Ei,{className:"space-y-1",children:[a.jsx(Yi,{className:"text-2xl font-bold text-center",children:"Sign In"}),a.jsx(fT,{className:"text-center",children:"Enter your credentials to access your account"})]}),a.jsxs(Ot,{children:[a.jsx("div",{className:"mb-6",children:a.jsx(X,{type:"button",variant:"outline",className:"w-full bg-[#0078d4] hover:bg-[#106ebe] text-white border-[#0078d4] hover:border-[#106ebe]",onClick:f,disabled:o||s,children:s?a.jsxs(a.Fragment,{children:[a.jsx(eo,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing in with Microsoft..."]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"mr-2 h-4 w-4",viewBox:"0 0 21 21",fill:"currentColor",children:[a.jsx("path",{d:"M10 0H0v10h10V0z"}),a.jsx("path",{d:"M21 0H11v10h10V0z"}),a.jsx("path",{d:"M10 11H0v10h10V11z"}),a.jsx("path",{d:"M21 11H11v10h10V11z"})]}),"Sign in with Microsoft"]})})}),a.jsxs("div",{className:"relative mb-6",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("div",{className:"w-full border-t border-gray-200"})}),a.jsx("div",{className:"relative flex justify-center text-sm",children:a.jsx("span",{className:"bg-white px-2 text-gray-500 dark:bg-gray-800 dark:text-gray-400",children:"Or continue with username"})})]}),a.jsx(W0,{...u,children:a.jsxs("form",{onSubmit:u.handleSubmit(d),className:"space-y-4",children:[a.jsx(yt,{control:u.control,name:"username",render:({field:p})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Username"}),a.jsx(gt,{children:a.jsx(Ht,{placeholder:"Enter your username",...p,disabled:o,autoComplete:"username"})}),a.jsx(vt,{})]})}),a.jsx(yt,{control:u.control,name:"password",render:({field:p})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Password"}),a.jsx(gt,{children:a.jsx(Ht,{placeholder:"Enter your password",type:"password",...p,disabled:o,autoComplete:"current-password"})}),a.jsx(vt,{})]})}),a.jsx(X,{type:"submit",className:"w-full",disabled:o||s,children:o?"Signing in...":"Sign In"})]})})]}),a.jsxs(hT,{className:"flex flex-col space-y-2",children:[a.jsx("div",{className:"text-sm text-center text-gray-500 mb-2",children:"Default account: user / pass"}),!o&&!s&&a.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[a.jsx(X,{variant:"outline",onClick:()=>t("/",{replace:!0}),className:"mt-2",children:"Return to Home"}),a.jsx(X,{variant:"link",onClick:()=>{localStorage.setItem("offline_mode","true");const p={username:"guest",email:"guest@example.com",role:"user"};localStorage.setItem("auth_token","offline-mode-token"),localStorage.setItem("user",JSON.stringify(p)),Fe.success("Offline mode activated",{description:"Using demo account with limited functionality"}),t("/",{replace:!0})},className:"text-sm text-gray-500",children:"Use offline mode"})]})]})]})})}function qu({children:t}){const{isAuthenticated:e,isLoading:n}=Zo(),r=Bi();return console.log("ProtectedRoute check:",{isAuthenticated:e,isLoading:n,path:r.pathname}),n?a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary"})}):e?(console.log("User is authenticated, showing protected content"),a.jsx(a.Fragment,{children:t})):(console.log("Not authenticated, redirecting to login"),a.jsx(l5,{to:"/login",state:{from:r.pathname},replace:!0}))}const eFe=y.createContext({});let B$=!1;function tFe({children:t}){const{token:e}=Zo(),n=()=>{const i=e||localStorage.getItem("auth_token");return console.log("šŸ”§ [GPT-5 Context] Getting token:",i?"Found":"Missing"),i||""};y.useEffect(()=>(B$||(console.log("šŸ”§ [GPT-5 Context] Initializing singleton socket"),DW(n),B$=!0),console.log("šŸ”§ [GPT-5 Context] Connecting socket"),$W(),()=>{}),[e]);const r={};return a.jsx(eFe.Provider,{value:r,children:t})}const BW=new XN(Qie);BW.initialize().catch(t=>{console.error("MSAL initialization error:",t)});function nFe({children:t}){return a.jsx(qie,{instance:BW,children:t})}const rFe=new $X,iFe=()=>a.jsx(FX,{client:rFe,children:a.jsx(MJ,{basename:"/semblance",children:a.jsx(nFe,{children:a.jsx(Jie,{children:a.jsx(tFe,{children:a.jsx(ide,{children:a.jsxs(pX,{children:[a.jsx(H9,{}),a.jsxs(EJ,{children:[a.jsx($s,{path:"/",element:a.jsx(ese,{})}),a.jsx($s,{path:"/login",element:a.jsx(ZLe,{})}),a.jsx($s,{path:"/synthetic-users",element:a.jsx(qu,{children:a.jsx(rde,{})})}),a.jsx($s,{path:"/synthetic-users/:id",element:a.jsx(qu,{children:a.jsx(U$,{})})}),a.jsx($s,{path:"/personas/:id",element:a.jsx(qu,{children:a.jsx(U$,{})})}),a.jsx($s,{path:"/focus-groups",element:a.jsx(qu,{children:a.jsx(dde,{})})}),a.jsx($s,{path:"/focus-groups/:id",element:a.jsx(qu,{children:a.jsx(OLe,{})})}),a.jsx($s,{path:"/dashboard",element:a.jsx(qu,{children:a.jsx(HLe,{})})}),a.jsx($s,{path:"/old-path",element:a.jsx(l5,{to:"/",replace:!0})}),a.jsx($s,{path:"*",element:a.jsx(tse,{})})]})]})})})})})})});u4(document.getElementById("root")).render(a.jsx(iFe,{})); diff --git a/dist/assets/index-BttT7ZR2.css b/dist/assets/index-BttT7ZR2.css deleted file mode 100644 index f3e324f0..00000000 --- a/dist/assets/index-BttT7ZR2.css +++ /dev/null @@ -1 +0,0 @@ -@import"https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap";.back-button{position:absolute;top:1.25rem;left:1.25rem;z-index:10;display:flex;align-items:center;justify-content:center;width:2.5rem;height:2.5rem;border-radius:9999px;background-color:#fffc;border:1px solid rgba(0,0,0,.1);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);transition:all .15s ease}.back-button:hover{background-color:#ffffffe6;transform:translateY(-1px);box-shadow:0 2px 4px #0000000d}.back-button:active{transform:translateY(0)}.back-button-content{display:flex;align-items:center;gap:.25rem}.page-header-with-back{display:flex;align-items:center;gap:.75rem;padding-left:2.5rem;position:relative}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 350 30% 98%;--foreground: 345 30% 15%;--card: 0 0% 100%;--card-foreground: 345 30% 15%;--popover: 0 0% 100%;--popover-foreground: 345 30% 15%;--primary: 350 85% 80%;--primary-foreground: 350 30% 20%;--secondary: 350 30% 96.1%;--secondary-foreground: 345 30% 15%;--muted: 350 30% 96.1%;--muted-foreground: 350 10% 50%;--accent: 350 30% 96.1%;--accent-foreground: 345 30% 15%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 350 30% 98%;--border: 350 30% 91.4%;--input: 350 30% 91.4%;--ring: 350 85% 80%;--radius: .5rem;--sidebar-background: 0 0% 100%;--sidebar-foreground: 345 30% 15%;--sidebar-primary: 350 85% 80%;--sidebar-primary-foreground: 350 30% 20%;--sidebar-accent: 350 30% 96.1%;--sidebar-accent-foreground: 345 30% 15%;--sidebar-border: 350 30% 91.4%;--sidebar-ring: 350 85% 80%}.dark{--background: 345 30% 10%;--foreground: 350 30% 98%;--card: 345 30% 10%;--card-foreground: 350 30% 98%;--popover: 345 30% 10%;--popover-foreground: 350 30% 98%;--primary: 350 85% 80%;--primary-foreground: 345 30% 15%;--secondary: 342 20% 17.5%;--secondary-foreground: 350 30% 98%;--muted: 342 20% 17.5%;--muted-foreground: 350 10% 70%;--accent: 342 20% 17.5%;--accent-foreground: 350 30% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 350 30% 98%;--border: 342 20% 17.5%;--input: 342 20% 17.5%;--ring: 350 70% 85%;--sidebar-background: 345 30% 10%;--sidebar-foreground: 350 30% 98%;--sidebar-primary: 350 85% 80%;--sidebar-primary-foreground: 350 30% 98%;--sidebar-accent: 342 20% 17.5%;--sidebar-accent-foreground: 350 30% 98%;--sidebar-border: 342 20% 17.5%;--sidebar-ring: 350 70% 85%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));font-family:Inter,system-ui,sans-serif;color:hsl(var(--foreground));font-feature-settings:"rlig" 1,"calt" 1}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background-color:transparent}::-webkit-scrollbar-thumb{border-radius:9999px;background-color:hsl(var(--muted-foreground) / .4)}::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--muted-foreground) / .6)}@font-face{font-family:SF Pro Display;src:local("SF Pro Display"),local("SFProDisplay"),url(https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-regular-webfont.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:SF Pro Display;src:local("SF Pro Display Medium"),local("SFProDisplay-Medium"),url(https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-medium-webfont.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:SF Pro Display;src:local("SF Pro Display Semibold"),local("SFProDisplay-Semibold"),url(https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-semibold-webfont.woff) format("woff");font-weight:600;font-style:normal}@font-face{font-family:SF Pro Display;src:local("SF Pro Display Bold"),local("SFProDisplay-Bold"),url(https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-bold-webfont.woff) format("woff");font-weight:700;font-style:normal}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}.glass-card{border-width:1px;border-color:#fff3;background-color:#fffc;--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.glass-panel{border-width:1px;border-color:#fff6;background-color:#ffffffe6;--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.text-gradient{background-image:linear-gradient(to right,var(--tw-gradient-stops));--tw-gradient-from: hsl(var(--primary)) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);--tw-gradient-to: #f9a8d4 var(--tw-gradient-to-position);-webkit-background-clip:text;background-clip:text;color:transparent}.hover-transition{transition-property:all;transition-duration:.3s;transition-timing-function:cubic-bezier(.4,0,.2,1);animation-duration:.3s;animation-timing-function:cubic-bezier(.4,0,.2,1)}.button-transition{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;transition-timing-function:cubic-bezier(0,0,.2,1);animation-duration:.2s;animation-timing-function:cubic-bezier(0,0,.2,1)}.sidebar-icon{margin-right:.75rem;margin-top:.125rem;height:1rem;width:1rem;flex-shrink:0;--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.sidebar-section{display:flex;align-items:flex-start}.sidebar-sub-item{font-size:.875rem;line-height:1.25rem;color:hsl(var(--muted-foreground))}.persona-card{position:relative;overflow:hidden;min-height:360px}.persona-card-overlay{pointer-events:none;position:absolute;top:0;right:0;bottom:0;left:0;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;transition-timing-function:cubic-bezier(0,0,.2,1);animation-duration:.2s;animation-timing-function:cubic-bezier(0,0,.2,1)}.persona-card:hover .persona-card-overlay,.persona-card.selected .persona-card-overlay{background-color:#ecd1de4d}.persona-card-checkmark{position:absolute;top:.75rem;left:.75rem;z-index:20;opacity:0;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;transition-timing-function:cubic-bezier(0,0,.2,1);animation-duration:.2s;animation-timing-function:cubic-bezier(0,0,.2,1);border-radius:9999px;border-width:1px;border-color:#fff6;background-color:#ffffffe6;padding:.25rem;--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.persona-card.selected .persona-card-checkmark{opacity:1}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-bottom-12{bottom:-3rem}.-left-12{left:-3rem}.-right-12{right:-3rem}.-top-12{top:-3rem}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.bottom-5{bottom:1.25rem}.bottom-6{bottom:1.5rem}.bottom-\[-10rem\]{bottom:-10rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-3{left:.75rem}.left-4{left:1rem}.left-\[50\%\]{left:50%}.left-\[calc\(50\%\+11rem\)\]{left:calc(50% + 11rem)}.left-\[calc\(50\%-11rem\)\]{left:calc(50% - 11rem)}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-16{top:4rem}.top-2{top:.5rem}.top-20{top:5rem}.top-3\.5{top:.875rem}.top-4{top:1rem}.top-\[-10rem\]{top:-10rem}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.isolate{isolation:isolate}.-z-10{z-index:-10}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[1\]{z-index:1}.col-span-full{grid-column:1 / -1}.m-0{margin:0}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3\.5{margin-left:.875rem;margin-right:.875rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.-ml-4{margin-left:-1rem}.-mt-4{margin-top:-1rem}.mb-1{margin-bottom:.25rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-5{margin-right:1.25rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-10{margin-top:2.5rem}.mt-12{margin-top:3rem}.mt-16{margin-top:4rem}.mt-2{margin-top:.5rem}.mt-24{margin-top:6rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-\[1155\/678\]{aspect-ratio:1155/678}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.h-0{height:0px}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-36{height:9rem}.h-4{height:1rem}.h-40{height:10rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-80{height:20rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1px\]{height:1px}.h-\[25vh\]{height:25vh}.h-\[450px\]{height:450px}.h-\[70vh\]{height:70vh}.h-\[calc\(100vh-12rem\)\]{height:calc(100vh - 12rem)}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-48{max-height:12rem}.max-h-60{max-height:15rem}.max-h-96{max-height:24rem}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-\[70vh\]{max-height:70vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-full{max-height:100%}.min-h-0{min-height:0px}.min-h-\[100px\]{min-height:100px}.min-h-\[40px\]{min-height:40px}.min-h-\[60px\]{min-height:60px}.min-h-\[80px\]{min-height:80px}.min-h-screen{min-height:100vh}.min-h-svh{min-height:100svh}.w-0{width:0px}.w-1{width:.25rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-5\/6{width:83.333333%}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[--sidebar-width\]{width:var(--sidebar-width)}.w-\[100px\]{width:100px}.w-\[1px\]{width:1px}.w-\[350px\]{width:350px}.w-\[36\.125rem\]{width:36.125rem}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-32{min-width:8rem}.min-w-36{min-width:9rem}.min-w-5{min-width:1.25rem}.min-w-\[12rem\]{min-width:12rem}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-7xl{max-width:80rem}.max-w-\[--skeleton-width\]{max-width:var(--skeleton-width)}.max-w-\[400px\]{max-width:400px}.max-w-\[70\%\]{max-width:70%}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.grow-0{flex-grow:0}.basis-full{flex-basis:100%}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-px{--tw-translate-x: -1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-px{--tw-translate-x: 1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-\[30deg\]{--tw-rotate: 30deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform-gpu{transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.animate-fade-in{animation:fade-in .5s ease-out}@keyframes float{0%,to{transform:translateY(0)}50%{transform:translateY(-5px)}}.animate-float{animation:float 3s ease-in-out infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.resize-y{resize:vertical}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-6{-moz-column-gap:1.5rem;column-gap:1.5rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-8>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(2rem * var(--tw-space-x-reverse));margin-left:calc(2rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-t-\[10px\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-\[1\.5px\]{border-width:1.5px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-t-2{border-top-width:2px}.border-dashed{border-style:dashed}.border-\[\#0078d4\]{--tw-border-opacity: 1;border-color:rgb(0 120 212 / var(--tw-border-opacity, 1))}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-200{--tw-border-opacity: 1;border-color:rgb(233 213 255 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-sidebar-border{border-color:hsl(var(--sidebar-border))}.border-slate-100{--tw-border-opacity: 1;border-color:rgb(241 245 249 / var(--tw-border-opacity, 1))}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity, 1))}.border-slate-200\/80{border-color:#e2e8f0cc}.border-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-l-green-500{--tw-border-opacity: 1;border-left-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-l-primary{border-left-color:hsl(var(--primary))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[\#0078d4\]{--tw-bg-opacity: 1;background-color:rgb(0 120 212 / var(--tw-bg-opacity, 1))}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-100{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-50\/50{background-color:#eff6ff80}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-foreground{background-color:hsl(var(--foreground))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-500{--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity, 1))}.bg-gray-900\/10{background-color:#1118271a}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-pink-200{--tw-bg-opacity: 1;background-color:rgb(251 207 232 / var(--tw-bg-opacity, 1))}.bg-pink-300{--tw-bg-opacity: 1;background-color:rgb(249 168 212 / var(--tw-bg-opacity, 1))}.bg-pink-400{--tw-bg-opacity: 1;background-color:rgb(244 114 182 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-50{--tw-bg-opacity: 1;background-color:rgb(250 245 255 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-sidebar{background-color:hsl(var(--sidebar-background))}.bg-sidebar-border{background-color:hsl(var(--sidebar-border))}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-50{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/70{background-color:#ffffffb3}.bg-white\/80{background-color:#fffc}.bg-yellow-400{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-tr{background-image:linear-gradient(to top right,var(--tw-gradient-stops))}.from-blue-400{--tw-gradient-from: #60a5fa var(--tw-gradient-from-position);--tw-gradient-to: rgb(96 165 250 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-100{--tw-gradient-from: #f3f4f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(243 244 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary{--tw-gradient-from: hsl(var(--primary)) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-blue-400{--tw-gradient-to: #60a5fa var(--tw-gradient-to-position)}.to-blue-400\/5{--tw-gradient-to: rgb(96 165 250 / .05) var(--tw-gradient-to-position)}.to-gray-200{--tw-gradient-to: #e5e7eb var(--tw-gradient-to-position)}.to-primary{--tw-gradient-to: hsl(var(--primary)) var(--tw-gradient-to-position)}.to-slate-50{--tw-gradient-to: #f8fafc var(--tw-gradient-to-position)}.fill-amber-400{fill:#fbbf24}.fill-current{fill:currentColor}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-10{padding-left:2.5rem}.pl-2\.5{padding-left:.625rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-4{padding-right:1rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-16{padding-top:4rem}.pt-2{padding-top:.5rem}.pt-20{padding-top:5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:Inter,system-ui,sans-serif}.font-sf{font-family:SF Pro Display,system-ui,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.8rem\]{font-size:.8rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-6{line-height:1.5rem}.leading-8{line-height:2rem}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}.text-purple-800{--tw-text-opacity: 1;color:rgb(107 33 168 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sidebar-foreground{color:hsl(var(--sidebar-foreground))}.text-sidebar-foreground\/70{color:hsl(var(--sidebar-foreground) / .7)}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity, 1))}.text-slate-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.shadow-\[0_-2px_4px_rgba\(0\,0\,0\,0\.05\)\]{--tw-shadow: 0 -2px 4px rgba(0,0,0,.05);--tw-shadow-colored: 0 -2px 4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_0_1px_hsl\(var\(--sidebar-border\)\)\]{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-border));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-blue-200{--tw-ring-opacity: 1;--tw-ring-color: rgb(191 219 254 / var(--tw-ring-opacity, 1))}.ring-gray-900\/10{--tw-ring-color: rgb(17 24 39 / .1)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-ring{--tw-ring-color: hsl(var(--ring))}.ring-sidebar-ring{--tw-ring-color: hsl(var(--sidebar-ring))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.ring-offset-white{--tw-ring-offset-color: #fff}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[left\,right\,width\]{transition-property:left,right,width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\,opa\]{transition-property:margin,opa;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\,height\,padding\]{transition-property:width,height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.fade-in-80{--tw-enter-opacity: .8}.zoom-in-95{--tw-enter-scale: .95}.duration-1000{animation-duration:1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{animation-timing-function:linear}.running{animation-play-state:running}.paused{animation-play-state:paused}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-slate-500::-moz-placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-500::placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:-inset-2:after{content:var(--tw-content);top:-.5rem;right:-.5rem;bottom:-.5rem;left:-.5rem}.after\:inset-y-0:after{content:var(--tw-content);top:0;bottom:0}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-1:after{content:var(--tw-content);width:.25rem}.after\:w-\[2px\]:after{content:var(--tw-content);width:2px}.after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.first\:rounded-l-md:first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.first\:border-l:first-child{border-left-width:1px}.last\:rounded-r-md:last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.last\:border-b-0:last-child{border-bottom-width:0px}.last\:pb-0:last-child{padding-bottom:0}.focus-within\:relative:focus-within{position:relative}.focus-within\:z-20:focus-within{z-index:20}.hover\:translate-y-\[-2px\]:hover{--tw-translate-y: -2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:translate-y-\[-4px\]:hover{--tw-translate-y: -4px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[\#106ebe\]:hover{--tw-border-opacity: 1;border-color:rgb(16 110 190 / var(--tw-border-opacity, 1))}.hover\:border-slate-300:hover{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#106ebe\]:hover{--tw-bg-opacity: 1;background-color:rgb(16 110 190 / var(--tw-bg-opacity, 1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50\/50:hover{background-color:#f9fafb80}.hover\:bg-green-600:hover{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary:hover{background-color:hsl(var(--primary))}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-sidebar-accent:hover{background-color:hsl(var(--sidebar-accent))}.hover\:bg-slate-100:hover{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-200:hover{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-300:hover{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-50:hover{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity, 1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.hover\:text-blue-800:hover{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-gray-200:hover{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.hover\:text-muted-foreground:hover{color:hsl(var(--muted-foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary-foreground:hover{color:hsl(var(--primary-foreground))}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-sidebar-accent-foreground:hover{color:hsl(var(--sidebar-accent-foreground))}.hover\:text-slate-900:hover{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-\[0_0_0_1px_hsl\(var\(--sidebar-accent\)\)\]:hover{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-accent));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-xl:hover{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-gray-900\/20:hover{--tw-ring-color: rgb(17 24 39 / .2)}.hover\:after\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:hsl(var(--sidebar-border))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-primary:focus{background-color:hsl(var(--primary))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-primary-foreground:focus{color:hsl(var(--primary-foreground))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-primary:focus{--tw-ring-color: hsl(var(--primary))}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-sidebar-ring:focus-visible{--tw-ring-color: hsl(var(--sidebar-ring))}.focus-visible\:ring-slate-950:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(2 6 23 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width: 1px}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:bg-sidebar-accent:active{background-color:hsl(var(--sidebar-accent))}.active\:text-sidebar-accent-foreground:active{color:hsl(var(--sidebar-accent-foreground))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group\/menu-item:focus-within .group-focus-within\/menu-item\:opacity-100{opacity:1}.group\/menu-item:hover .group-hover\/menu-item\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.group.toast .group-\[\.toast\]\:absolute{position:absolute}.group.toast .group-\[\.toast\]\:left-3{left:.75rem}.group.toast .group-\[\.toast\]\:top-3{top:.75rem}.group.toast .group-\[\.toast\]\:h-5{height:1.25rem}.group.toast .group-\[\.toast\]\:w-5{width:1.25rem}.group.toast .group-\[\.toast\]\:rounded-md{border-radius:calc(var(--radius) - 2px)}.group.toaster .group-\[\.toaster\]\:border-border{border-color:hsl(var(--border))}.group.toast .group-\[\.toast\]\:bg-muted{background-color:hsl(var(--muted))}.group.toast .group-\[\.toast\]\:bg-primary{background-color:hsl(var(--primary))}.group.toaster .group-\[\.toaster\]\:bg-background{background-color:hsl(var(--background))}.group.toast .group-\[\.toast\]\:p-1{padding:.25rem}.group.toaster .group-\[\.toaster\]\:pr-8{padding-right:2rem}.group.toast .group-\[\.toast\]\:text-foreground\/70{color:hsl(var(--foreground) / .7)}.group.toast .group-\[\.toast\]\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toast .group-\[\.toast\]\:text-primary-foreground{color:hsl(var(--primary-foreground))}.group.toaster .group-\[\.toaster\]\:text-foreground{color:hsl(var(--foreground))}.group.toast .group-\[\.toast\]\:opacity-100{opacity:1}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group.toast .group-\[\.toast\]\:transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.group.toast .hover\:group-\[\.toast\]\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.group.toast .hover\:group-\[\.toast\]\:text-foreground:hover{color:hsl(var(--foreground))}.group.toast .focus\:group-\[\.toast\]\:opacity-100:focus{opacity:1}.group.toast .focus\:group-\[\.toast\]\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.group.toast .focus\:group-\[\.toast\]\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group.toast .focus\:group-\[\.toast\]\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.peer\/menu-button:hover~.peer-hover\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.has-\[\[data-variant\=inset\]\]\:bg-sidebar:has([data-variant=inset]){background-color:hsl(var(--sidebar-background))}.has-\[\:disabled\]\:opacity-50:has(:disabled){opacity:.5}.group\/menu-item:has([data-sidebar=menu-action]) .group-has-\[\[data-sidebar\=menu-action\]\]\/menu-item\:pr-8{padding-right:2rem}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:bg-accent\/50[aria-selected=true]{background-color:hsl(var(--accent) / .5)}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.aria-selected\:opacity-100[aria-selected=true]{opacity:1}.aria-selected\:opacity-30[aria-selected=true]{opacity:.3}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[panel-group-direction\=vertical\]\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\[panel-group-direction\=vertical\]\:w-full[data-panel-group-direction=vertical]{width:100%}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=open\]\:rotate-90[data-state=open]{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[panel-group-direction\=vertical\]\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.data-\[active\=true\]\:bg-sidebar-accent[data-active=true]{background-color:hsl(var(--sidebar-accent))}.data-\[active\]\:bg-accent\/50[data-active]{background-color:hsl(var(--accent) / .5)}.data-\[selected\=\'true\'\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=on\]\:bg-accent[data-state=on],.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:hsl(var(--accent) / .5)}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[active\=true\]\:font-medium[data-active=true]{font-weight:500}.data-\[active\=true\]\:text-sidebar-accent-foreground[data-active=true]{color:hsl(var(--sidebar-accent-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=on\]\:text-accent-foreground[data-state=on],.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=open\]\:opacity-100[data-state=open]{opacity:1}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.data-\[motion\^\=from-\]\:animate-in[data-motion^=from-],.data-\[state\=open\]\:animate-in[data-state=open],.data-\[state\=visible\]\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[motion\^\=to-\]\:animate-out[data-motion^=to-],.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[state\=hidden\]\:animate-out[data-state=hidden]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[motion\^\=from-\]\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\[motion\^\=to-\]\:fade-out[data-motion^=to-],.data-\[state\=closed\]\:fade-out-0[data-state=closed],.data-\[state\=hidden\]\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open],.data-\[state\=visible\]\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[motion\=from-end\]\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\[motion\=from-start\]\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\[motion\=to-end\]\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\[motion\=to-start\]\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=closed\]\:duration-300[data-state=closed]{animation-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{animation-duration:.5s}.data-\[panel-group-direction\=vertical\]\:after\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:0}.data-\[panel-group-direction\=vertical\]\:after\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:.25rem}.data-\[panel-group-direction\=vertical\]\:after\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\[panel-group-direction\=vertical\]\:after\:-translate-y-1\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[panel-group-direction\=vertical\]\:after\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=open\]\:hover\:bg-sidebar-accent:hover[data-state=open]{background-color:hsl(var(--sidebar-accent))}.data-\[state\=open\]\:hover\:text-sidebar-accent-foreground:hover[data-state=open]{color:hsl(var(--sidebar-accent-foreground))}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:left-\[calc\(var\(--sidebar-width\)\*-1\)\]{left:calc(var(--sidebar-width) * -1)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:right-\[calc\(var\(--sidebar-width\)\*-1\)\]{right:calc(var(--sidebar-width) * -1)}.group[data-side=left] .group-data-\[side\=left\]\:-right-4{right:-1rem}.group[data-side=right] .group-data-\[side\=right\]\:left-0{left:0}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:-mt-8{margin-top:-2rem}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:hidden{display:none}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:\!size-8{width:2rem!important;height:2rem!important}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[--sidebar-width-icon\]{width:var(--sidebar-width-icon)}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)_\+_theme\(spacing\.4\)\)\]{width:calc(var(--sidebar-width-icon) + 1rem)}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)_\+_theme\(spacing\.4\)_\+2px\)\]{width:calc(var(--sidebar-width-icon) + 1rem + 2px)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:w-0{width:0px}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-side=right] .group-data-\[side\=right\]\:rotate-180,.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:overflow-hidden{overflow:hidden}.group[data-variant=floating] .group-data-\[variant\=floating\]\:rounded-lg{border-radius:var(--radius)}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border{border-width:1px}.group[data-side=left] .group-data-\[side\=left\]\:border-r{border-right-width:1px}.group[data-side=right] .group-data-\[side\=right\]\:border-l{border-left-width:1px}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border-sidebar-border{border-color:hsl(var(--sidebar-border))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:\!p-0{padding:0!important}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:\!p-2{padding:.5rem!important}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:opacity-0{opacity:0}.group[data-variant=floating] .group-data-\[variant\=floating\]\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:after\:left-full:after{content:var(--tw-content);left:100%}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:hover\:bg-sidebar:hover{background-color:hsl(var(--sidebar-background))}.peer\/menu-button[data-size=default]~.peer-data-\[size\=default\]\/menu-button\:top-1\.5{top:.375rem}.peer\/menu-button[data-size=lg]~.peer-data-\[size\=lg\]\/menu-button\:top-2\.5{top:.625rem}.peer\/menu-button[data-size=sm]~.peer-data-\[size\=sm\]\/menu-button\:top-1{top:.25rem}.peer[data-variant=inset]~.peer-data-\[variant\=inset\]\:min-h-\[calc\(100svh-theme\(spacing\.4\)\)\]{min-height:calc(100svh - 1rem)}.peer\/menu-button[data-active=true]~.peer-data-\[active\=true\]\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.dark\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:from-gray-900:is(.dark *){--tw-gradient-from: #111827 var(--tw-gradient-from-position);--tw-gradient-to: rgb(17 24 39 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:to-gray-800:is(.dark *){--tw-gradient-to: #1f2937 var(--tw-gradient-to-position)}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}@media (min-width: 640px){.sm\:bottom-\[-20rem\]{bottom:-20rem}.sm\:left-\[calc\(50\%\+30rem\)\]{left:calc(50% + 30rem)}.sm\:left-\[calc\(50\%-30rem\)\]{left:calc(50% - 30rem)}.sm\:top-\[-20rem\]{top:-20rem}.sm\:mt-0{margin-top:0}.sm\:mt-24{margin-top:6rem}.sm\:flex{display:flex}.sm\:w-\[72\.1875rem\]{width:72.1875rem}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2\.5{gap:.625rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-32{padding-top:8rem;padding-bottom:8rem}.sm\:text-left{text-align:left}.sm\:text-4xl{font-size:2.25rem;line-height:2.5rem}.sm\:text-6xl{font-size:3.75rem;line-height:1}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:mb-0{margin-bottom:0}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-64{width:16rem}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:border-l{border-left-width:1px}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:opacity-0{opacity:0}.after\:md\:hidden:after{content:var(--tw-content);display:none}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:m-2{margin:.5rem}.peer[data-state=collapsed][data-variant=inset]~.md\:peer-data-\[state\=collapsed\]\:peer-data-\[variant\=inset\]\:ml-2{margin-left:.5rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:ml-0{margin-left:0}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:rounded-xl{border-radius:.75rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}@media (min-width: 1024px){.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:mx-0{margin-left:0;margin-right:0}.lg\:mt-0{margin-top:0}.lg\:flex{display:flex}.lg\:w-64{width:16rem}.lg\:flex-auto{flex:1 1 auto}.lg\:flex-shrink-0{flex-shrink:0}.lg\:flex-grow{flex-grow:1}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}.lg\:gap-x-10{-moz-column-gap:2.5rem;column-gap:2.5rem}.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:py-40{padding-top:10rem;padding-bottom:10rem}}@media (min-width: 1280px){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\[\&\:has\(\[aria-selected\]\)\]\:bg-accent:has([aria-selected]){background-color:hsl(var(--accent))}.first\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-l-md:has([aria-selected]):first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.last\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-r-md:has([aria-selected]):last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\.day-outside\)\]\:bg-accent\/50:has([aria-selected].day-outside){background-color:hsl(var(--accent) / .5)}.\[\&\:has\(\[aria-selected\]\.day-range-end\)\]\:rounded-r-md:has([aria-selected].day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>button\]\:hidden>button{display:none}.\[\&\>span\:last-child\]\:truncate>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:size-4>svg{width:1rem;height:1rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:shrink-0>svg{flex-shrink:0}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\]\:text-sidebar-accent-foreground>svg{color:hsl(var(--sidebar-accent-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-panel-group-direction\=vertical\]\>div\]\:rotate-90[data-panel-group-direction=vertical]>div{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-side=left][data-collapsible=offcanvas] .\[\[data-side\=left\]\[data-collapsible\=offcanvas\]_\&\]\:-right-2{right:-.5rem}[data-side=left][data-state=collapsed] .\[\[data-side\=left\]\[data-state\=collapsed\]_\&\]\:cursor-e-resize{cursor:e-resize}[data-side=left] .\[\[data-side\=left\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-side=right][data-collapsible=offcanvas] .\[\[data-side\=right\]\[data-collapsible\=offcanvas\]_\&\]\:-left-2{left:-.5rem}[data-side=right][data-state=collapsed] .\[\[data-side\=right\]\[data-state\=collapsed\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-side=right] .\[\[data-side\=right\]_\&\]\:cursor-e-resize{cursor:e-resize} diff --git a/dist/assets/index-C4rrBVCh.js b/dist/assets/index-C4rrBVCh.js deleted file mode 100644 index e3e66791..00000000 --- a/dist/assets/index-C4rrBVCh.js +++ /dev/null @@ -1,710 +0,0 @@ -var ck=t=>{throw TypeError(t)};var tS=(t,e,n)=>e.has(t)||ck("Cannot "+n);var ve=(t,e,n)=>(tS(t,e,"read from private field"),n?n.call(t):e.get(t)),pn=(t,e,n)=>e.has(t)?ck("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Vt=(t,e,n,r)=>(tS(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),qr=(t,e,n)=>(tS(t,e,"access private method"),n);var Fg=(t,e,n,r)=>({set _(i){Vt(t,e,i,n)},get _(){return ve(t,e,r)}});function HW(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Bg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Y$={exports:{}},Vb={},Q$={exports:{}},Qt={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var ag=Symbol.for("react.element"),zW=Symbol.for("react.portal"),GW=Symbol.for("react.fragment"),VW=Symbol.for("react.strict_mode"),KW=Symbol.for("react.profiler"),WW=Symbol.for("react.provider"),qW=Symbol.for("react.context"),YW=Symbol.for("react.forward_ref"),QW=Symbol.for("react.suspense"),XW=Symbol.for("react.memo"),JW=Symbol.for("react.lazy"),lk=Symbol.iterator;function ZW(t){return t===null||typeof t!="object"?null:(t=lk&&t[lk]||t["@@iterator"],typeof t=="function"?t:null)}var X$={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},J$=Object.assign,Z$={};function Pf(t,e,n){this.props=t,this.context=e,this.refs=Z$,this.updater=n||X$}Pf.prototype.isReactComponent={};Pf.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Pf.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function eL(){}eL.prototype=Pf.prototype;function vj(t,e,n){this.props=t,this.context=e,this.refs=Z$,this.updater=n||X$}var yj=vj.prototype=new eL;yj.constructor=vj;J$(yj,Pf.prototype);yj.isPureReactComponent=!0;var uk=Array.isArray,tL=Object.prototype.hasOwnProperty,xj={current:null},nL={key:!0,ref:!0,__self:!0,__source:!0};function rL(t,e,n){var r,i={},o=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(o=""+e.key),e)tL.call(e,r)&&!nL.hasOwnProperty(r)&&(i[r]=e[r]);var c=arguments.length-2;if(c===1)i.children=n;else if(1>>1,te=R[Y];if(0>>1;Yi(se,W))nei(ae,se)?(R[Y]=ae,R[ne]=W,Y=ne):(R[Y]=se,R[F]=W,Y=F);else if(nei(ae,W))R[Y]=ae,R[ne]=W,Y=ne;else break e}}return L}function i(R,L){var W=R.sortIndex-L.sortIndex;return W!==0?W:R.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,c=s.now();t.unstable_now=function(){return s.now()-c}}var l=[],u=[],d=1,f=null,h=3,p=!1,g=!1,m=!1,y=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(R){for(var L=n(u);L!==null;){if(L.callback===null)r(u);else if(L.startTime<=R)r(u),L.sortIndex=L.expirationTime,e(l,L);else break;L=n(u)}}function S(R){if(m=!1,w(R),!g)if(n(l)!==null)g=!0,$(C);else{var L=n(u);L!==null&&G(S,L.startTime-R)}}function C(R,L){g=!1,m&&(m=!1,b(j),j=-1),p=!0;var W=h;try{for(w(L),f=n(l);f!==null&&(!(f.expirationTime>L)||R&&!O());){var Y=f.callback;if(typeof Y=="function"){f.callback=null,h=f.priorityLevel;var te=Y(f.expirationTime<=L);L=t.unstable_now(),typeof te=="function"?f.callback=te:f===n(l)&&r(l),w(L)}else r(l);f=n(l)}if(f!==null)var me=!0;else{var F=n(u);F!==null&&G(S,F.startTime-L),me=!1}return me}finally{f=null,h=W,p=!1}}var _=!1,A=null,j=-1,P=5,k=-1;function O(){return!(t.unstable_now()-kR||125Y?(R.sortIndex=W,e(u,R),n(l)===null&&R===n(u)&&(m?(b(j),j=-1):m=!0,G(S,W-Y))):(R.sortIndex=te,e(l,R),g||p||(g=!0,$(C))),R},t.unstable_shouldYield=O,t.unstable_wrapCallback=function(R){var L=h;return function(){var W=h;h=L;try{return R.apply(this,arguments)}finally{h=W}}}})(lL);cL.exports=lL;var uq=cL.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var dq=v,no=uq;function Ce(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),RC=Object.prototype.hasOwnProperty,fq=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,fk={},hk={};function hq(t){return RC.call(hk,t)?!0:RC.call(fk,t)?!1:fq.test(t)?hk[t]=!0:(fk[t]=!0,!1)}function pq(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function mq(t,e,n,r){if(e===null||typeof e>"u"||pq(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function wi(t,e,n,r,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var Vr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Vr[t]=new wi(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Vr[e]=new wi(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Vr[t]=new wi(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Vr[t]=new wi(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Vr[t]=new wi(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Vr[t]=new wi(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Vr[t]=new wi(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Vr[t]=new wi(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Vr[t]=new wi(t,5,!1,t.toLowerCase(),null,!1,!1)});var wj=/[\-:]([a-z])/g;function Sj(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(wj,Sj);Vr[e]=new wi(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(wj,Sj);Vr[e]=new wi(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(wj,Sj);Vr[e]=new wi(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Vr[t]=new wi(t,1,!1,t.toLowerCase(),null,!1,!1)});Vr.xlinkHref=new wi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Vr[t]=new wi(t,1,!1,t.toLowerCase(),null,!0,!0)});function Cj(t,e,n,r){var i=Vr.hasOwnProperty(e)?Vr[e]:null;(i!==null?i.type!==0:r||!(2c||i[s]!==o[c]){var l=` -`+i[s].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=s&&0<=c);break}}}finally{iS=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Fh(t):""}function gq(t){switch(t.tag){case 5:return Fh(t.type);case 16:return Fh("Lazy");case 13:return Fh("Suspense");case 19:return Fh("SuspenseList");case 0:case 2:case 15:return t=oS(t.type,!1),t;case 11:return t=oS(t.type.render,!1),t;case 1:return t=oS(t.type,!0),t;default:return""}}function LC(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Xu:return"Fragment";case Qu:return"Portal";case MC:return"Profiler";case _j:return"StrictMode";case DC:return"Suspense";case $C:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case fL:return(t.displayName||"Context")+".Consumer";case dL:return(t._context.displayName||"Context")+".Provider";case Aj:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case jj:return e=t.displayName||null,e!==null?e:LC(t.type)||"Memo";case rc:e=t._payload,t=t._init;try{return LC(t(e))}catch{}}return null}function vq(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return LC(e);case 8:return e===_j?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Vc(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function pL(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function yq(t){var e=pL(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function zg(t){t._valueTracker||(t._valueTracker=yq(t))}function mL(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=pL(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function py(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function FC(t,e){var n=e.checked;return qn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function mk(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Vc(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function gL(t,e){e=e.checked,e!=null&&Cj(t,"checked",e,!1)}function BC(t,e){gL(t,e);var n=Vc(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?UC(t,e.type,n):e.hasOwnProperty("defaultValue")&&UC(t,e.type,Vc(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function gk(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function UC(t,e,n){(e!=="number"||py(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Bh=Array.isArray;function hd(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Gg.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function _p(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Zh={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},xq=["Webkit","ms","Moz","O"];Object.keys(Zh).forEach(function(t){xq.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Zh[e]=Zh[t]})});function bL(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Zh.hasOwnProperty(t)&&Zh[t]?(""+e).trim():e+"px"}function wL(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=bL(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var bq=qn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function GC(t,e){if(e){if(bq[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Ce(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Ce(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Ce(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Ce(62))}}function VC(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var KC=null;function Ej(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var WC=null,pd=null,md=null;function xk(t){if(t=ug(t)){if(typeof WC!="function")throw Error(Ce(280));var e=t.stateNode;e&&(e=Qb(e),WC(t.stateNode,t.type,e))}}function SL(t){pd?md?md.push(t):md=[t]:pd=t}function CL(){if(pd){var t=pd,e=md;if(md=pd=null,xk(t),e)for(t=0;t>>=0,t===0?32:31-(kq(t)/Oq|0)|0}var Vg=64,Kg=4194304;function Uh(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function yy(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,s=n&268435455;if(s!==0){var c=s&~i;c!==0?r=Uh(c):(o&=s,o!==0&&(r=Uh(o)))}else s=n&~i,s!==0?r=Uh(s):o!==0&&(r=Uh(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function cg(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Yo(e),t[e]=n}function Dq(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=tp),Tk=" ",Nk=!1;function zL(t,e){switch(t){case"keyup":return u7.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function GL(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ju=!1;function f7(t,e){switch(t){case"compositionend":return GL(e);case"keypress":return e.which!==32?null:(Nk=!0,Tk);case"textInput":return t=e.data,t===Tk&&Nk?null:t;default:return null}}function h7(t,e){if(Ju)return t==="compositionend"||!Mj&&zL(t,e)?(t=UL(),Fv=Oj=yc=null,Ju=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ik(n)}}function qL(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?qL(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function YL(){for(var t=window,e=py();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=py(t.document)}return e}function Dj(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function S7(t){var e=YL(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&qL(n.ownerDocument.documentElement,n)){if(r!==null&&Dj(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=Rk(n,o);var s=Rk(n,r);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Zu=null,ZC=null,rp=null,e_=!1;function Mk(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;e_||Zu==null||Zu!==py(r)||(r=Zu,"selectionStart"in r&&Dj(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),rp&&Pp(rp,r)||(rp=r,r=wy(ZC,"onSelect"),0nd||(t.current=s_[nd],s_[nd]=null,nd--)}function kn(t,e){nd++,s_[nd]=t.current,t.current=e}var Kc={},ii=sl(Kc),ki=sl(!1),tu=Kc;function zd(t,e){var n=t.type.contextTypes;if(!n)return Kc;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Oi(t){return t=t.childContextTypes,t!=null}function Cy(){Bn(ki),Bn(ii)}function Hk(t,e,n){if(ii.current!==Kc)throw Error(Ce(168));kn(ii,e),kn(ki,n)}function iF(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(Ce(108,vq(t)||"Unknown",i));return qn({},n,r)}function _y(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Kc,tu=ii.current,kn(ii,t),kn(ki,ki.current),!0}function zk(t,e,n){var r=t.stateNode;if(!r)throw Error(Ce(169));n?(t=iF(t,e,tu),r.__reactInternalMemoizedMergedChildContext=t,Bn(ki),Bn(ii),kn(ii,t)):Bn(ki),kn(ki,n)}var ha=null,Xb=!1,xS=!1;function oF(t){ha===null?ha=[t]:ha.push(t)}function R7(t){Xb=!0,oF(t)}function al(){if(!xS&&ha!==null){xS=!0;var t=0,e=xn;try{var n=ha;for(xn=1;t>=s,i-=s,ga=1<<32-Yo(e)+i|n<j?(P=A,A=null):P=A.sibling;var k=h(b,A,w[j],S);if(k===null){A===null&&(A=P);break}t&&A&&k.alternate===null&&e(b,A),x=o(k,x,j),_===null?C=k:_.sibling=k,_=k,A=P}if(j===w.length)return n(b,A),zn&&wl(b,j),C;if(A===null){for(;jj?(P=A,A=null):P=A.sibling;var O=h(b,A,k.value,S);if(O===null){A===null&&(A=P);break}t&&A&&O.alternate===null&&e(b,A),x=o(O,x,j),_===null?C=O:_.sibling=O,_=O,A=P}if(k.done)return n(b,A),zn&&wl(b,j),C;if(A===null){for(;!k.done;j++,k=w.next())k=f(b,k.value,S),k!==null&&(x=o(k,x,j),_===null?C=k:_.sibling=k,_=k);return zn&&wl(b,j),C}for(A=r(b,A);!k.done;j++,k=w.next())k=p(A,b,j,k.value,S),k!==null&&(t&&k.alternate!==null&&A.delete(k.key===null?j:k.key),x=o(k,x,j),_===null?C=k:_.sibling=k,_=k);return t&&A.forEach(function(E){return e(b,E)}),zn&&wl(b,j),C}function y(b,x,w,S){if(typeof w=="object"&&w!==null&&w.type===Xu&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Hg:e:{for(var C=w.key,_=x;_!==null;){if(_.key===C){if(C=w.type,C===Xu){if(_.tag===7){n(b,_.sibling),x=i(_,w.props.children),x.return=b,b=x;break e}}else if(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===rc&&Kk(C)===_.type){n(b,_.sibling),x=i(_,w.props),x.ref=xh(b,_,w),x.return=b,b=x;break e}n(b,_);break}else e(b,_);_=_.sibling}w.type===Xu?(x=Wl(w.props.children,b.mode,S,w.key),x.return=b,b=x):(S=Wv(w.type,w.key,w.props,null,b.mode,S),S.ref=xh(b,x,w),S.return=b,b=S)}return s(b);case Qu:e:{for(_=w.key;x!==null;){if(x.key===_)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(b,x.sibling),x=i(x,w.children||[]),x.return=b,b=x;break e}else{n(b,x);break}else e(b,x);x=x.sibling}x=ES(w,b.mode,S),x.return=b,b=x}return s(b);case rc:return _=w._init,y(b,x,_(w._payload),S)}if(Bh(w))return g(b,x,w,S);if(ph(w))return m(b,x,w,S);Zg(b,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(b,x.sibling),x=i(x,w),x.return=b,b=x):(n(b,x),x=jS(w,b.mode,S),x.return=b,b=x),s(b)):n(b,x)}return y}var Vd=lF(!0),uF=lF(!1),Ey=sl(null),Ty=null,od=null,Bj=null;function Uj(){Bj=od=Ty=null}function Hj(t){var e=Ey.current;Bn(Ey),t._currentValue=e}function l_(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function vd(t,e){Ty=t,Bj=od=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Ni=!0),t.firstContext=null)}function Eo(t){var e=t._currentValue;if(Bj!==t)if(t={context:t,memoizedValue:e,next:null},od===null){if(Ty===null)throw Error(Ce(308));od=t,Ty.dependencies={lanes:0,firstContext:t}}else od=od.next=t;return e}var Nl=null;function zj(t){Nl===null?Nl=[t]:Nl.push(t)}function dF(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,zj(e)):(n.next=i.next,i.next=n),e.interleaved=n,ka(t,r)}function ka(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var ic=!1;function Gj(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fF(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function _a(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Tc(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,on&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,ka(t,n)}return i=r.interleaved,i===null?(e.next=e,zj(r)):(e.next=i.next,i.next=e),r.interleaved=e,ka(t,n)}function Uv(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Nj(t,n)}}function Wk(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=e:o=o.next=e}else i=o=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Ny(t,e,n,r){var i=t.updateQueue;ic=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,c=i.shared.pending;if(c!==null){i.shared.pending=null;var l=c,u=l.next;l.next=null,s===null?o=u:s.next=u,s=l;var d=t.alternate;d!==null&&(d=d.updateQueue,c=d.lastBaseUpdate,c!==s&&(c===null?d.firstBaseUpdate=u:c.next=u,d.lastBaseUpdate=l))}if(o!==null){var f=i.baseState;s=0,d=u=l=null,c=o;do{var h=c.lane,p=c.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var g=t,m=c;switch(h=e,p=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=qn({},f,h);break e;case 2:ic=!0}}c.callback!==null&&c.lane!==0&&(t.flags|=64,h=i.effects,h===null?i.effects=[c]:h.push(c))}else p={eventTime:p,lane:h,tag:c.tag,payload:c.payload,callback:c.callback,next:null},d===null?(u=d=p,l=f):d=d.next=p,s|=h;if(c=c.next,c===null){if(c=i.shared.pending,c===null)break;h=c,c=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(d===null&&(l=f),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=d,e=i.shared.interleaved,e!==null){i=e;do s|=i.lane,i=i.next;while(i!==e)}else o===null&&(i.shared.lanes=0);iu|=s,t.lanes=s,t.memoizedState=f}}function qk(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=wS.transition;wS.transition={};try{t(!1),e()}finally{xn=n,wS.transition=r}}function NF(){return To().memoizedState}function L7(t,e,n){var r=Pc(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},PF(t))kF(e,n);else if(n=dF(t,e,n,r),n!==null){var i=yi();Qo(n,t,r,i),OF(n,e,r)}}function F7(t,e,n){var r=Pc(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(PF(t))kF(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,c=o(s,n);if(i.hasEagerState=!0,i.eagerState=c,is(c,s)){var l=e.interleaved;l===null?(i.next=i,zj(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=dF(t,e,i,r),n!==null&&(i=yi(),Qo(n,t,r,i),OF(n,e,r))}}function PF(t){var e=t.alternate;return t===Wn||e!==null&&e===Wn}function kF(t,e){ip=ky=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function OF(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Nj(t,n)}}var Oy={readContext:Eo,useCallback:Yr,useContext:Yr,useEffect:Yr,useImperativeHandle:Yr,useInsertionEffect:Yr,useLayoutEffect:Yr,useMemo:Yr,useReducer:Yr,useRef:Yr,useState:Yr,useDebugValue:Yr,useDeferredValue:Yr,useTransition:Yr,useMutableSource:Yr,useSyncExternalStore:Yr,useId:Yr,unstable_isNewReconciler:!1},B7={readContext:Eo,useCallback:function(t,e){return bs().memoizedState=[t,e===void 0?null:e],t},useContext:Eo,useEffect:Qk,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,zv(4194308,4,_F.bind(null,e,t),n)},useLayoutEffect:function(t,e){return zv(4194308,4,t,e)},useInsertionEffect:function(t,e){return zv(4,2,t,e)},useMemo:function(t,e){var n=bs();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=bs();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=L7.bind(null,Wn,t),[r.memoizedState,t]},useRef:function(t){var e=bs();return t={current:t},e.memoizedState=t},useState:Yk,useDebugValue:Jj,useDeferredValue:function(t){return bs().memoizedState=t},useTransition:function(){var t=Yk(!1),e=t[0];return t=$7.bind(null,t[1]),bs().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Wn,i=bs();if(zn){if(n===void 0)throw Error(Ce(407));n=n()}else{if(n=e(),Mr===null)throw Error(Ce(349));ru&30||gF(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,Qk(yF.bind(null,r,o,t),[t]),r.flags|=2048,Lp(9,vF.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=bs(),e=Mr.identifierPrefix;if(zn){var n=va,r=ga;n=(r&~(1<<32-Yo(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Dp++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[Es]=e,t[Ip]=r,HF(t,e,!1,!1),e.stateNode=t;e:{switch(s=VC(n,r),n){case"dialog":Rn("cancel",t),Rn("close",t),i=r;break;case"iframe":case"object":case"embed":Rn("load",t),i=r;break;case"video":case"audio":for(i=0;iqd&&(e.flags|=128,r=!0,bh(o,!1),e.lanes=4194304)}else{if(!r)if(t=Py(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),bh(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!zn)return Qr(e),null}else 2*rr()-o.renderingStartTime>qd&&n!==1073741824&&(e.flags|=128,r=!0,bh(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(n=o.last,n!==null?n.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=rr(),e.sibling=null,n=Kn.current,kn(Kn,r?n&1|2:n&1),e):(Qr(e),null);case 22:case 23:return iE(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Vi&1073741824&&(Qr(e),e.subtreeFlags&6&&(e.flags|=8192)):Qr(e),null;case 24:return null;case 25:return null}throw Error(Ce(156,e.tag))}function q7(t,e){switch(Lj(e),e.tag){case 1:return Oi(e.type)&&Cy(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Kd(),Bn(ki),Bn(ii),Wj(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Kj(e),null;case 13:if(Bn(Kn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Ce(340));Gd()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Bn(Kn),null;case 4:return Kd(),null;case 10:return Hj(e.type._context),null;case 22:case 23:return iE(),null;case 24:return null;default:return null}}var tv=!1,ti=!1,Y7=typeof WeakSet=="function"?WeakSet:Set,Xe=null;function sd(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Qn(t,e,r)}else n.current=null}function y_(t,e,n){try{n()}catch(r){Qn(t,e,r)}}var aO=!1;function Q7(t,e){if(t_=xy,t=YL(),Dj(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,c=-1,l=-1,u=0,d=0,f=t,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===t)break t;if(h===n&&++u===i&&(c=s),h===o&&++d===r&&(l=s),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(n_={focusedElem:t,selectionRange:n},xy=!1,Xe=e;Xe!==null;)if(e=Xe,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Xe=t;else for(;Xe!==null;){e=Xe;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,y=g.memoizedState,b=e.stateNode,x=b.getSnapshotBeforeUpdate(e.elementType===e.type?m:$o(e.type,m),y);b.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ce(163))}}catch(S){Qn(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,Xe=t;break}Xe=e.return}return g=aO,aO=!1,g}function op(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&y_(e,n,o)}i=i.next}while(i!==r)}}function e0(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function x_(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function VF(t){var e=t.alternate;e!==null&&(t.alternate=null,VF(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Es],delete e[Ip],delete e[o_],delete e[O7],delete e[I7])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function KF(t){return t.tag===5||t.tag===3||t.tag===4}function cO(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||KF(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function b_(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Sy));else if(r!==4&&(t=t.child,t!==null))for(b_(t,e,n),t=t.sibling;t!==null;)b_(t,e,n),t=t.sibling}function w_(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(w_(t,e,n),t=t.sibling;t!==null;)w_(t,e,n),t=t.sibling}var Br=null,Bo=!1;function Qa(t,e,n){for(n=n.child;n!==null;)WF(t,e,n),n=n.sibling}function WF(t,e,n){if(Rs&&typeof Rs.onCommitFiberUnmount=="function")try{Rs.onCommitFiberUnmount(Kb,n)}catch{}switch(n.tag){case 5:ti||sd(n,e);case 6:var r=Br,i=Bo;Br=null,Qa(t,e,n),Br=r,Bo=i,Br!==null&&(Bo?(t=Br,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Br.removeChild(n.stateNode));break;case 18:Br!==null&&(Bo?(t=Br,n=n.stateNode,t.nodeType===8?yS(t.parentNode,n):t.nodeType===1&&yS(t,n),Tp(t)):yS(Br,n.stateNode));break;case 4:r=Br,i=Bo,Br=n.stateNode.containerInfo,Bo=!0,Qa(t,e,n),Br=r,Bo=i;break;case 0:case 11:case 14:case 15:if(!ti&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&y_(n,e,s),i=i.next}while(i!==r)}Qa(t,e,n);break;case 1:if(!ti&&(sd(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(c){Qn(n,e,c)}Qa(t,e,n);break;case 21:Qa(t,e,n);break;case 22:n.mode&1?(ti=(r=ti)||n.memoizedState!==null,Qa(t,e,n),ti=r):Qa(t,e,n);break;default:Qa(t,e,n)}}function lO(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Y7),e.forEach(function(r){var i=o9.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Io(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=rr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*J7(r/1960))-r,10t?16:t,xc===null)var r=!1;else{if(t=xc,xc=null,My=0,on&6)throw Error(Ce(331));var i=on;for(on|=4,Xe=t.current;Xe!==null;){var o=Xe,s=o.child;if(Xe.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lrr()-nE?Kl(t,0):tE|=n),Ii(t,e)}function t4(t,e){e===0&&(t.mode&1?(e=Kg,Kg<<=1,!(Kg&130023424)&&(Kg=4194304)):e=1);var n=yi();t=ka(t,e),t!==null&&(cg(t,e,n),Ii(t,n))}function i9(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),t4(t,n)}function o9(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(Ce(314))}r!==null&&r.delete(e),t4(t,n)}var n4;n4=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||ki.current)Ni=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Ni=!1,K7(t,e,n);Ni=!!(t.flags&131072)}else Ni=!1,zn&&e.flags&1048576&&sF(e,jy,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Gv(t,e),t=e.pendingProps;var i=zd(e,ii.current);vd(e,n),i=Yj(null,e,r,t,i,n);var o=Qj();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Oi(r)?(o=!0,_y(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Gj(e),i.updater=Zb,e.stateNode=i,i._reactInternals=e,d_(e,r,t,n),e=p_(null,e,r,!0,o,n)):(e.tag=0,zn&&o&&$j(e),ui(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Gv(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=a9(r),t=$o(r,t),i){case 0:e=h_(null,e,r,t,n);break e;case 1:e=iO(null,e,r,t,n);break e;case 11:e=nO(null,e,r,t,n);break e;case 14:e=rO(null,e,r,$o(r.type,t),n);break e}throw Error(Ce(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:$o(r,i),h_(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:$o(r,i),iO(t,e,r,i,n);case 3:e:{if(FF(e),t===null)throw Error(Ce(387));r=e.pendingProps,o=e.memoizedState,i=o.element,fF(t,e),Ny(e,r,null,n);var s=e.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=Wd(Error(Ce(423)),e),e=oO(t,e,r,n,i);break e}else if(r!==i){i=Wd(Error(Ce(424)),e),e=oO(t,e,r,n,i);break e}else for(Qi=Ec(e.stateNode.containerInfo.firstChild),Xi=e,zn=!0,Go=null,n=uF(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Gd(),r===i){e=Oa(t,e,n);break e}ui(t,e,r,n)}e=e.child}return e;case 5:return hF(e),t===null&&c_(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,r_(r,i)?s=null:o!==null&&r_(r,o)&&(e.flags|=32),LF(t,e),ui(t,e,s,n),e.child;case 6:return t===null&&c_(e),null;case 13:return BF(t,e,n);case 4:return Vj(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Vd(e,null,r,n):ui(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:$o(r,i),nO(t,e,r,i,n);case 7:return ui(t,e,e.pendingProps,n),e.child;case 8:return ui(t,e,e.pendingProps.children,n),e.child;case 12:return ui(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,kn(Ey,r._currentValue),r._currentValue=s,o!==null)if(is(o.value,s)){if(o.children===i.children&&!ki.current){e=Oa(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=_a(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),l_(o.return,n,e),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(Ce(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),l_(s,n,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}ui(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,vd(e,n),i=Eo(i),r=r(i),e.flags|=1,ui(t,e,r,n),e.child;case 14:return r=e.type,i=$o(r,e.pendingProps),i=$o(r.type,i),rO(t,e,r,i,n);case 15:return DF(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:$o(r,i),Gv(t,e),e.tag=1,Oi(r)?(t=!0,_y(e)):t=!1,vd(e,n),IF(e,r,i),d_(e,r,i,n),p_(null,e,r,!0,t,n);case 19:return UF(t,e,n);case 22:return $F(t,e,n)}throw Error(Ce(156,e.tag))};function r4(t,e){return PL(t,e)}function s9(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function So(t,e,n,r){return new s9(t,e,n,r)}function sE(t){return t=t.prototype,!(!t||!t.isReactComponent)}function a9(t){if(typeof t=="function")return sE(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Aj)return 11;if(t===jj)return 14}return 2}function kc(t,e){var n=t.alternate;return n===null?(n=So(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Wv(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")sE(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Xu:return Wl(n.children,i,o,e);case _j:s=8,i|=8;break;case MC:return t=So(12,n,e,i|2),t.elementType=MC,t.lanes=o,t;case DC:return t=So(13,n,e,i),t.elementType=DC,t.lanes=o,t;case $C:return t=So(19,n,e,i),t.elementType=$C,t.lanes=o,t;case hL:return n0(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case dL:s=10;break e;case fL:s=9;break e;case Aj:s=11;break e;case jj:s=14;break e;case rc:s=16,r=null;break e}throw Error(Ce(130,t==null?t:typeof t,""))}return e=So(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function Wl(t,e,n,r){return t=So(7,t,r,e),t.lanes=n,t}function n0(t,e,n,r){return t=So(22,t,r,e),t.elementType=hL,t.lanes=n,t.stateNode={isHidden:!1},t}function jS(t,e,n){return t=So(6,t,null,e),t.lanes=n,t}function ES(t,e,n){return e=So(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function c9(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=aS(0),this.expirationTimes=aS(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=aS(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function aE(t,e,n,r,i,o,s,c,l){return t=new c9(t,e,n,c,l),e===1?(e=1,o===!0&&(e|=8)):e=0,o=So(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Gj(o),t}function l9(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a4)}catch(t){console.error(t)}}a4(),aL.exports=ro;var If=aL.exports;const c4=dn(If);var l4,vO=If;l4=vO.createRoot,vO.hydrateRoot;var yO=["light","dark"],p9="(prefers-color-scheme: dark)",m9=v.createContext(void 0),g9={setTheme:t=>{},themes:[]},v9=()=>{var t;return(t=v.useContext(m9))!=null?t:g9};v.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:o,value:s,attrs:c,nonce:l})=>{let u=o==="system",d=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${c.map(g=>`'${g}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,f=i?yO.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",h=(g,m=!1,y=!0)=>{let b=s?s[g]:g,x=m?g+"|| ''":`'${b}'`,w="";return i&&y&&!m&&yO.includes(g)&&(w+=`d.style.colorScheme = '${g}';`),n==="class"?m||b?w+=`c.add(${x})`:w+="null":b&&(w+=`d[s](n,${x})`),w},p=t?`!function(){${d}${h(t)}}()`:r?`!function(){try{${d}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${u})){var t='${p9}',m=window.matchMedia(t);if(m.media!==t||m.matches){${h("dark")}}else{${h("light")}}}else if(e){${s?`var x=${JSON.stringify(s)};`:""}${h(s?"x[e]":"e",!0)}}${u?"":"else{"+h(o,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${e}');if(e){${s?`var x=${JSON.stringify(s)};`:""}${h(s?"x[e]":"e",!0)}}else{${h(o,!1,!1)};}${f}}catch(t){}}();`;return v.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:p}})});var y9=t=>{switch(t){case"success":return w9;case"info":return C9;case"warning":return S9;case"error":return _9;default:return null}},x9=Array(12).fill(0),b9=({visible:t})=>N.createElement("div",{className:"sonner-loading-wrapper","data-visible":t},N.createElement("div",{className:"sonner-spinner"},x9.map((e,n)=>N.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),w9=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),S9=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),C9=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),_9=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),A9=()=>{let[t,e]=N.useState(document.hidden);return N.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},j_=1,j9=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:n,...r}=t,i=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:j_++,o=this.toasts.find(c=>c.id===i),s=t.dismissible===void 0?!0:t.dismissible;return o?this.toasts=this.toasts.map(c=>c.id===i?(this.publish({...c,...t,id:i,title:n}),{...c,...t,id:i,dismissible:s,title:n}):c):this.addToast({title:n,...r,dismissible:s,id:i}),i},this.dismiss=t=>(t||this.toasts.forEach(e=>{this.subscribers.forEach(n=>n({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let n;e.loading!==void 0&&(n=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let r=t instanceof Promise?t:t(),i=n!==void 0;return r.then(async o=>{if(T9(o)&&!o.ok){i=!1;let s=typeof e.error=="function"?await e.error(`HTTP error! status: ${o.status}`):e.error,c=typeof e.description=="function"?await e.description(`HTTP error! status: ${o.status}`):e.description;this.create({id:n,type:"error",message:s,description:c})}else if(e.success!==void 0){i=!1;let s=typeof e.success=="function"?await e.success(o):e.success,c=typeof e.description=="function"?await e.description(o):e.description;this.create({id:n,type:"success",message:s,description:c})}}).catch(async o=>{if(e.error!==void 0){i=!1;let s=typeof e.error=="function"?await e.error(o):e.error,c=typeof e.description=="function"?await e.description(o):e.description;this.create({id:n,type:"error",message:s,description:c})}}).finally(()=>{var o;i&&(this.dismiss(n),n=void 0),(o=e.finally)==null||o.call(e)}),n},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||j_++;return this.create({jsx:t(n),id:n,...e}),n},this.subscribers=[],this.toasts=[]}},Gi=new j9,E9=(t,e)=>{let n=(e==null?void 0:e.id)||j_++;return Gi.addToast({title:t,...e,id:n}),n},T9=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",N9=E9,P9=()=>Gi.toasts,re=Object.assign(N9,{success:Gi.success,info:Gi.info,warning:Gi.warning,error:Gi.error,custom:Gi.custom,message:Gi.message,promise:Gi.promise,dismiss:Gi.dismiss,loading:Gi.loading},{getHistory:P9});function k9(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}k9(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} -`);function iv(t){return t.label!==void 0}var O9=3,I9="32px",R9=4e3,M9=356,D9=14,$9=20,L9=200;function F9(...t){return t.filter(Boolean).join(" ")}var B9=t=>{var e,n,r,i,o,s,c,l,u,d;let{invert:f,toast:h,unstyled:p,interacting:g,setHeights:m,visibleToasts:y,heights:b,index:x,toasts:w,expanded:S,removeToast:C,defaultRichColors:_,closeButton:A,style:j,cancelButtonStyle:P,actionButtonStyle:k,className:O="",descriptionClassName:E="",duration:I,position:D,gap:z,loadingIcon:$,expandByDefault:G,classNames:R,icons:L,closeButtonAriaLabel:W="Close toast",pauseWhenPageIsHidden:Y,cn:te}=t,[me,F]=N.useState(!1),[se,ne]=N.useState(!1),[ae,De]=N.useState(!1),[de,ye]=N.useState(!1),[Ee,Z]=N.useState(0),[ct,Le]=N.useState(0),At=N.useRef(null),lt=N.useRef(null),Jt=x===0,T=x+1<=y,M=h.type,U=h.dismissible!==!1,V=h.className||"",Q=h.descriptionClassName||"",B=N.useMemo(()=>b.findIndex(St=>St.toastId===h.id)||0,[b,h.id]),X=N.useMemo(()=>{var St;return(St=h.closeButton)!=null?St:A},[h.closeButton,A]),ge=N.useMemo(()=>h.duration||I||R9,[h.duration,I]),xe=N.useRef(0),Re=N.useRef(0),be=N.useRef(0),Ve=N.useRef(null),[st,kt]=D.split("-"),Ke=N.useMemo(()=>b.reduce((St,Ze,ot)=>ot>=B?St:St+Ze.height,0),[b,B]),tt=A9(),Nt=h.invert||f,sn=M==="loading";Re.current=N.useMemo(()=>B*z+Ke,[B,Ke]),N.useEffect(()=>{F(!0)},[]),N.useLayoutEffect(()=>{if(!me)return;let St=lt.current,Ze=St.style.height;St.style.height="auto";let ot=St.getBoundingClientRect().height;St.style.height=Ze,Le(ot),m(Xt=>Xt.find(wn=>wn.toastId===h.id)?Xt.map(wn=>wn.toastId===h.id?{...wn,height:ot}:wn):[{toastId:h.id,height:ot,position:h.position},...Xt])},[me,h.title,h.description,m,h.id]);let Nr=N.useCallback(()=>{ne(!0),Z(Re.current),m(St=>St.filter(Ze=>Ze.toastId!==h.id)),setTimeout(()=>{C(h)},L9)},[h,C,m,Re]);N.useEffect(()=>{if(h.promise&&M==="loading"||h.duration===1/0||h.type==="loading")return;let St,Ze=ge;return S||g||Y&&tt?(()=>{if(be.current{var ot;(ot=h.onAutoClose)==null||ot.call(h,h),Nr()},Ze)),()=>clearTimeout(St)},[S,g,G,h,ge,Nr,h.promise,M,Y,tt]),N.useEffect(()=>{let St=lt.current;if(St){let Ze=St.getBoundingClientRect().height;return Le(Ze),m(ot=>[{toastId:h.id,height:Ze,position:h.position},...ot]),()=>m(ot=>ot.filter(Xt=>Xt.toastId!==h.id))}},[m,h.id]),N.useEffect(()=>{h.delete&&Nr()},[Nr,h.delete]);function fn(){return L!=null&&L.loading?N.createElement("div",{className:"sonner-loader","data-visible":M==="loading"},L.loading):$?N.createElement("div",{className:"sonner-loader","data-visible":M==="loading"},$):N.createElement(b9,{visible:M==="loading"})}return N.createElement("li",{"aria-live":h.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:lt,className:te(O,V,R==null?void 0:R.toast,(e=h==null?void 0:h.classNames)==null?void 0:e.toast,R==null?void 0:R.default,R==null?void 0:R[M],(n=h==null?void 0:h.classNames)==null?void 0:n[M]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:_,"data-styled":!(h.jsx||h.unstyled||p),"data-mounted":me,"data-promise":!!h.promise,"data-removed":se,"data-visible":T,"data-y-position":st,"data-x-position":kt,"data-index":x,"data-front":Jt,"data-swiping":ae,"data-dismissible":U,"data-type":M,"data-invert":Nt,"data-swipe-out":de,"data-expanded":!!(S||G&&me),style:{"--index":x,"--toasts-before":x,"--z-index":w.length-x,"--offset":`${se?Ee:Re.current}px`,"--initial-height":G?"auto":`${ct}px`,...j,...h.style},onPointerDown:St=>{sn||!U||(At.current=new Date,Z(Re.current),St.target.setPointerCapture(St.pointerId),St.target.tagName!=="BUTTON"&&(De(!0),Ve.current={x:St.clientX,y:St.clientY}))},onPointerUp:()=>{var St,Ze,ot,Xt;if(de||!U)return;Ve.current=null;let wn=Number(((St=lt.current)==null?void 0:St.style.getPropertyValue("--swipe-amount").replace("px",""))||0),oo=new Date().getTime()-((Ze=At.current)==null?void 0:Ze.getTime()),ta=Math.abs(wn)/oo;if(Math.abs(wn)>=$9||ta>.11){Z(Re.current),(ot=h.onDismiss)==null||ot.call(h,h),Nr(),ye(!0);return}(Xt=lt.current)==null||Xt.style.setProperty("--swipe-amount","0px"),De(!1)},onPointerMove:St=>{var Ze;if(!Ve.current||!U)return;let ot=St.clientY-Ve.current.y,Xt=St.clientX-Ve.current.x,wn=(st==="top"?Math.min:Math.max)(0,ot),oo=St.pointerType==="touch"?10:2;Math.abs(wn)>oo?(Ze=lt.current)==null||Ze.style.setProperty("--swipe-amount",`${ot}px`):Math.abs(Xt)>oo&&(Ve.current=null)}},X&&!h.jsx?N.createElement("button",{"aria-label":W,"data-disabled":sn,"data-close-button":!0,onClick:sn||!U?()=>{}:()=>{var St;Nr(),(St=h.onDismiss)==null||St.call(h,h)},className:te(R==null?void 0:R.closeButton,(i=h==null?void 0:h.classNames)==null?void 0:i.closeButton)},N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},N.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),N.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,h.jsx||N.isValidElement(h.title)?h.jsx||h.title:N.createElement(N.Fragment,null,M||h.icon||h.promise?N.createElement("div",{"data-icon":"",className:te(R==null?void 0:R.icon,(o=h==null?void 0:h.classNames)==null?void 0:o.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||fn():null,h.type!=="loading"?h.icon||(L==null?void 0:L[M])||y9(M):null):null,N.createElement("div",{"data-content":"",className:te(R==null?void 0:R.content,(s=h==null?void 0:h.classNames)==null?void 0:s.content)},N.createElement("div",{"data-title":"",className:te(R==null?void 0:R.title,(c=h==null?void 0:h.classNames)==null?void 0:c.title)},h.title),h.description?N.createElement("div",{"data-description":"",className:te(E,Q,R==null?void 0:R.description,(l=h==null?void 0:h.classNames)==null?void 0:l.description)},h.description):null),N.isValidElement(h.cancel)?h.cancel:h.cancel&&iv(h.cancel)?N.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||P,onClick:St=>{var Ze,ot;iv(h.cancel)&&U&&((ot=(Ze=h.cancel).onClick)==null||ot.call(Ze,St),Nr())},className:te(R==null?void 0:R.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,N.isValidElement(h.action)?h.action:h.action&&iv(h.action)?N.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||k,onClick:St=>{var Ze,ot;iv(h.action)&&(St.defaultPrevented||((ot=(Ze=h.action).onClick)==null||ot.call(Ze,St),Nr()))},className:te(R==null?void 0:R.actionButton,(d=h==null?void 0:h.classNames)==null?void 0:d.actionButton)},h.action.label):null))};function xO(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}var U9=t=>{let{invert:e,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:i,closeButton:o,className:s,offset:c,theme:l="light",richColors:u,duration:d,style:f,visibleToasts:h=O9,toastOptions:p,dir:g=xO(),gap:m=D9,loadingIcon:y,icons:b,containerAriaLabel:x="Notifications",pauseWhenPageIsHidden:w,cn:S=F9}=t,[C,_]=N.useState([]),A=N.useMemo(()=>Array.from(new Set([n].concat(C.filter(Y=>Y.position).map(Y=>Y.position)))),[C,n]),[j,P]=N.useState([]),[k,O]=N.useState(!1),[E,I]=N.useState(!1),[D,z]=N.useState(l!=="system"?l:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),$=N.useRef(null),G=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),R=N.useRef(null),L=N.useRef(!1),W=N.useCallback(Y=>{var te;(te=C.find(me=>me.id===Y.id))!=null&&te.delete||Gi.dismiss(Y.id),_(me=>me.filter(({id:F})=>F!==Y.id))},[C]);return N.useEffect(()=>Gi.subscribe(Y=>{if(Y.dismiss){_(te=>te.map(me=>me.id===Y.id?{...me,delete:!0}:me));return}setTimeout(()=>{c4.flushSync(()=>{_(te=>{let me=te.findIndex(F=>F.id===Y.id);return me!==-1?[...te.slice(0,me),{...te[me],...Y},...te.slice(me+1)]:[Y,...te]})})})}),[]),N.useEffect(()=>{if(l!=="system"){z(l);return}l==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:Y})=>{z(Y?"dark":"light")})},[l]),N.useEffect(()=>{C.length<=1&&O(!1)},[C]),N.useEffect(()=>{let Y=te=>{var me,F;r.every(se=>te[se]||te.code===se)&&(O(!0),(me=$.current)==null||me.focus()),te.code==="Escape"&&(document.activeElement===$.current||(F=$.current)!=null&&F.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[r]),N.useEffect(()=>{if($.current)return()=>{R.current&&(R.current.focus({preventScroll:!0}),R.current=null,L.current=!1)}},[$.current]),C.length?N.createElement("section",{"aria-label":`${x} ${G}`,tabIndex:-1},A.map((Y,te)=>{var me;let[F,se]=Y.split("-");return N.createElement("ol",{key:Y,dir:g==="auto"?xO():g,tabIndex:-1,ref:$,className:s,"data-sonner-toaster":!0,"data-theme":D,"data-y-position":F,"data-x-position":se,style:{"--front-toast-height":`${((me=j[0])==null?void 0:me.height)||0}px`,"--offset":typeof c=="number"?`${c}px`:c||I9,"--width":`${M9}px`,"--gap":`${m}px`,...f},onBlur:ne=>{L.current&&!ne.currentTarget.contains(ne.relatedTarget)&&(L.current=!1,R.current&&(R.current.focus({preventScroll:!0}),R.current=null))},onFocus:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||L.current||(L.current=!0,R.current=ne.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{E||O(!1)},onPointerDown:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||I(!0)},onPointerUp:()=>I(!1)},C.filter(ne=>!ne.position&&te===0||ne.position===Y).map((ne,ae)=>{var De,de;return N.createElement(B9,{key:ne.id,icons:b,index:ae,toast:ne,defaultRichColors:u,duration:(De=p==null?void 0:p.duration)!=null?De:d,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:e,visibleToasts:h,closeButton:(de=p==null?void 0:p.closeButton)!=null?de:o,interacting:E,position:Y,style:p==null?void 0:p.style,unstyled:p==null?void 0:p.unstyled,classNames:p==null?void 0:p.classNames,cancelButtonStyle:p==null?void 0:p.cancelButtonStyle,actionButtonStyle:p==null?void 0:p.actionButtonStyle,removeToast:W,toasts:C.filter(ye=>ye.position==ne.position),heights:j.filter(ye=>ye.position==ne.position),setHeights:P,expandByDefault:i,gap:m,loadingIcon:y,expanded:k,pauseWhenPageIsHidden:w,cn:S})}))})):null};const H9=({...t})=>{const{theme:e="system"}=v9();return a.jsx(U9,{theme:e,className:"toaster group",position:"bottom-right",visibleToasts:2,closeButton:!0,toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:pr-8",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",closeButton:"group-[.toast]:absolute group-[.toast]:left-3 group-[.toast]:top-3 group-[.toast]:h-5 group-[.toast]:w-5 group-[.toast]:rounded-md group-[.toast]:p-1 group-[.toast]:text-foreground/70 group-[.toast]:opacity-100 group-[.toast]:transition-opacity hover:group-[.toast]:text-foreground hover:group-[.toast]:bg-muted/50 focus:group-[.toast]:opacity-100 focus:group-[.toast]:outline-none focus:group-[.toast]:ring-1 focus:group-[.toast]:ring-ring"}},...t})};function Te(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function z9(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function a0(...t){return e=>t.forEach(n=>z9(n,e))}function Pt(...t){return v.useCallback(a0(...t),t)}function G9(t,e){const n=v.createContext(e),r=o=>{const{children:s,...c}=o,l=v.useMemo(()=>c,Object.values(c));return a.jsx(n.Provider,{value:l,children:s})};r.displayName=t+"Provider";function i(o){const s=v.useContext(n);if(s)return s;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${t}\``)}return[r,i]}function Li(t,e=[]){let n=[];function r(o,s){const c=v.createContext(s),l=n.length;n=[...n,s];const u=f=>{var b;const{scope:h,children:p,...g}=f,m=((b=h==null?void 0:h[t])==null?void 0:b[l])||c,y=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:y,children:p})};u.displayName=o+"Provider";function d(f,h){var m;const p=((m=h==null?void 0:h[t])==null?void 0:m[l])||c,g=v.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[u,d]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,V9(i,...e)]}function V9(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var Hs=v.forwardRef((t,e)=>{const{children:n,...r}=t,i=v.Children.toArray(n),o=i.find(K9);if(o){const s=o.props.children,c=i.map(l=>l===o?v.Children.count(s)>1?v.Children.only(null):v.isValidElement(s)?s.props.children:null:l);return a.jsx(E_,{...r,ref:e,children:v.isValidElement(s)?v.cloneElement(s,void 0,c):null})}return a.jsx(E_,{...r,ref:e,children:n})});Hs.displayName="Slot";var E_=v.forwardRef((t,e)=>{const{children:n,...r}=t;if(v.isValidElement(n)){const i=q9(n);return v.cloneElement(n,{...W9(r,n.props),ref:e?a0(e,i):i})}return v.Children.count(n)>1?v.Children.only(null):null});E_.displayName="SlotClone";var dE=({children:t})=>a.jsx(a.Fragment,{children:t});function K9(t){return v.isValidElement(t)&&t.type===dE}function W9(t,e){const n={...e};for(const r in e){const i=t[r],o=e[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...c)=>{o(...c),i(...c)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...t,...n}}function q9(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Y9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],it=Y9.reduce((t,e)=>{const n=v.forwardRef((r,i)=>{const{asChild:o,...s}=r,c=o?Hs:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function u4(t,e){t&&If.flushSync(()=>t.dispatchEvent(e))}function Cr(t){const e=v.useRef(t);return v.useEffect(()=>{e.current=t}),v.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function Q9(t,e=globalThis==null?void 0:globalThis.document){const n=Cr(t);v.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var X9="DismissableLayer",T_="dismissableLayer.update",J9="dismissableLayer.pointerDownOutside",Z9="dismissableLayer.focusOutside",bO,d4=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fg=v.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=t,u=v.useContext(d4),[d,f]=v.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=v.useState({}),g=Pt(e,A=>f(A)),m=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(y),x=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=x>=b,C=nY(A=>{const j=A.target,P=[...u.branches].some(k=>k.contains(j));!S||P||(i==null||i(A),s==null||s(A),A.defaultPrevented||c==null||c())},h),_=rY(A=>{const j=A.target;[...u.branches].some(k=>k.contains(j))||(o==null||o(A),s==null||s(A),A.defaultPrevented||c==null||c())},h);return Q9(A=>{x===u.layers.size-1&&(r==null||r(A),!A.defaultPrevented&&c&&(A.preventDefault(),c()))},h),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(bO=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),wO(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=bO)}},[d,h,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),wO())},[d,u]),v.useEffect(()=>{const A=()=>p({});return document.addEventListener(T_,A),()=>document.removeEventListener(T_,A)},[]),a.jsx(it.div,{...l,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:Te(t.onFocusCapture,_.onFocusCapture),onBlurCapture:Te(t.onBlurCapture,_.onBlurCapture),onPointerDownCapture:Te(t.onPointerDownCapture,C.onPointerDownCapture)})});fg.displayName=X9;var eY="DismissableLayerBranch",tY=v.forwardRef((t,e)=>{const n=v.useContext(d4),r=v.useRef(null),i=Pt(e,r);return v.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),a.jsx(it.div,{...t,ref:i})});tY.displayName=eY;function nY(t,e=globalThis==null?void 0:globalThis.document){const n=Cr(t),r=v.useRef(!1),i=v.useRef(()=>{});return v.useEffect(()=>{const o=c=>{if(c.target&&!r.current){let l=function(){f4(J9,n,u,{discrete:!0})};const u={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);r.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",o),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function rY(t,e=globalThis==null?void 0:globalThis.document){const n=Cr(t),r=v.useRef(!1);return v.useEffect(()=>{const i=o=>{o.target&&!r.current&&f4(Z9,n,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function wO(){const t=new CustomEvent(T_);document.dispatchEvent(t)}function f4(t,e,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?u4(i,o):i.dispatchEvent(o)}var Kr=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},iY=oL.useId||(()=>{}),oY=0;function Xo(t){const[e,n]=v.useState(iY());return Kr(()=>{n(r=>r??String(oY++))},[t]),e?`radix-${e}`:""}const sY=["top","right","bottom","left"],Wc=Math.min,qi=Math.max,Ly=Math.round,ov=Math.floor,qc=t=>({x:t,y:t}),aY={left:"right",right:"left",bottom:"top",top:"bottom"},cY={start:"end",end:"start"};function N_(t,e,n){return qi(t,Wc(e,n))}function Ia(t,e){return typeof t=="function"?t(e):t}function Ra(t){return t.split("-")[0]}function Rf(t){return t.split("-")[1]}function fE(t){return t==="x"?"y":"x"}function hE(t){return t==="y"?"height":"width"}function Yc(t){return["top","bottom"].includes(Ra(t))?"y":"x"}function pE(t){return fE(Yc(t))}function lY(t,e,n){n===void 0&&(n=!1);const r=Rf(t),i=pE(t),o=hE(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Fy(s)),[s,Fy(s)]}function uY(t){const e=Fy(t);return[P_(t),e,P_(e)]}function P_(t){return t.replace(/start|end/g,e=>cY[e])}function dY(t,e,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?o:s;default:return[]}}function fY(t,e,n,r){const i=Rf(t);let o=dY(Ra(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(P_)))),o}function Fy(t){return t.replace(/left|right|bottom|top/g,e=>aY[e])}function hY(t){return{top:0,right:0,bottom:0,left:0,...t}}function h4(t){return typeof t!="number"?hY(t):{top:t,right:t,bottom:t,left:t}}function By(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function SO(t,e,n){let{reference:r,floating:i}=t;const o=Yc(e),s=pE(e),c=hE(s),l=Ra(e),u=o==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[c]/2-i[c]/2;let p;switch(l){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Rf(e)){case"start":p[s]-=h*(n&&u?-1:1);break;case"end":p[s]+=h*(n&&u?-1:1);break}return p}const pY=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,c=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:f}=SO(u,r,l),h=r,p={},g=0;for(let m=0;m({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:c,middlewareData:l}=e,{element:u,padding:d=0}=Ia(t,e)||{};if(u==null)return{};const f=h4(d),h={x:n,y:r},p=pE(i),g=hE(p),m=await s.getDimensions(u),y=p==="y",b=y?"top":"left",x=y?"bottom":"right",w=y?"clientHeight":"clientWidth",S=o.reference[g]+o.reference[p]-h[p]-o.floating[g],C=h[p]-o.reference[p],_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let A=_?_[w]:0;(!A||!await(s.isElement==null?void 0:s.isElement(_)))&&(A=c.floating[w]||o.floating[g]);const j=S/2-C/2,P=A/2-m[g]/2-1,k=Wc(f[b],P),O=Wc(f[x],P),E=k,I=A-m[g]-O,D=A/2-m[g]/2+j,z=N_(E,D,I),$=!l.arrow&&Rf(i)!=null&&D!==z&&o.reference[g]/2-(DD<=0)){var O,E;const D=(((O=o.flip)==null?void 0:O.index)||0)+1,z=A[D];if(z)return{data:{index:D,overflows:k},reset:{placement:z}};let $=(E=k.filter(G=>G.overflows[0]<=0).sort((G,R)=>G.overflows[1]-R.overflows[1])[0])==null?void 0:E.placement;if(!$)switch(p){case"bestFit":{var I;const G=(I=k.filter(R=>{if(_){const L=Yc(R.placement);return L===x||L==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(L=>L>0).reduce((L,W)=>L+W,0)]).sort((R,L)=>R[1]-L[1])[0])==null?void 0:I[0];G&&($=G);break}case"initialPlacement":$=c;break}if(i!==$)return{reset:{placement:$}}}return{}}}};function CO(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function _O(t){return sY.some(e=>t[e]>=0)}const vY=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=Ia(t,e);switch(r){case"referenceHidden":{const o=await Bp(e,{...i,elementContext:"reference"}),s=CO(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:_O(s)}}}case"escaped":{const o=await Bp(e,{...i,altBoundary:!0}),s=CO(o,n.floating);return{data:{escapedOffsets:s,escaped:_O(s)}}}default:return{}}}}};async function yY(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Ra(n),c=Rf(n),l=Yc(n)==="y",u=["left","top"].includes(s)?-1:1,d=o&&l?-1:1,f=Ia(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof g=="number"&&(p=c==="end"?g*-1:g),l?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const xY=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:o,placement:s,middlewareData:c}=e,l=await yY(e,t);return s===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},bY=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:y=>{let{x:b,y:x}=y;return{x:b,y:x}}},...l}=Ia(t,e),u={x:n,y:r},d=await Bp(e,l),f=Yc(Ra(i)),h=fE(f);let p=u[h],g=u[f];if(o){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",x=p+d[y],w=p-d[b];p=N_(x,p,w)}if(s){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",x=g+d[y],w=g-d[b];g=N_(x,g,w)}const m=c.fn({...e,[h]:p,[f]:g});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:o,[f]:s}}}}}},wY=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:o,middlewareData:s}=e,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=Ia(t,e),d={x:n,y:r},f=Yc(i),h=fE(f);let p=d[h],g=d[f];const m=Ia(c,e),y=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const w=h==="y"?"height":"width",S=o.reference[h]-o.floating[w]+y.mainAxis,C=o.reference[h]+o.reference[w]-y.mainAxis;pC&&(p=C)}if(u){var b,x;const w=h==="y"?"width":"height",S=["top","left"].includes(Ra(i)),C=o.reference[f]-o.floating[w]+(S&&((b=s.offset)==null?void 0:b[f])||0)+(S?0:y.crossAxis),_=o.reference[f]+o.reference[w]+(S?0:((x=s.offset)==null?void 0:x[f])||0)-(S?y.crossAxis:0);g_&&(g=_)}return{[h]:p,[f]:g}}}},SY=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:o,platform:s,elements:c}=e,{apply:l=()=>{},...u}=Ia(t,e),d=await Bp(e,u),f=Ra(i),h=Rf(i),p=Yc(i)==="y",{width:g,height:m}=o.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=h===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(b=f,y=h==="end"?"top":"bottom");const x=m-d.top-d.bottom,w=g-d.left-d.right,S=Wc(m-d[y],x),C=Wc(g-d[b],w),_=!e.middlewareData.shift;let A=S,j=C;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(j=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(A=x),_&&!h){const k=qi(d.left,0),O=qi(d.right,0),E=qi(d.top,0),I=qi(d.bottom,0);p?j=g-2*(k!==0||O!==0?k+O:qi(d.left,d.right)):A=m-2*(E!==0||I!==0?E+I:qi(d.top,d.bottom))}await l({...e,availableWidth:j,availableHeight:A});const P=await s.getDimensions(c.floating);return g!==P.width||m!==P.height?{reset:{rects:!0}}:{}}}};function c0(){return typeof window<"u"}function Mf(t){return p4(t)?(t.nodeName||"").toLowerCase():"#document"}function Ji(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Qs(t){var e;return(e=(p4(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function p4(t){return c0()?t instanceof Node||t instanceof Ji(t).Node:!1}function os(t){return c0()?t instanceof Element||t instanceof Ji(t).Element:!1}function zs(t){return c0()?t instanceof HTMLElement||t instanceof Ji(t).HTMLElement:!1}function AO(t){return!c0()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ji(t).ShadowRoot}function hg(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=ss(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function CY(t){return["table","td","th"].includes(Mf(t))}function l0(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function mE(t){const e=gE(),n=os(t)?ss(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function _Y(t){let e=Qc(t);for(;zs(e)&&!Yd(e);){if(mE(e))return e;if(l0(e))return null;e=Qc(e)}return null}function gE(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Yd(t){return["html","body","#document"].includes(Mf(t))}function ss(t){return Ji(t).getComputedStyle(t)}function u0(t){return os(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Qc(t){if(Mf(t)==="html")return t;const e=t.assignedSlot||t.parentNode||AO(t)&&t.host||Qs(t);return AO(e)?e.host:e}function m4(t){const e=Qc(t);return Yd(e)?t.ownerDocument?t.ownerDocument.body:t.body:zs(e)&&hg(e)?e:m4(e)}function Up(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=m4(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Ji(i);if(o){const c=k_(s);return e.concat(s,s.visualViewport||[],hg(i)?i:[],c&&n?Up(c):[])}return e.concat(i,Up(i,[],n))}function k_(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function g4(t){const e=ss(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=zs(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,c=Ly(n)!==o||Ly(r)!==s;return c&&(n=o,r=s),{width:n,height:r,$:c}}function vE(t){return os(t)?t:t.contextElement}function xd(t){const e=vE(t);if(!zs(e))return qc(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=g4(e);let s=(o?Ly(n.width):n.width)/r,c=(o?Ly(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const AY=qc(0);function v4(t){const e=Ji(t);return!gE()||!e.visualViewport?AY:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function jY(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Ji(t)?!1:e}function su(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=vE(t);let s=qc(1);e&&(r?os(r)&&(s=xd(r)):s=xd(t));const c=jY(o,n,r)?v4(o):qc(0);let l=(i.left+c.x)/s.x,u=(i.top+c.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){const h=Ji(o),p=r&&os(r)?Ji(r):r;let g=h,m=k_(g);for(;m&&r&&p!==g;){const y=xd(m),b=m.getBoundingClientRect(),x=ss(m),w=b.left+(m.clientLeft+parseFloat(x.paddingLeft))*y.x,S=b.top+(m.clientTop+parseFloat(x.paddingTop))*y.y;l*=y.x,u*=y.y,d*=y.x,f*=y.y,l+=w,u+=S,g=Ji(m),m=k_(g)}}return By({width:d,height:f,x:l,y:u})}function EY(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=Qs(r),c=e?l0(e.floating):!1;if(r===s||c&&o)return n;let l={scrollLeft:0,scrollTop:0},u=qc(1);const d=qc(0),f=zs(r);if((f||!f&&!o)&&((Mf(r)!=="body"||hg(s))&&(l=u0(r)),zs(r))){const h=su(r);u=xd(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x,y:n.y*u.y-l.scrollTop*u.y+d.y}}function TY(t){return Array.from(t.getClientRects())}function O_(t,e){const n=u0(t).scrollLeft;return e?e.left+n:su(Qs(t)).left+n}function NY(t){const e=Qs(t),n=u0(t),r=t.ownerDocument.body,i=qi(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=qi(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+O_(t);const c=-n.scrollTop;return ss(r).direction==="rtl"&&(s+=qi(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:c}}function PY(t,e){const n=Ji(t),r=Qs(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,c=0,l=0;if(i){o=i.width,s=i.height;const u=gE();(!u||u&&e==="fixed")&&(c=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:c,y:l}}function kY(t,e){const n=su(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=zs(t)?xd(t):qc(1),s=t.clientWidth*o.x,c=t.clientHeight*o.y,l=i*o.x,u=r*o.y;return{width:s,height:c,x:l,y:u}}function jO(t,e,n){let r;if(e==="viewport")r=PY(t,n);else if(e==="document")r=NY(Qs(t));else if(os(e))r=kY(e,n);else{const i=v4(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return By(r)}function y4(t,e){const n=Qc(t);return n===e||!os(n)||Yd(n)?!1:ss(n).position==="fixed"||y4(n,e)}function OY(t,e){const n=e.get(t);if(n)return n;let r=Up(t,[],!1).filter(c=>os(c)&&Mf(c)!=="body"),i=null;const o=ss(t).position==="fixed";let s=o?Qc(t):t;for(;os(s)&&!Yd(s);){const c=ss(s),l=mE(s);!l&&c.position==="fixed"&&(i=null),(o?!l&&!i:!l&&c.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||hg(s)&&!l&&y4(t,s))?r=r.filter(d=>d!==s):i=c,s=Qc(s)}return e.set(t,r),r}function IY(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?l0(e)?[]:OY(e,this._c):[].concat(n),r],c=s[0],l=s.reduce((u,d)=>{const f=jO(e,d,i);return u.top=qi(f.top,u.top),u.right=Wc(f.right,u.right),u.bottom=Wc(f.bottom,u.bottom),u.left=qi(f.left,u.left),u},jO(e,c,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function RY(t){const{width:e,height:n}=g4(t);return{width:e,height:n}}function MY(t,e,n){const r=zs(e),i=Qs(e),o=n==="fixed",s=su(t,!0,o,e);let c={scrollLeft:0,scrollTop:0};const l=qc(0);if(r||!r&&!o)if((Mf(e)!=="body"||hg(i))&&(c=u0(e)),r){const p=su(e,!0,o,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else i&&(l.x=O_(i));let u=0,d=0;if(i&&!r&&!o){const p=i.getBoundingClientRect();d=p.top+c.scrollTop,u=p.left+c.scrollLeft-O_(i,p)}const f=s.left+c.scrollLeft-l.x-u,h=s.top+c.scrollTop-l.y-d;return{x:f,y:h,width:s.width,height:s.height}}function TS(t){return ss(t).position==="static"}function EO(t,e){if(!zs(t)||ss(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Qs(t)===n&&(n=n.ownerDocument.body),n}function x4(t,e){const n=Ji(t);if(l0(t))return n;if(!zs(t)){let i=Qc(t);for(;i&&!Yd(i);){if(os(i)&&!TS(i))return i;i=Qc(i)}return n}let r=EO(t,e);for(;r&&CY(r)&&TS(r);)r=EO(r,e);return r&&Yd(r)&&TS(r)&&!mE(r)?n:r||_Y(t)||n}const DY=async function(t){const e=this.getOffsetParent||x4,n=this.getDimensions,r=await n(t.floating);return{reference:MY(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $Y(t){return ss(t).direction==="rtl"}const LY={convertOffsetParentRelativeRectToViewportRelativeRect:EY,getDocumentElement:Qs,getClippingRect:IY,getOffsetParent:x4,getElementRects:DY,getClientRects:TY,getDimensions:RY,getScale:xd,isElement:os,isRTL:$Y};function FY(t,e){let n=null,r;const i=Qs(t);function o(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function s(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),o();const{left:u,top:d,width:f,height:h}=t.getBoundingClientRect();if(c||e(),!f||!h)return;const p=ov(d),g=ov(i.clientWidth-(u+f)),m=ov(i.clientHeight-(d+h)),y=ov(u),x={rootMargin:-p+"px "+-g+"px "+-m+"px "+-y+"px",threshold:qi(0,Wc(1,l))||1};let w=!0;function S(C){const _=C[0].intersectionRatio;if(_!==l){if(!w)return s();_?s(!1,_):r=setTimeout(()=>{s(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(S,{...x,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(t)}return s(!0),o}function BY(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=vE(t),d=i||o?[...u?Up(u):[],...Up(e)]:[];d.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const f=u&&c?FY(u,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(b=>{let[x]=b;x&&x.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(e)})),n()}),u&&!l&&p.observe(u),p.observe(e));let g,m=l?su(t):null;l&&y();function y(){const b=su(t);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&n(),m=b,g=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(x=>{i&&x.removeEventListener("scroll",n),o&&x.removeEventListener("resize",n)}),f==null||f(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const UY=xY,HY=bY,zY=gY,GY=SY,VY=vY,TO=mY,KY=wY,WY=(t,e,n)=>{const r=new Map,i={platform:LY,...n},o={...i.platform,_c:r};return pY(t,e,{...i,platform:o})};var qv=typeof document<"u"?v.useLayoutEffect:v.useEffect;function Uy(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Uy(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&t.$$typeof)&&!Uy(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function b4(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function NO(t,e){const n=b4(t);return Math.round(e*n)/n}function NS(t){const e=v.useRef(t);return qv(()=>{e.current=t}),e}function qY(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:c=!0,whileElementsMounted:l,open:u}=t,[d,f]=v.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,p]=v.useState(r);Uy(h,r)||p(r);const[g,m]=v.useState(null),[y,b]=v.useState(null),x=v.useCallback(R=>{R!==_.current&&(_.current=R,m(R))},[]),w=v.useCallback(R=>{R!==A.current&&(A.current=R,b(R))},[]),S=o||g,C=s||y,_=v.useRef(null),A=v.useRef(null),j=v.useRef(d),P=l!=null,k=NS(l),O=NS(i),E=NS(u),I=v.useCallback(()=>{if(!_.current||!A.current)return;const R={placement:e,strategy:n,middleware:h};O.current&&(R.platform=O.current),WY(_.current,A.current,R).then(L=>{const W={...L,isPositioned:E.current!==!1};D.current&&!Uy(j.current,W)&&(j.current=W,If.flushSync(()=>{f(W)}))})},[h,e,n,O,E]);qv(()=>{u===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,f(R=>({...R,isPositioned:!1})))},[u]);const D=v.useRef(!1);qv(()=>(D.current=!0,()=>{D.current=!1}),[]),qv(()=>{if(S&&(_.current=S),C&&(A.current=C),S&&C){if(k.current)return k.current(S,C,I);I()}},[S,C,I,k,P]);const z=v.useMemo(()=>({reference:_,floating:A,setReference:x,setFloating:w}),[x,w]),$=v.useMemo(()=>({reference:S,floating:C}),[S,C]),G=v.useMemo(()=>{const R={position:n,left:0,top:0};if(!$.floating)return R;const L=NO($.floating,d.x),W=NO($.floating,d.y);return c?{...R,transform:"translate("+L+"px, "+W+"px)",...b4($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:W}},[n,c,$.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:I,refs:z,elements:$,floatingStyles:G}),[d,I,z,$,G])}const YY=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?TO({element:r.current,padding:i}).fn(n):{}:r?TO({element:r,padding:i}).fn(n):{}}}},QY=(t,e)=>({...UY(t),options:[t,e]}),XY=(t,e)=>({...HY(t),options:[t,e]}),JY=(t,e)=>({...KY(t),options:[t,e]}),ZY=(t,e)=>({...zY(t),options:[t,e]}),eQ=(t,e)=>({...GY(t),options:[t,e]}),tQ=(t,e)=>({...VY(t),options:[t,e]}),nQ=(t,e)=>({...YY(t),options:[t,e]});var rQ="Arrow",w4=v.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...o}=t;return a.jsx(it.svg,{...o,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});w4.displayName=rQ;var iQ=w4;function oQ(t,e=[]){let n=[];function r(o,s){const c=v.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,y=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=v.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,sQ(i,...e)]}function sQ(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function pg(t){const[e,n]=v.useState(void 0);return Kr(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,c;if("borderBoxSize"in o){const l=o.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,c=u.blockSize}else s=t.offsetWidth,c=t.offsetHeight;n({width:s,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var yE="Popper",[S4,Df]=oQ(yE),[aQ,C4]=S4(yE),_4=t=>{const{__scopePopper:e,children:n}=t,[r,i]=v.useState(null);return a.jsx(aQ,{scope:e,anchor:r,onAnchorChange:i,children:n})};_4.displayName=yE;var A4="PopperAnchor",j4=v.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,o=C4(A4,n),s=v.useRef(null),c=Pt(e,s);return v.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:a.jsx(it.div,{...i,ref:c})});j4.displayName=A4;var xE="PopperContent",[cQ,lQ]=S4(xE),E4=v.forwardRef((t,e)=>{var ae,De,de,ye,Ee,Z;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...m}=t,y=C4(xE,n),[b,x]=v.useState(null),w=Pt(e,ct=>x(ct)),[S,C]=v.useState(null),_=pg(S),A=(_==null?void 0:_.width)??0,j=(_==null?void 0:_.height)??0,P=r+(o!=="center"?"-"+o:""),k=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},O=Array.isArray(u)?u:[u],E=O.length>0,I={padding:k,boundary:O.filter(dQ),altBoundary:E},{refs:D,floatingStyles:z,placement:$,isPositioned:G,middlewareData:R}=qY({strategy:"fixed",placement:P,whileElementsMounted:(...ct)=>BY(...ct,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[QY({mainAxis:i+j,alignmentAxis:s}),l&&XY({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?JY():void 0,...I}),l&&ZY({...I}),eQ({...I,apply:({elements:ct,rects:Le,availableWidth:At,availableHeight:lt})=>{const{width:Jt,height:T}=Le.reference,M=ct.floating.style;M.setProperty("--radix-popper-available-width",`${At}px`),M.setProperty("--radix-popper-available-height",`${lt}px`),M.setProperty("--radix-popper-anchor-width",`${Jt}px`),M.setProperty("--radix-popper-anchor-height",`${T}px`)}}),S&&nQ({element:S,padding:c}),fQ({arrowWidth:A,arrowHeight:j}),h&&tQ({strategy:"referenceHidden",...I})]}),[L,W]=P4($),Y=Cr(g);Kr(()=>{G&&(Y==null||Y())},[G,Y]);const te=(ae=R.arrow)==null?void 0:ae.x,me=(De=R.arrow)==null?void 0:De.y,F=((de=R.arrow)==null?void 0:de.centerOffset)!==0,[se,ne]=v.useState();return Kr(()=>{b&&ne(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:G?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[(ye=R.transformOrigin)==null?void 0:ye.x,(Ee=R.transformOrigin)==null?void 0:Ee.y].join(" "),...((Z=R.hide)==null?void 0:Z.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:a.jsx(cQ,{scope:n,placedSide:L,onArrowChange:C,arrowX:te,arrowY:me,shouldHideArrow:F,children:a.jsx(it.div,{"data-side":L,"data-align":W,...m,ref:w,style:{...m.style,animation:G?void 0:"none"}})})})});E4.displayName=xE;var T4="PopperArrow",uQ={top:"bottom",right:"left",bottom:"top",left:"right"},N4=v.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,o=lQ(T4,r),s=uQ[o.placedSide];return a.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:a.jsx(iQ,{...i,ref:n,style:{...i.style,display:"block"}})})});N4.displayName=T4;function dQ(t){return t!==null}var fQ=t=>({name:"transformOrigin",options:t,fn(e){var y,b,x;const{placement:n,rects:r,middlewareData:i}=e,s=((y=i.arrow)==null?void 0:y.centerOffset)!==0,c=s?0:t.arrowWidth,l=s?0:t.arrowHeight,[u,d]=P4(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((b=i.arrow)==null?void 0:b.x)??0)+c/2,p=(((x=i.arrow)==null?void 0:x.y)??0)+l/2;let g="",m="";return u==="bottom"?(g=s?f:`${h}px`,m=`${-l}px`):u==="top"?(g=s?f:`${h}px`,m=`${r.floating.height+l}px`):u==="right"?(g=`${-l}px`,m=s?f:`${p}px`):u==="left"&&(g=`${r.floating.width+l}px`,m=s?f:`${p}px`),{data:{x:g,y:m}}}});function P4(t){const[e,n="center"]=t.split("-");return[e,n]}var k4=_4,bE=j4,wE=E4,SE=N4,hQ="Portal",d0=v.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[i,o]=v.useState(!1);Kr(()=>o(!0),[]);const s=n||i&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return s?c4.createPortal(a.jsx(it.div,{...r,ref:e}),s):null});d0.displayName=hQ;function pQ(t,e){return v.useReducer((n,r)=>e[n][r]??n,t)}var Wr=t=>{const{present:e,children:n}=t,r=mQ(e),i=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),o=Pt(r.ref,gQ(i));return typeof n=="function"||r.isPresent?v.cloneElement(i,{ref:o}):null};Wr.displayName="Presence";function mQ(t){const[e,n]=v.useState(),r=v.useRef({}),i=v.useRef(t),o=v.useRef("none"),s=t?"mounted":"unmounted",[c,l]=pQ(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=sv(r.current);o.current=c==="mounted"?u:"none"},[c]),Kr(()=>{const u=r.current,d=i.current;if(d!==t){const h=o.current,p=sv(u);t?l("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Kr(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,f=p=>{const m=sv(r.current).includes(p.animationName);if(p.target===e&&m&&(l("ANIMATION_END"),!i.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},h=p=>{p.target===e&&(o.current=sv(r.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:v.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function sv(t){return(t==null?void 0:t.animationName)||"none"}function gQ(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function as({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=vQ({defaultProp:e,onChange:n}),o=t!==void 0,s=o?t:r,c=Cr(n),l=v.useCallback(u=>{if(o){const f=typeof u=="function"?u(t):u;f!==t&&c(f)}else i(u)},[o,t,i,c]);return[s,l]}function vQ({defaultProp:t,onChange:e}){const n=v.useState(t),[r]=n,i=v.useRef(r),o=Cr(e);return v.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}var yQ="VisuallyHidden",CE=v.forwardRef((t,e)=>a.jsx(it.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));CE.displayName=yQ;var xQ=CE,[f0,iFe]=Li("Tooltip",[Df]),_E=Df(),O4="TooltipProvider",bQ=700,PO="tooltip.open",[wQ,I4]=f0(O4),R4=t=>{const{__scopeTooltip:e,delayDuration:n=bQ,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=t,[s,c]=v.useState(!0),l=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),a.jsx(wQ,{scope:e,isOpenDelayed:s,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),c(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>c(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:v.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:o})};R4.displayName=O4;var M4="Tooltip",[oFe,h0]=f0(M4),I_="TooltipTrigger",SQ=v.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=h0(I_,n),o=I4(I_,n),s=_E(n),c=v.useRef(null),l=Pt(e,c,i.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),f=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(bE,{asChild:!0,...s,children:a.jsx(it.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Te(t.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:Te(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:Te(t.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Te(t.onFocus,()=>{u.current||i.onOpen()}),onBlur:Te(t.onBlur,i.onClose),onClick:Te(t.onClick,i.onClose)})})});SQ.displayName=I_;var CQ="TooltipPortal",[sFe,_Q]=f0(CQ,{forceMount:void 0}),Qd="TooltipContent",D4=v.forwardRef((t,e)=>{const n=_Q(Qd,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=t,s=h0(Qd,t.__scopeTooltip);return a.jsx(Wr,{present:r||s.open,children:s.disableHoverableContent?a.jsx($4,{side:i,...o,ref:e}):a.jsx(AQ,{side:i,...o,ref:e})})}),AQ=v.forwardRef((t,e)=>{const n=h0(Qd,t.__scopeTooltip),r=I4(Qd,t.__scopeTooltip),i=v.useRef(null),o=Pt(e,i),[s,c]=v.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,h=v.useCallback(()=>{c(null),f(!1)},[f]),p=v.useCallback((g,m)=>{const y=g.currentTarget,b={x:g.clientX,y:g.clientY},x=NQ(b,y.getBoundingClientRect()),w=PQ(b,x),S=kQ(m.getBoundingClientRect()),C=IQ([...w,...S]);c(C),f(!0)},[f]);return v.useEffect(()=>()=>h(),[h]),v.useEffect(()=>{if(l&&d){const g=y=>p(y,d),m=y=>p(y,l);return l.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[l,d,p,h]),v.useEffect(()=>{if(s){const g=m=>{const y=m.target,b={x:m.clientX,y:m.clientY},x=(l==null?void 0:l.contains(y))||(d==null?void 0:d.contains(y)),w=!OQ(b,s);x?h():w&&(h(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[l,d,s,u,h]),a.jsx($4,{...t,ref:o})}),[jQ,EQ]=f0(M4,{isInside:!1}),$4=v.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=t,l=h0(Qd,n),u=_E(n),{onClose:d}=l;return v.useEffect(()=>(document.addEventListener(PO,d),()=>document.removeEventListener(PO,d)),[d]),v.useEffect(()=>{if(l.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(l.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,d]),a.jsx(fg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(wE,{"data-state":l.stateAttribute,...u,...c,ref:e,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(dE,{children:r}),a.jsx(jQ,{scope:n,isInside:!0,children:a.jsx(xQ,{id:l.contentId,role:"tooltip",children:i||r})})]})})});D4.displayName=Qd;var L4="TooltipArrow",TQ=v.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=_E(n);return EQ(L4,n).isInside?null:a.jsx(SE,{...i,...r,ref:e})});TQ.displayName=L4;function NQ(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function PQ(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function kQ(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function OQ(t,e){const{x:n,y:r}=t;let i=!1;for(let o=0,s=e.length-1;or!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function IQ(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),RQ(e)}function RQ(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const o=e[e.length-1],s=e[e.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const o=n[n.length-1],s=n[n.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var MQ=R4,F4=D4;function B4(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=LQ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:s=>{const c=s.split(AE);return c[0]===""&&c.length!==1&&c.shift(),U4(c,e)||$Q(s)},getConflictingClassGroupIds:(s,c)=>{const l=n[s]||[];return c&&r[s]?[...l,...r[s]]:l}}},U4=(t,e)=>{var s;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?U4(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const o=t.join(AE);return(s=e.validators.find(({validator:c})=>c(o)))==null?void 0:s.classGroupId},kO=/^\[(.+)\]$/,$Q=t=>{if(kO.test(t)){const e=kO.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},LQ=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return BQ(Object.entries(t.classGroups),n).forEach(([o,s])=>{R_(s,r,o,e)}),r},R_=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const o=i===""?e:OO(e,i);o.classGroupId=n;return}if(typeof i=="function"){if(FQ(i)){R_(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{R_(s,OO(e,o),n,r)})})},OO=(t,e)=>{let n=t;return e.split(AE).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},FQ=t=>t.isThemeGetter,BQ=(t,e)=>e?t.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,c])=>[e+s,c])):o);return[n,i]}):t,UQ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(o,s)=>{n.set(o,s),e++,e>t&&(e=0,r=n,n=new Map)};return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}},H4="!",HQ=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],o=e.length,s=c=>{const l=[];let u=0,d=0,f;for(let y=0;yd?f-d:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}};return n?c=>n({className:c,parseClassName:s}):s},zQ=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},GQ=t=>({cache:UQ(t.cacheSize),parseClassName:HQ(t),...DQ(t)}),VQ=/\s+/,KQ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,o=[],s=t.trim().split(VQ);let c="";for(let l=s.length-1;l>=0;l-=1){const u=s[l],{modifiers:d,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(u);let g=!!p,m=r(g?h.substring(0,p):h);if(!m){if(!g){c=u+(c.length>0?" "+c:c);continue}if(m=r(h),!m){c=u+(c.length>0?" "+c:c);continue}g=!1}const y=zQ(d).join(":"),b=f?y+H4:y,x=b+m;if(o.includes(x))continue;o.push(x);const w=i(m,g);for(let S=0;S0?" "+c:c)}return c};function WQ(){let t=0,e,n,r="";for(;t{if(typeof t=="string")return t;let e,n="";for(let r=0;rf(d),t());return n=GQ(u),r=n.cache.get,i=n.cache.set,o=c,c(l)}function c(l){const u=r(l);if(u)return u;const d=KQ(l,n);return i(l,d),d}return function(){return o(WQ.apply(null,arguments))}}const In=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},G4=/^\[(?:([a-z-]+):)?(.+)\]$/i,YQ=/^\d+\/\d+$/,QQ=new Set(["px","full","screen"]),XQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,JQ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ZQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,eX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,tX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ra=t=>bd(t)||QQ.has(t)||YQ.test(t),Xa=t=>$f(t,"length",lX),bd=t=>!!t&&!Number.isNaN(Number(t)),PS=t=>$f(t,"number",bd),Sh=t=>!!t&&Number.isInteger(Number(t)),nX=t=>t.endsWith("%")&&bd(t.slice(0,-1)),Ft=t=>G4.test(t),Ja=t=>XQ.test(t),rX=new Set(["length","size","percentage"]),iX=t=>$f(t,rX,V4),oX=t=>$f(t,"position",V4),sX=new Set(["image","url"]),aX=t=>$f(t,sX,dX),cX=t=>$f(t,"",uX),Ch=()=>!0,$f=(t,e,n)=>{const r=G4.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},lX=t=>JQ.test(t)&&!ZQ.test(t),V4=()=>!1,uX=t=>eX.test(t),dX=t=>tX.test(t),fX=()=>{const t=In("colors"),e=In("spacing"),n=In("blur"),r=In("brightness"),i=In("borderColor"),o=In("borderRadius"),s=In("borderSpacing"),c=In("borderWidth"),l=In("contrast"),u=In("grayscale"),d=In("hueRotate"),f=In("invert"),h=In("gap"),p=In("gradientColorStops"),g=In("gradientColorStopPositions"),m=In("inset"),y=In("margin"),b=In("opacity"),x=In("padding"),w=In("saturate"),S=In("scale"),C=In("sepia"),_=In("skew"),A=In("space"),j=In("translate"),P=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",Ft,e],E=()=>[Ft,e],I=()=>["",ra,Xa],D=()=>["auto",bd,Ft],z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],$=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],R=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",Ft],W=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Y=()=>[bd,Ft];return{cacheSize:500,separator:":",theme:{colors:[Ch],spacing:[ra,Xa],blur:["none","",Ja,Ft],brightness:Y(),borderColor:[t],borderRadius:["none","","full",Ja,Ft],borderSpacing:E(),borderWidth:I(),contrast:Y(),grayscale:L(),hueRotate:Y(),invert:L(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[nX,Xa],inset:O(),margin:O(),opacity:Y(),padding:E(),saturate:Y(),scale:Y(),sepia:L(),skew:Y(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",Ft]}],container:["container"],columns:[{columns:[Ja]}],"break-after":[{"break-after":W()}],"break-before":[{"break-before":W()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...z(),Ft]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Sh,Ft]}],basis:[{basis:O()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ft]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",Sh,Ft]}],"grid-cols":[{"grid-cols":[Ch]}],"col-start-end":[{col:["auto",{span:["full",Sh,Ft]},Ft]}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":[Ch]}],"row-start-end":[{row:["auto",{span:[Sh,Ft]},Ft]}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ft]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ft]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...R()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...R(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...R(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ft,e]}],"min-w":[{"min-w":[Ft,e,"min","max","fit"]}],"max-w":[{"max-w":[Ft,e,"none","full","min","max","fit","prose",{screen:[Ja]},Ja]}],h:[{h:[Ft,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ft,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ft,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ft,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Ja,Xa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",PS]}],"font-family":[{font:[Ch]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ft]}],"line-clamp":[{"line-clamp":["none",bd,PS]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ra,Ft]}],"list-image":[{"list-image":["none",Ft]}],"list-style-type":[{list:["none","disc","decimal",Ft]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ra,Xa]}],"underline-offset":[{"underline-offset":["auto",ra,Ft]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ft]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ft]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...z(),oX]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",iX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},aX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...$(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:$()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...$()]}],"outline-offset":[{"outline-offset":[ra,Ft]}],"outline-w":[{outline:[ra,Xa]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[ra,Xa]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ja,cX]}],"shadow-color":[{shadow:[Ch]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Ja,Ft]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ft]}],duration:[{duration:Y()}],ease:[{ease:["linear","in","out","in-out",Ft]}],delay:[{delay:Y()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ft]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[Sh,Ft]}],"translate-x":[{"translate-x":[j]}],"translate-y":[{"translate-y":[j]}],"skew-x":[{"skew-x":[_]}],"skew-y":[{"skew-y":[_]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ft]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ft]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ft]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[ra,Xa,PS]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},hX=qQ(fX);function Ne(...t){return hX(Mt(t))}const pX=MQ,mX=v.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(F4,{ref:r,sideOffset:e,className:Ne("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n}));mX.displayName=F4.displayName;var p0=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},m0=typeof window>"u"||"Deno"in globalThis;function Lo(){}function gX(t,e){return typeof t=="function"?t(e):t}function vX(t){return typeof t=="number"&&t>=0&&t!==1/0}function yX(t,e){return Math.max(t+(e||0)-Date.now(),0)}function IO(t,e){return typeof t=="function"?t(e):t}function xX(t,e){return typeof t=="function"?t(e):t}function RO(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:c}=t;if(s){if(r){if(e.queryHash!==jE(s,e.options))return!1}else if(!zp(e.queryKey,s))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||i&&i!==e.state.fetchStatus||o&&!o(e))}function MO(t,e){const{exact:n,status:r,predicate:i,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(n){if(Hp(e.options.mutationKey)!==Hp(o))return!1}else if(!zp(e.options.mutationKey,o))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function jE(t,e){return((e==null?void 0:e.queryKeyHashFn)||Hp)(t)}function Hp(t){return JSON.stringify(t,(e,n)=>M_(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function zp(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(n=>!zp(t[n],e[n])):!1}function K4(t,e){if(t===e)return t;const n=DO(t)&&DO(e);if(n||M_(t)&&M_(e)){const r=n?t:Object.keys(t),i=r.length,o=n?e:Object.keys(e),s=o.length,c=n?[]:{};let l=0;for(let u=0;u{setTimeout(e,t)})}function wX(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?K4(t,e):e}function SX(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function CX(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var EE=Symbol();function W4(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===EE?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Hl,hc,Id,U$,_X=(U$=class extends p0{constructor(){super();pn(this,Hl);pn(this,hc);pn(this,Id);Vt(this,Id,e=>{if(!m0&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ve(this,hc)||this.setEventListener(ve(this,Id))}onUnsubscribe(){var e;this.hasListeners()||((e=ve(this,hc))==null||e.call(this),Vt(this,hc,void 0))}setEventListener(e){var n;Vt(this,Id,e),(n=ve(this,hc))==null||n.call(this),Vt(this,hc,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ve(this,Hl)!==e&&(Vt(this,Hl,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ve(this,Hl)=="boolean"?ve(this,Hl):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Hl=new WeakMap,hc=new WeakMap,Id=new WeakMap,U$),q4=new _X,Rd,pc,Md,H$,AX=(H$=class extends p0{constructor(){super();pn(this,Rd,!0);pn(this,pc);pn(this,Md);Vt(this,Md,e=>{if(!m0&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){ve(this,pc)||this.setEventListener(ve(this,Md))}onUnsubscribe(){var e;this.hasListeners()||((e=ve(this,pc))==null||e.call(this),Vt(this,pc,void 0))}setEventListener(e){var n;Vt(this,Md,e),(n=ve(this,pc))==null||n.call(this),Vt(this,pc,e(this.setOnline.bind(this)))}setOnline(e){ve(this,Rd)!==e&&(Vt(this,Rd,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ve(this,Rd)}},Rd=new WeakMap,pc=new WeakMap,Md=new WeakMap,H$),Hy=new AX;function jX(){let t,e;const n=new Promise((i,o)=>{t=i,e=o});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}function EX(t){return Math.min(1e3*2**t,3e4)}function Y4(t){return(t??"online")==="online"?Hy.isOnline():!0}var Q4=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function kS(t){return t instanceof Q4}function X4(t){let e=!1,n=0,r=!1,i;const o=jX(),s=m=>{var y;r||(h(new Q4(m)),(y=t.abort)==null||y.call(t))},c=()=>{e=!0},l=()=>{e=!1},u=()=>q4.isFocused()&&(t.networkMode==="always"||Hy.isOnline())&&t.canRun(),d=()=>Y4(t.networkMode)&&t.canRun(),f=m=>{var y;r||(r=!0,(y=t.onSuccess)==null||y.call(t,m),i==null||i(),o.resolve(m))},h=m=>{var y;r||(r=!0,(y=t.onError)==null||y.call(t,m),i==null||i(),o.reject(m))},p=()=>new Promise(m=>{var y;i=b=>{(r||u())&&m(b)},(y=t.onPause)==null||y.call(t)}).then(()=>{var m;i=void 0,r||(m=t.onContinue)==null||m.call(t)}),g=()=>{if(r)return;let m;const y=n===0?t.initialPromise:void 0;try{m=y??t.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(f).catch(b=>{var _;if(r)return;const x=t.retry??(m0?0:3),w=t.retryDelay??EX,S=typeof w=="function"?w(n,b):w,C=x===!0||typeof x=="number"&&nu()?void 0:p()).then(()=>{e?h(b):g()})})};return{promise:o,cancel:s,continue:()=>(i==null||i(),o),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?g():p().then(g),o)}}function TX(){let t=[],e=0,n=c=>{c()},r=c=>{c()},i=c=>setTimeout(c,0);const o=c=>{e?t.push(c):i(()=>{n(c)})},s=()=>{const c=t;t=[],c.length&&i(()=>{r(()=>{c.forEach(l=>{n(l)})})})};return{batch:c=>{let l;e++;try{l=c()}finally{e--,e||s()}return l},batchCalls:c=>(...l)=>{o(()=>{c(...l)})},schedule:o,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{i=c}}}var hi=TX(),zl,z$,J4=(z$=class{constructor(){pn(this,zl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),vX(this.gcTime)&&Vt(this,zl,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(m0?1/0:5*60*1e3))}clearGcTimeout(){ve(this,zl)&&(clearTimeout(ve(this,zl)),Vt(this,zl,void 0))}},zl=new WeakMap,z$),Dd,$d,uo,Xr,og,Gl,Fo,aa,G$,NX=(G$=class extends J4{constructor(e){super();pn(this,Fo);pn(this,Dd);pn(this,$d);pn(this,uo);pn(this,Xr);pn(this,og);pn(this,Gl);Vt(this,Gl,!1),Vt(this,og,e.defaultOptions),this.setOptions(e.options),this.observers=[],Vt(this,uo,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Vt(this,Dd,kX(this.options)),this.state=e.state??ve(this,Dd),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=ve(this,Xr))==null?void 0:e.promise}setOptions(e){this.options={...ve(this,og),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ve(this,uo).remove(this)}setData(e,n){const r=wX(this.state.data,e,this.options);return qr(this,Fo,aa).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){qr(this,Fo,aa).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=ve(this,Xr))==null?void 0:r.promise;return(i=ve(this,Xr))==null||i.cancel(e),n?n.then(Lo).catch(Lo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ve(this,Dd))}isActive(){return this.observers.some(e=>xX(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===EE||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!yX(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=ve(this,Xr))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=ve(this,Xr))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ve(this,uo).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(ve(this,Xr)&&(ve(this,Gl)?ve(this,Xr).cancel({revert:!0}):ve(this,Xr).cancelRetry()),this.scheduleGc()),ve(this,uo).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||qr(this,Fo,aa).call(this,{type:"invalidate"})}fetch(e,n){var l,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ve(this,Xr))return ve(this,Xr).continueRetry(),ve(this,Xr).promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(h=>h.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,i=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(Vt(this,Gl,!0),r.signal)})},o=()=>{const f=W4(this.options,n),h={queryKey:this.queryKey,meta:this.meta};return i(h),Vt(this,Gl,!1),this.options.persister?this.options.persister(f,h,this):f(h)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};i(s),(l=this.options.behavior)==null||l.onFetch(s,this),Vt(this,$d,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&qr(this,Fo,aa).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const c=f=>{var h,p,g,m;kS(f)&&f.silent||qr(this,Fo,aa).call(this,{type:"error",error:f}),kS(f)||((p=(h=ve(this,uo).config).onError)==null||p.call(h,f,this),(m=(g=ve(this,uo).config).onSettled)==null||m.call(g,this.state.data,f,this)),this.scheduleGc()};return Vt(this,Xr,X4({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var h,p,g,m;if(f===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(y){c(y);return}(p=(h=ve(this,uo).config).onSuccess)==null||p.call(h,f,this),(m=(g=ve(this,uo).config).onSettled)==null||m.call(g,f,this.state.error,this),this.scheduleGc()},onError:c,onFail:(f,h)=>{qr(this,Fo,aa).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{qr(this,Fo,aa).call(this,{type:"pause"})},onContinue:()=>{qr(this,Fo,aa).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),ve(this,Xr).start()}},Dd=new WeakMap,$d=new WeakMap,uo=new WeakMap,Xr=new WeakMap,og=new WeakMap,Gl=new WeakMap,Fo=new WeakSet,aa=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...PX(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return kS(i)&&i.revert&&ve(this,$d)?{...ve(this,$d),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),hi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ve(this,uo).notify({query:this,type:"updated",action:e})})},G$);function PX(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Y4(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function kX(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ss,V$,OX=(V$=class extends p0{constructor(e={}){super();pn(this,Ss);this.config=e,Vt(this,Ss,new Map)}build(e,n,r){const i=n.queryKey,o=n.queryHash??jE(i,n);let s=this.get(o);return s||(s=new NX({cache:this,queryKey:i,queryHash:o,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(s)),s}add(e){ve(this,Ss).has(e.queryHash)||(ve(this,Ss).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=ve(this,Ss).get(e.queryHash);n&&(e.destroy(),n===e&&ve(this,Ss).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){hi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ve(this,Ss).get(e)}getAll(){return[...ve(this,Ss).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>RO(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>RO(e,r)):n}notify(e){hi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){hi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){hi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ss=new WeakMap,V$),Cs,ai,Vl,_s,Za,K$,IX=(K$=class extends J4{constructor(e){super();pn(this,_s);pn(this,Cs);pn(this,ai);pn(this,Vl);this.mutationId=e.mutationId,Vt(this,ai,e.mutationCache),Vt(this,Cs,[]),this.state=e.state||RX(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){ve(this,Cs).includes(e)||(ve(this,Cs).push(e),this.clearGcTimeout(),ve(this,ai).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Vt(this,Cs,ve(this,Cs).filter(n=>n!==e)),this.scheduleGc(),ve(this,ai).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ve(this,Cs).length||(this.state.status==="pending"?this.scheduleGc():ve(this,ai).remove(this))}continue(){var e;return((e=ve(this,Vl))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,o,s,c,l,u,d,f,h,p,g,m,y,b,x,w,S,C,_,A;Vt(this,Vl,X4({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(j,P)=>{qr(this,_s,Za).call(this,{type:"failed",failureCount:j,error:P})},onPause:()=>{qr(this,_s,Za).call(this,{type:"pause"})},onContinue:()=>{qr(this,_s,Za).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ve(this,ai).canRun(this)}));const n=this.state.status==="pending",r=!ve(this,Vl).canStart();try{if(!n){qr(this,_s,Za).call(this,{type:"pending",variables:e,isPaused:r}),await((o=(i=ve(this,ai).config).onMutate)==null?void 0:o.call(i,e,this));const P=await((c=(s=this.options).onMutate)==null?void 0:c.call(s,e));P!==this.state.context&&qr(this,_s,Za).call(this,{type:"pending",context:P,variables:e,isPaused:r})}const j=await ve(this,Vl).start();return await((u=(l=ve(this,ai).config).onSuccess)==null?void 0:u.call(l,j,e,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,j,e,this.state.context)),await((p=(h=ve(this,ai).config).onSettled)==null?void 0:p.call(h,j,null,this.state.variables,this.state.context,this)),await((m=(g=this.options).onSettled)==null?void 0:m.call(g,j,null,e,this.state.context)),qr(this,_s,Za).call(this,{type:"success",data:j}),j}catch(j){try{throw await((b=(y=ve(this,ai).config).onError)==null?void 0:b.call(y,j,e,this.state.context,this)),await((w=(x=this.options).onError)==null?void 0:w.call(x,j,e,this.state.context)),await((C=(S=ve(this,ai).config).onSettled)==null?void 0:C.call(S,void 0,j,this.state.variables,this.state.context,this)),await((A=(_=this.options).onSettled)==null?void 0:A.call(_,void 0,j,e,this.state.context)),j}finally{qr(this,_s,Za).call(this,{type:"error",error:j})}}finally{ve(this,ai).runNext(this)}}},Cs=new WeakMap,ai=new WeakMap,Vl=new WeakMap,_s=new WeakSet,Za=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),hi.batch(()=>{ve(this,Cs).forEach(r=>{r.onMutationUpdate(e)}),ve(this,ai).notify({mutation:this,type:"updated",action:e})})},K$);function RX(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var zi,sg,W$,MX=(W$=class extends p0{constructor(e={}){super();pn(this,zi);pn(this,sg);this.config=e,Vt(this,zi,new Map),Vt(this,sg,Date.now())}build(e,n,r){const i=new IX({mutationCache:this,mutationId:++Fg(this,sg)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){const n=av(e),r=ve(this,zi).get(n)??[];r.push(e),ve(this,zi).set(n,r),this.notify({type:"added",mutation:e})}remove(e){var r;const n=av(e);if(ve(this,zi).has(n)){const i=(r=ve(this,zi).get(n))==null?void 0:r.filter(o=>o!==e);i&&(i.length===0?ve(this,zi).delete(n):ve(this,zi).set(n,i))}this.notify({type:"removed",mutation:e})}canRun(e){var r;const n=(r=ve(this,zi).get(av(e)))==null?void 0:r.find(i=>i.state.status==="pending");return!n||n===e}runNext(e){var r;const n=(r=ve(this,zi).get(av(e)))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){hi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}getAll(){return[...ve(this,zi).values()].flat()}find(e){const n={exact:!0,...e};return this.getAll().find(r=>MO(n,r))}findAll(e={}){return this.getAll().filter(n=>MO(e,n))}notify(e){hi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return hi.batch(()=>Promise.all(e.map(n=>n.continue().catch(Lo))))}},zi=new WeakMap,sg=new WeakMap,W$);function av(t){var e;return((e=t.options.scope)==null?void 0:e.id)??String(t.mutationId)}function LO(t){return{onFetch:(e,n)=>{var d,f,h,p,g;const r=e.options,i=(h=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,o=((p=e.state.data)==null?void 0:p.pages)||[],s=((g=e.state.data)==null?void 0:g.pageParams)||[];let c={pages:[],pageParams:[]},l=0;const u=async()=>{let m=!1;const y=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(e.signal.aborted?m=!0:e.signal.addEventListener("abort",()=>{m=!0}),e.signal)})},b=W4(e.options,e.fetchOptions),x=async(w,S,C)=>{if(m)return Promise.reject();if(S==null&&w.pages.length)return Promise.resolve(w);const _={queryKey:e.queryKey,pageParam:S,direction:C?"backward":"forward",meta:e.options.meta};y(_);const A=await b(_),{maxPages:j}=e.options,P=C?CX:SX;return{pages:P(w.pages,A,j),pageParams:P(w.pageParams,S,j)}};if(i&&o.length){const w=i==="backward",S=w?DX:FO,C={pages:o,pageParams:s},_=S(r,C);c=await x(C,_,w)}else{const w=t??o.length;do{const S=l===0?s[0]??r.initialPageParam:FO(r,c);if(l>0&&S==null)break;c=await x(c,S),l++}while(l{var m,y;return(y=(m=e.options).persister)==null?void 0:y.call(m,u,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=u}}}function FO(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function DX(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var Yn,mc,gc,Ld,Fd,vc,Bd,Ud,q$,$X=(q$=class{constructor(t={}){pn(this,Yn);pn(this,mc);pn(this,gc);pn(this,Ld);pn(this,Fd);pn(this,vc);pn(this,Bd);pn(this,Ud);Vt(this,Yn,t.queryCache||new OX),Vt(this,mc,t.mutationCache||new MX),Vt(this,gc,t.defaultOptions||{}),Vt(this,Ld,new Map),Vt(this,Fd,new Map),Vt(this,vc,0)}mount(){Fg(this,vc)._++,ve(this,vc)===1&&(Vt(this,Bd,q4.subscribe(async t=>{t&&(await this.resumePausedMutations(),ve(this,Yn).onFocus())})),Vt(this,Ud,Hy.subscribe(async t=>{t&&(await this.resumePausedMutations(),ve(this,Yn).onOnline())})))}unmount(){var t,e;Fg(this,vc)._--,ve(this,vc)===0&&((t=ve(this,Bd))==null||t.call(this),Vt(this,Bd,void 0),(e=ve(this,Ud))==null||e.call(this),Vt(this,Ud,void 0))}isFetching(t){return ve(this,Yn).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ve(this,mc).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ve(this,Yn).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);if(e===void 0)return this.fetchQuery(t);{const n=this.defaultQueryOptions(t),r=ve(this,Yn).build(this,n);return t.revalidateIfStale&&r.isStaleByTime(IO(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(e)}}getQueriesData(t){return ve(this,Yn).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=ve(this,Yn).get(r.queryHash),o=i==null?void 0:i.state.data,s=gX(e,o);if(s!==void 0)return ve(this,Yn).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(t,e,n){return hi.batch(()=>ve(this,Yn).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ve(this,Yn).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ve(this,Yn);hi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ve(this,Yn),r={type:"active",...t};return hi.batch(()=>(n.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries(r,e)))}cancelQueries(t={},e={}){const n={revert:!0,...e},r=hi.batch(()=>ve(this,Yn).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Lo).catch(Lo)}invalidateQueries(t={},e={}){return hi.batch(()=>{if(ve(this,Yn).findAll(t).forEach(r=>{r.invalidate()}),t.refetchType==="none")return Promise.resolve();const n={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(n,e)})}refetchQueries(t={},e){const n={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},r=hi.batch(()=>ve(this,Yn).findAll(t).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(Lo)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(Lo)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=ve(this,Yn).build(this,e);return n.isStaleByTime(IO(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Lo).catch(Lo)}fetchInfiniteQuery(t){return t.behavior=LO(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Lo).catch(Lo)}ensureInfiniteQueryData(t){return t.behavior=LO(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Hy.isOnline()?ve(this,mc).resumePausedMutations():Promise.resolve()}getQueryCache(){return ve(this,Yn)}getMutationCache(){return ve(this,mc)}getDefaultOptions(){return ve(this,gc)}setDefaultOptions(t){Vt(this,gc,t)}setQueryDefaults(t,e){ve(this,Ld).set(Hp(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ve(this,Ld).values()];let n={};return e.forEach(r=>{zp(t,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(t,e){ve(this,Fd).set(Hp(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ve(this,Fd).values()];let n={};return e.forEach(r=>{zp(t,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ve(this,gc).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=jE(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.enabled!==!0&&e.queryFn===EE&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ve(this,gc).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ve(this,Yn).clear(),ve(this,mc).clear()}},Yn=new WeakMap,mc=new WeakMap,gc=new WeakMap,Ld=new WeakMap,Fd=new WeakMap,vc=new WeakMap,Bd=new WeakMap,Ud=new WeakMap,q$),LX=v.createContext(void 0),FX=({client:t,children:e})=>(v.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),a.jsx(LX.Provider,{value:t,children:e}));/** - * @remix-run/router v1.20.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Gp(){return Gp=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Z4(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function UX(){return Math.random().toString(36).substr(2,8)}function UO(t,e){return{usr:t.state,key:t.key,idx:e}}function D_(t,e,n,r){return n===void 0&&(n=null),Gp({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Lf(e):e,{state:n,key:e&&e.key||r||UX()})}function zy(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Lf(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function HX(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:o=!1}=r,s=i.history,c=bc.Pop,l=null,u=d();u==null&&(u=0,s.replaceState(Gp({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function f(){c=bc.Pop;let y=d(),b=y==null?null:y-u;u=y,l&&l({action:c,location:m.location,delta:b})}function h(y,b){c=bc.Push;let x=D_(m.location,y,b);u=d()+1;let w=UO(x,u),S=m.createHref(x);try{s.pushState(w,"",S)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;i.location.assign(S)}o&&l&&l({action:c,location:m.location,delta:1})}function p(y,b){c=bc.Replace;let x=D_(m.location,y,b);u=d();let w=UO(x,u),S=m.createHref(x);s.replaceState(w,"",S),o&&l&&l({action:c,location:m.location,delta:0})}function g(y){let b=i.location.origin!=="null"?i.location.origin:i.location.href,x=typeof y=="string"?y:zy(y);return x=x.replace(/ $/,"%20"),or(b,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,b)}let m={get action(){return c},get location(){return t(i,s)},listen(y){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(BO,f),l=y,()=>{i.removeEventListener(BO,f),l=null}},createHref(y){return e(i,y)},createURL:g,encodeLocation(y){let b=g(y);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:h,replace:p,go(y){return s.go(y)}};return m}var HO;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(HO||(HO={}));function zX(t,e,n){return n===void 0&&(n="/"),GX(t,e,n,!1)}function GX(t,e,n,r){let i=typeof e=="string"?Lf(e):e,o=TE(i.pathname||"/",n);if(o==null)return null;let s=e5(t);VX(s);let c=null;for(let l=0;c==null&&l{let l={relativePath:c===void 0?o.path||"":c,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};l.relativePath.startsWith("/")&&(or(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Oc([r,l.relativePath]),d=n.concat(l);o.children&&o.children.length>0&&(or(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),e5(o.children,e,d,u)),!(o.path==null&&!o.index)&&e.push({path:u,score:JX(u,o.index),routesMeta:d})};return t.forEach((o,s)=>{var c;if(o.path===""||!((c=o.path)!=null&&c.includes("?")))i(o,s);else for(let l of t5(o.path))i(o,s,l)}),e}function t5(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return i?[o,""]:[o];let s=t5(r.join("/")),c=[];return c.push(...s.map(l=>l===""?o:[o,l].join("/"))),i&&c.push(...s),c.map(l=>t.startsWith("/")&&l===""?"/":l)}function VX(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:ZX(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const KX=/^:[\w-]+$/,WX=3,qX=2,YX=1,QX=10,XX=-2,zO=t=>t==="*";function JX(t,e){let n=t.split("/"),r=n.length;return n.some(zO)&&(r+=XX),e&&(r+=qX),n.filter(i=>!zO(i)).reduce((i,o)=>i+(KX.test(o)?WX:o===""?YX:QX),r)}function ZX(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function eJ(t,e,n){let{routesMeta:r}=t,i={},o="/",s=[];for(let c=0;c{let{paramName:h,isOptional:p}=d;if(h==="*"){let m=c[f]||"";s=o.slice(0,o.length-m.length).replace(/(.)\/+$/,"$1")}const g=c[f];return p&&!g?u[h]=void 0:u[h]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:s,pattern:t}}function tJ(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Z4(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,c,l)=>(r.push({paramName:c,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function nJ(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Z4(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function TE(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function rJ(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Lf(t):t;return{pathname:n?n.startsWith("/")?n:iJ(n,e):e,search:aJ(r),hash:cJ(i)}}function iJ(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function OS(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function oJ(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function NE(t,e){let n=oJ(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function PE(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=Lf(t):(i=Gp({},t),or(!i.pathname||!i.pathname.includes("?"),OS("?","pathname","search",i)),or(!i.pathname||!i.pathname.includes("#"),OS("#","pathname","hash",i)),or(!i.search||!i.search.includes("#"),OS("#","search","hash",i)));let o=t===""||i.pathname==="",s=o?"/":i.pathname,c;if(s==null)c=n;else{let f=e.length-1;if(!r&&s.startsWith("..")){let h=s.split("/");for(;h[0]==="..";)h.shift(),f-=1;i.pathname=h.join("/")}c=f>=0?e[f]:"/"}let l=rJ(i,c),u=s&&s!=="/"&&s.endsWith("/"),d=(o||s===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}const Oc=t=>t.join("/").replace(/\/\/+/g,"/"),sJ=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),aJ=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,cJ=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function lJ(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const n5=["post","put","patch","delete"];new Set(n5);const uJ=["get",...n5];new Set(uJ);/** - * React Router v6.27.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Vp(){return Vp=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),v.useCallback(function(u,d){if(d===void 0&&(d={}),!c.current)return;if(typeof u=="number"){r.go(u);return}let f=PE(u,JSON.parse(s),o,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:Oc([e,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[e,r,s,o,t])}function OE(){let{matches:t}=v.useContext(Ga),e=t[t.length-1];return e?e.params:{}}function o5(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=v.useContext(cl),{matches:i}=v.useContext(Ga),{pathname:o}=Fi(),s=JSON.stringify(NE(i,r.v7_relativeSplatPath));return v.useMemo(()=>PE(t,JSON.parse(s),o,n==="path"),[t,s,o,n])}function pJ(t,e){return mJ(t,e)}function mJ(t,e,n,r){Ff()||or(!1);let{navigator:i}=v.useContext(cl),{matches:o}=v.useContext(Ga),s=o[o.length-1],c=s?s.params:{};s&&s.pathname;let l=s?s.pathnameBase:"/";s&&s.route;let u=Fi(),d;if(e){var f;let y=typeof e=="string"?Lf(e):e;l==="/"||(f=y.pathname)!=null&&f.startsWith(l)||or(!1),d=y}else d=u;let h=d.pathname||"/",p=h;if(l!=="/"){let y=l.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(y.length).join("/")}let g=zX(t,{pathname:p}),m=bJ(g&&g.map(y=>Object.assign({},y,{params:Object.assign({},c,y.params),pathname:Oc([l,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:Oc([l,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),o,n,r);return e&&m?v.createElement(g0.Provider,{value:{location:Vp({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:bc.Pop}},m):m}function gJ(){let t=_J(),e=lJ(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},e),n?v.createElement("pre",{style:i},n):null,null)}const vJ=v.createElement(gJ,null);class yJ extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?v.createElement(Ga.Provider,{value:this.props.routeContext},v.createElement(r5.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function xJ(t){let{routeContext:e,match:n,children:r}=t,i=v.useContext(kE);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(Ga.Provider,{value:e},r)}function bJ(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var o;if(!n)return null;if(n.errors)t=n.matches;else if((o=r)!=null&&o.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let s=t,c=(i=n)==null?void 0:i.errors;if(c!=null){let d=s.findIndex(f=>f.route.id&&(c==null?void 0:c[f.route.id])!==void 0);d>=0||or(!1),s=s.slice(0,Math.min(s.length,d+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((d,f,h)=>{let p,g=!1,m=null,y=null;n&&(p=c&&f.route.id?c[f.route.id]:void 0,m=f.route.errorElement||vJ,l&&(u<0&&h===0?(g=!0,y=null):u===h&&(g=!0,y=f.route.hydrateFallbackElement||null)));let b=e.concat(s.slice(0,h+1)),x=()=>{let w;return p?w=m:g?w=y:f.route.Component?w=v.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,v.createElement(xJ,{match:f,routeContext:{outlet:d,matches:b,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?v.createElement(yJ,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:x(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):x()},null)}var s5=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(s5||{}),Gy=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Gy||{});function wJ(t){let e=v.useContext(kE);return e||or(!1),e}function SJ(t){let e=v.useContext(dJ);return e||or(!1),e}function CJ(t){let e=v.useContext(Ga);return e||or(!1),e}function a5(t){let e=CJ(),n=e.matches[e.matches.length-1];return n.route.id||or(!1),n.route.id}function _J(){var t;let e=v.useContext(r5),n=SJ(Gy.UseRouteError),r=a5(Gy.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function AJ(){let{router:t}=wJ(s5.UseNavigateStable),e=a5(Gy.UseNavigateStable),n=v.useRef(!1);return i5(()=>{n.current=!0}),v.useCallback(function(i,o){o===void 0&&(o={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Vp({fromRouteId:e},o)))},[t,e])}function c5(t){let{to:e,replace:n,state:r,relative:i}=t;Ff()||or(!1);let{future:o,static:s}=v.useContext(cl),{matches:c}=v.useContext(Ga),{pathname:l}=Fi(),u=ar(),d=PE(e,NE(c,o.v7_relativeSplatPath),l,i==="path"),f=JSON.stringify(d);return v.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function Mo(t){or(!1)}function jJ(t){let{basename:e="/",children:n=null,location:r,navigationType:i=bc.Pop,navigator:o,static:s=!1,future:c}=t;Ff()&&or(!1);let l=e.replace(/^\/*/,"/"),u=v.useMemo(()=>({basename:l,navigator:o,static:s,future:Vp({v7_relativeSplatPath:!1},c)}),[l,c,o,s]);typeof r=="string"&&(r=Lf(r));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:g="default"}=r,m=v.useMemo(()=>{let y=TE(d,l);return y==null?null:{location:{pathname:y,search:f,hash:h,state:p,key:g},navigationType:i}},[l,d,f,h,p,g,i]);return m==null?null:v.createElement(cl.Provider,{value:u},v.createElement(g0.Provider,{children:n,value:m}))}function EJ(t){let{children:e,location:n}=t;return pJ($_(e),n)}new Promise(()=>{});function $_(t,e){e===void 0&&(e=[]);let n=[];return v.Children.forEach(t,(r,i)=>{if(!v.isValidElement(r))return;let o=[...e,i];if(r.type===v.Fragment){n.push.apply(n,$_(r.props.children,o));return}r.type!==Mo&&or(!1),!r.props.index||!r.props.children||or(!1);let s={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(s.children=$_(r.props.children,o)),n.push(s)}),n}/** - * React Router DOM v6.27.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function L_(){return L_=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function NJ(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function PJ(t,e){return t.button===0&&(!e||e==="_self")&&!NJ(t)}function F_(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function kJ(t,e){let n=F_(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(o=>{n.append(i,o)})}),n}const OJ=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],IJ="6";try{window.__reactRouterVersion=IJ}catch{}const RJ="startTransition",VO=oL[RJ];function MJ(t){let{basename:e,children:n,future:r,window:i}=t,o=v.useRef();o.current==null&&(o.current=BX({window:i,v5Compat:!0}));let s=o.current,[c,l]=v.useState({action:s.action,location:s.location}),{v7_startTransition:u}=r||{},d=v.useCallback(f=>{u&&VO?VO(()=>l(f)):l(f)},[l,u]);return v.useLayoutEffect(()=>s.listen(d),[s,d]),v.createElement(jJ,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:s,future:r})}const DJ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",$J=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bo=v.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:o,replace:s,state:c,target:l,to:u,preventScrollReset:d,viewTransition:f}=e,h=TJ(e,OJ),{basename:p}=v.useContext(cl),g,m=!1;if(typeof u=="string"&&$J.test(u)&&(g=u,DJ))try{let w=new URL(window.location.href),S=u.startsWith("//")?new URL(w.protocol+u):new URL(u),C=TE(S.pathname,p);S.origin===w.origin&&C!=null?u=C+S.search+S.hash:m=!0}catch{}let y=fJ(u,{relative:i}),b=LJ(u,{replace:s,state:c,target:l,preventScrollReset:d,relative:i,viewTransition:f});function x(w){r&&r(w),w.defaultPrevented||b(w)}return v.createElement("a",L_({},h,{href:g||y,onClick:m||o?r:x,ref:n,target:l}))});var KO;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(KO||(KO={}));var WO;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(WO||(WO={}));function LJ(t,e){let{target:n,replace:r,state:i,preventScrollReset:o,relative:s,viewTransition:c}=e===void 0?{}:e,l=ar(),u=Fi(),d=o5(t,{relative:s});return v.useCallback(f=>{if(PJ(f,n)){f.preventDefault();let h=r!==void 0?r:zy(u)===zy(d);l(t,{replace:h,state:i,preventScrollReset:o,relative:s,viewTransition:c})}},[u,l,d,r,i,n,t,o,s,c])}function FJ(t){let e=v.useRef(F_(t)),n=v.useRef(!1),r=Fi(),i=v.useMemo(()=>kJ(r.search,n.current?null:e.current),[r.search]),o=ar(),s=v.useCallback((c,l)=>{const u=F_(typeof c=="function"?c(i):c);n.current=!0,o("?"+u,l)},[o,i]);return[i,s]}/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const BJ=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),l5=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var UJ={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const HJ=v.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:s,...c},l)=>v.createElement("svg",{ref:l,...UJ,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:l5("lucide",i),...c},[...s.map(([u,d])=>v.createElement(u,d)),...Array.isArray(o)?o:[o]]));/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Me=(t,e)=>{const n=v.forwardRef(({className:r,...i},o)=>v.createElement(HJ,{ref:o,iconNode:e,className:l5(`lucide-${BJ(t)}`,r),...i}));return n.displayName=`${t}`,n};/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pa=Me("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qO=Me("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Kp=Me("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IS=Me("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ya=Me("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const au=Me("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const YO=Me("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zJ=Me("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const GJ=Me("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const B_=Me("ChartNoAxesColumnIncreasing",[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const VJ=Me("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Gs=Me("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ma=Me("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fo=Me("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cu=Me("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const KJ=Me("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IE=Me("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zh=Me("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const u5=Me("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const WJ=Me("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qJ=Me("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RE=Me("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const YJ=Me("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Wp=Me("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const d5=Me("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const QO=Me("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lu=Me("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const U_=Me("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const QJ=Me("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const H_=Me("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ME=Me("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const f5=Me("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ho=Me("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const XJ=Me("Grid2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const z_=Me("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vy=Me("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Yv=Me("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const JJ=Me("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ZJ=Me("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const G_=Me("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const eZ=Me("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uu=Me("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cv=Me("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ds=Me("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tZ=Me("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const XO=Me("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const JO=Me("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nZ=Me("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rZ=Me("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const As=Me("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vs=Me("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const iZ=Me("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ZO=Me("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const eI=Me("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oZ=Me("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sZ=Me("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ur=Me("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aZ=Me("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wd=Me("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DE=Me("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $E=Me("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LE=Me("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cZ=Me("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lZ=Me("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uZ=Me("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dZ=Me("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fZ=Me("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ky=Me("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hZ=Me("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Qv=Me("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nr=Me("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pZ=Me("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mZ=Me("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const h5=Me("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qp=Me("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Dr=Me("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gZ=Me("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Jo=Me("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const p5=Me("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function m5(t,e){return function(){return t.apply(e,arguments)}}const{toString:vZ}=Object.prototype,{getPrototypeOf:FE}=Object,{iterator:v0,toStringTag:g5}=Symbol,y0=(t=>e=>{const n=vZ.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),hs=t=>(t=t.toLowerCase(),e=>y0(e)===t),x0=t=>e=>typeof e===t,{isArray:Bf}=Array,Yp=x0("undefined");function yZ(t){return t!==null&&!Yp(t)&&t.constructor!==null&&!Yp(t.constructor)&&Ri(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const v5=hs("ArrayBuffer");function xZ(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&v5(t.buffer),e}const bZ=x0("string"),Ri=x0("function"),y5=x0("number"),b0=t=>t!==null&&typeof t=="object",wZ=t=>t===!0||t===!1,Xv=t=>{if(y0(t)!=="object")return!1;const e=FE(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(g5 in t)&&!(v0 in t)},SZ=hs("Date"),CZ=hs("File"),_Z=hs("Blob"),AZ=hs("FileList"),jZ=t=>b0(t)&&Ri(t.pipe),EZ=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Ri(t.append)&&((e=y0(t))==="formdata"||e==="object"&&Ri(t.toString)&&t.toString()==="[object FormData]"))},TZ=hs("URLSearchParams"),[NZ,PZ,kZ,OZ]=["ReadableStream","Request","Response","Headers"].map(hs),IZ=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function mg(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),Bf(t))for(r=0,i=t.length;r0;)if(i=n[r],e===i.toLowerCase())return i;return null}const kl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,b5=t=>!Yp(t)&&t!==kl;function V_(){const{caseless:t}=b5(this)&&this||{},e={},n=(r,i)=>{const o=t&&x5(e,i)||i;Xv(e[o])&&Xv(r)?e[o]=V_(e[o],r):Xv(r)?e[o]=V_({},r):Bf(r)?e[o]=r.slice():e[o]=r};for(let r=0,i=arguments.length;r(mg(e,(i,o)=>{n&&Ri(i)?t[o]=m5(i,n):t[o]=i},{allOwnKeys:r}),t),MZ=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),DZ=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},$Z=(t,e,n,r)=>{let i,o,s;const c={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],(!r||r(s,t,e))&&!c[s]&&(e[s]=t[s],c[s]=!0);t=n!==!1&&FE(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},LZ=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},FZ=t=>{if(!t)return null;if(Bf(t))return t;let e=t.length;if(!y5(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},BZ=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&FE(Uint8Array)),UZ=(t,e)=>{const r=(t&&t[v0]).call(t);let i;for(;(i=r.next())&&!i.done;){const o=i.value;e.call(t,o[0],o[1])}},HZ=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},zZ=hs("HTMLFormElement"),GZ=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),tI=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),VZ=hs("RegExp"),w5=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};mg(n,(i,o)=>{let s;(s=e(i,o,t))!==!1&&(r[o]=s||i)}),Object.defineProperties(t,r)},KZ=t=>{w5(t,(e,n)=>{if(Ri(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Ri(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},WZ=(t,e)=>{const n={},r=i=>{i.forEach(o=>{n[o]=!0})};return Bf(t)?r(t):r(String(t).split(e)),n},qZ=()=>{},YZ=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function QZ(t){return!!(t&&Ri(t.append)&&t[g5]==="FormData"&&t[v0])}const XZ=t=>{const e=new Array(10),n=(r,i)=>{if(b0(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const o=Bf(r)?[]:{};return mg(r,(s,c)=>{const l=n(s,i+1);!Yp(l)&&(o[c]=l)}),e[i]=void 0,o}}return r};return n(t,0)},JZ=hs("AsyncFunction"),ZZ=t=>t&&(b0(t)||Ri(t))&&Ri(t.then)&&Ri(t.catch),S5=((t,e)=>t?setImmediate:e?((n,r)=>(kl.addEventListener("message",({source:i,data:o})=>{i===kl&&o===n&&r.length&&r.shift()()},!1),i=>{r.push(i),kl.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ri(kl.postMessage)),eee=typeof queueMicrotask<"u"?queueMicrotask.bind(kl):typeof process<"u"&&process.nextTick||S5,tee=t=>t!=null&&Ri(t[v0]),ie={isArray:Bf,isArrayBuffer:v5,isBuffer:yZ,isFormData:EZ,isArrayBufferView:xZ,isString:bZ,isNumber:y5,isBoolean:wZ,isObject:b0,isPlainObject:Xv,isReadableStream:NZ,isRequest:PZ,isResponse:kZ,isHeaders:OZ,isUndefined:Yp,isDate:SZ,isFile:CZ,isBlob:_Z,isRegExp:VZ,isFunction:Ri,isStream:jZ,isURLSearchParams:TZ,isTypedArray:BZ,isFileList:AZ,forEach:mg,merge:V_,extend:RZ,trim:IZ,stripBOM:MZ,inherits:DZ,toFlatObject:$Z,kindOf:y0,kindOfTest:hs,endsWith:LZ,toArray:FZ,forEachEntry:UZ,matchAll:HZ,isHTMLForm:zZ,hasOwnProperty:tI,hasOwnProp:tI,reduceDescriptors:w5,freezeMethods:KZ,toObjectSet:WZ,toCamelCase:GZ,noop:qZ,toFiniteNumber:YZ,findKey:x5,global:kl,isContextDefined:b5,isSpecCompliantForm:QZ,toJSONObject:XZ,isAsyncFn:JZ,isThenable:ZZ,setImmediate:S5,asap:eee,isIterable:tee};function $t(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}ie.inherits($t,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ie.toJSONObject(this.config),code:this.code,status:this.status}}});const C5=$t.prototype,_5={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{_5[t]={value:t}});Object.defineProperties($t,_5);Object.defineProperty(C5,"isAxiosError",{value:!0});$t.from=(t,e,n,r,i,o)=>{const s=Object.create(C5);return ie.toFlatObject(t,s,function(l){return l!==Error.prototype},c=>c!=="isAxiosError"),$t.call(s,t.message,e,n,r,i),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};const nee=null;function K_(t){return ie.isPlainObject(t)||ie.isArray(t)}function A5(t){return ie.endsWith(t,"[]")?t.slice(0,-2):t}function nI(t,e,n){return t?t.concat(e).map(function(i,o){return i=A5(i),!n&&o?"["+i+"]":i}).join(n?".":""):e}function ree(t){return ie.isArray(t)&&!t.some(K_)}const iee=ie.toFlatObject(ie,{},null,function(e){return/^is[A-Z]/.test(e)});function w0(t,e,n){if(!ie.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=ie.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,y){return!ie.isUndefined(y[m])});const r=n.metaTokens,i=n.visitor||d,o=n.dots,s=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&ie.isSpecCompliantForm(e);if(!ie.isFunction(i))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(ie.isDate(g))return g.toISOString();if(!l&&ie.isBlob(g))throw new $t("Blob is not supported. Use a Buffer instead.");return ie.isArrayBuffer(g)||ie.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function d(g,m,y){let b=g;if(g&&!y&&typeof g=="object"){if(ie.endsWith(m,"{}"))m=r?m:m.slice(0,-2),g=JSON.stringify(g);else if(ie.isArray(g)&&ree(g)||(ie.isFileList(g)||ie.endsWith(m,"[]"))&&(b=ie.toArray(g)))return m=A5(m),b.forEach(function(w,S){!(ie.isUndefined(w)||w===null)&&e.append(s===!0?nI([m],S,o):s===null?m:m+"[]",u(w))}),!1}return K_(g)?!0:(e.append(nI(y,m,o),u(g)),!1)}const f=[],h=Object.assign(iee,{defaultVisitor:d,convertValue:u,isVisitable:K_});function p(g,m){if(!ie.isUndefined(g)){if(f.indexOf(g)!==-1)throw Error("Circular reference detected in "+m.join("."));f.push(g),ie.forEach(g,function(b,x){(!(ie.isUndefined(b)||b===null)&&i.call(e,b,ie.isString(x)?x.trim():x,m,h))===!0&&p(b,m?m.concat(x):[x])}),f.pop()}}if(!ie.isObject(t))throw new TypeError("data must be an object");return p(t),e}function rI(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function BE(t,e){this._pairs=[],t&&w0(t,this,e)}const j5=BE.prototype;j5.append=function(e,n){this._pairs.push([e,n])};j5.toString=function(e){const n=e?function(r){return e.call(this,r,rI)}:rI;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function oee(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function E5(t,e,n){if(!e)return t;const r=n&&n.encode||oee;ie.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(i?o=i(e,n):o=ie.isURLSearchParams(e)?e.toString():new BE(e,n).toString(r),o){const s=t.indexOf("#");s!==-1&&(t=t.slice(0,s)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class iI{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){ie.forEach(this.handlers,function(r){r!==null&&e(r)})}}const T5={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},see=typeof URLSearchParams<"u"?URLSearchParams:BE,aee=typeof FormData<"u"?FormData:null,cee=typeof Blob<"u"?Blob:null,lee={isBrowser:!0,classes:{URLSearchParams:see,FormData:aee,Blob:cee},protocols:["http","https","file","blob","url","data"]},UE=typeof window<"u"&&typeof document<"u",W_=typeof navigator=="object"&&navigator||void 0,uee=UE&&(!W_||["ReactNative","NativeScript","NS"].indexOf(W_.product)<0),dee=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",fee=UE&&window.location.href||"http://localhost",hee=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:UE,hasStandardBrowserEnv:uee,hasStandardBrowserWebWorkerEnv:dee,navigator:W_,origin:fee},Symbol.toStringTag,{value:"Module"})),ri={...hee,...lee};function pee(t,e){return w0(t,new ri.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,o){return ri.isNode&&ie.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},e))}function mee(t){return ie.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function gee(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r=n.length;return s=!s&&ie.isArray(i)?i.length:s,l?(ie.hasOwnProp(i,s)?i[s]=[i[s],r]:i[s]=r,!c):((!i[s]||!ie.isObject(i[s]))&&(i[s]=[]),e(n,r,i[s],o)&&ie.isArray(i[s])&&(i[s]=gee(i[s])),!c)}if(ie.isFormData(t)&&ie.isFunction(t.entries)){const n={};return ie.forEachEntry(t,(r,i)=>{e(mee(r),i,n,0)}),n}return null}function vee(t,e,n){if(ie.isString(t))try{return(e||JSON.parse)(t),ie.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(0,JSON.stringify)(t)}const gg={transitional:T5,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,o=ie.isObject(e);if(o&&ie.isHTMLForm(e)&&(e=new FormData(e)),ie.isFormData(e))return i?JSON.stringify(N5(e)):e;if(ie.isArrayBuffer(e)||ie.isBuffer(e)||ie.isStream(e)||ie.isFile(e)||ie.isBlob(e)||ie.isReadableStream(e))return e;if(ie.isArrayBufferView(e))return e.buffer;if(ie.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return pee(e,this.formSerializer).toString();if((c=ie.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return w0(c?{"files[]":e}:e,l&&new l,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),vee(e)):e}],transformResponse:[function(e){const n=this.transitional||gg.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(ie.isResponse(e)||ie.isReadableStream(e))return e;if(e&&ie.isString(e)&&(r&&!this.responseType||i)){const s=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(c){if(s)throw c.name==="SyntaxError"?$t.from(c,$t.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ri.classes.FormData,Blob:ri.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ie.forEach(["delete","get","head","post","put","patch"],t=>{gg.headers[t]={}});const yee=ie.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),xee=t=>{const e={};let n,r,i;return t&&t.split(` -`).forEach(function(s){i=s.indexOf(":"),n=s.substring(0,i).trim().toLowerCase(),r=s.substring(i+1).trim(),!(!n||e[n]&&yee[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},oI=Symbol("internals");function _h(t){return t&&String(t).trim().toLowerCase()}function Jv(t){return t===!1||t==null?t:ie.isArray(t)?t.map(Jv):String(t)}function bee(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const wee=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function RS(t,e,n,r,i){if(ie.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!ie.isString(e)){if(ie.isString(r))return e.indexOf(r)!==-1;if(ie.isRegExp(r))return r.test(e)}}function See(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function Cee(t,e){const n=ie.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,o,s){return this[r].call(this,e,i,o,s)},configurable:!0})})}class Mi{constructor(e){e&&this.set(e)}set(e,n,r){const i=this;function o(c,l,u){const d=_h(l);if(!d)throw new Error("header name must be a non-empty string");const f=ie.findKey(i,d);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||l]=Jv(c))}const s=(c,l)=>ie.forEach(c,(u,d)=>o(u,d,l));if(ie.isPlainObject(e)||e instanceof this.constructor)s(e,n);else if(ie.isString(e)&&(e=e.trim())&&!wee(e))s(xee(e),n);else if(ie.isObject(e)&&ie.isIterable(e)){let c={},l,u;for(const d of e){if(!ie.isArray(d))throw TypeError("Object iterator must return a key-value pair");c[u=d[0]]=(l=c[u])?ie.isArray(l)?[...l,d[1]]:[l,d[1]]:d[1]}s(c,n)}else e!=null&&o(n,e,r);return this}get(e,n){if(e=_h(e),e){const r=ie.findKey(this,e);if(r){const i=this[r];if(!n)return i;if(n===!0)return bee(i);if(ie.isFunction(n))return n.call(this,i,r);if(ie.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=_h(e),e){const r=ie.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||RS(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let i=!1;function o(s){if(s=_h(s),s){const c=ie.findKey(r,s);c&&(!n||RS(r,r[c],c,n))&&(delete r[c],i=!0)}}return ie.isArray(e)?e.forEach(o):o(e),i}clear(e){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const o=n[r];(!e||RS(this,this[o],o,e,!0))&&(delete this[o],i=!0)}return i}normalize(e){const n=this,r={};return ie.forEach(this,(i,o)=>{const s=ie.findKey(r,o);if(s){n[s]=Jv(i),delete n[o];return}const c=e?See(o):String(o).trim();c!==o&&delete n[o],n[c]=Jv(i),r[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return ie.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&ie.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[oI]=this[oI]={accessors:{}}).accessors,i=this.prototype;function o(s){const c=_h(s);r[c]||(Cee(i,s),r[c]=!0)}return ie.isArray(e)?e.forEach(o):o(e),this}}Mi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ie.reduceDescriptors(Mi.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});ie.freezeMethods(Mi);function MS(t,e){const n=this||gg,r=e||n,i=Mi.from(r.headers);let o=r.data;return ie.forEach(t,function(c){o=c.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function P5(t){return!!(t&&t.__CANCEL__)}function Uf(t,e,n){$t.call(this,t??"canceled",$t.ERR_CANCELED,e,n),this.name="CanceledError"}ie.inherits(Uf,$t,{__CANCEL__:!0});function k5(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new $t("Request failed with status code "+n.status,[$t.ERR_BAD_REQUEST,$t.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function _ee(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Aee(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,o=0,s;return e=e!==void 0?e:1e3,function(l){const u=Date.now(),d=r[o];s||(s=u),n[i]=l,r[i]=u;let f=o,h=0;for(;f!==i;)h+=n[f++],f=f%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),u-s{n=d,i=null,o&&(clearTimeout(o),o=null),t.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?s(u,d):(i=u,o||(o=setTimeout(()=>{o=null,s(i)},r-f)))},()=>i&&s(i)]}const Wy=(t,e,n=3)=>{let r=0;const i=Aee(50,250);return jee(o=>{const s=o.loaded,c=o.lengthComputable?o.total:void 0,l=s-r,u=i(l),d=s<=c;r=s;const f={loaded:s,total:c,progress:c?s/c:void 0,bytes:l,rate:u||void 0,estimated:u&&c&&d?(c-s)/u:void 0,event:o,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(f)},n)},sI=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},aI=t=>(...e)=>ie.asap(()=>t(...e)),Eee=ri.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ri.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ri.origin),ri.navigator&&/(msie|trident)/i.test(ri.navigator.userAgent)):()=>!0,Tee=ri.hasStandardBrowserEnv?{write(t,e,n,r,i,o){const s=[t+"="+encodeURIComponent(e)];ie.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),ie.isString(r)&&s.push("path="+r),ie.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Nee(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Pee(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function O5(t,e,n){let r=!Nee(e);return t&&(r||n==!1)?Pee(t,e):e}const cI=t=>t instanceof Mi?{...t}:t;function du(t,e){e=e||{};const n={};function r(u,d,f,h){return ie.isPlainObject(u)&&ie.isPlainObject(d)?ie.merge.call({caseless:h},u,d):ie.isPlainObject(d)?ie.merge({},d):ie.isArray(d)?d.slice():d}function i(u,d,f,h){if(ie.isUndefined(d)){if(!ie.isUndefined(u))return r(void 0,u,f,h)}else return r(u,d,f,h)}function o(u,d){if(!ie.isUndefined(d))return r(void 0,d)}function s(u,d){if(ie.isUndefined(d)){if(!ie.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function c(u,d,f){if(f in e)return r(u,d);if(f in t)return r(void 0,u)}const l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:c,headers:(u,d,f)=>i(cI(u),cI(d),f,!0)};return ie.forEach(Object.keys(Object.assign({},t,e)),function(d){const f=l[d]||i,h=f(t[d],e[d],d);ie.isUndefined(h)&&f!==c||(n[d]=h)}),n}const I5=t=>{const e=du({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:c}=e;e.headers=s=Mi.from(s),e.url=E5(O5(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let l;if(ie.isFormData(n)){if(ri.hasStandardBrowserEnv||ri.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((l=s.getContentType())!==!1){const[u,...d]=l?l.split(";").map(f=>f.trim()).filter(Boolean):[];s.setContentType([u||"multipart/form-data",...d].join("; "))}}if(ri.hasStandardBrowserEnv&&(r&&ie.isFunction(r)&&(r=r(e)),r||r!==!1&&Eee(e.url))){const u=i&&o&&Tee.read(o);u&&s.set(i,u)}return e},kee=typeof XMLHttpRequest<"u",Oee=kee&&function(t){return new Promise(function(n,r){const i=I5(t);let o=i.data;const s=Mi.from(i.headers).normalize();let{responseType:c,onUploadProgress:l,onDownloadProgress:u}=i,d,f,h,p,g;function m(){p&&p(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let y=new XMLHttpRequest;y.open(i.method.toUpperCase(),i.url,!0),y.timeout=i.timeout;function b(){if(!y)return;const w=Mi.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),C={data:!c||c==="text"||c==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:w,config:t,request:y};k5(function(A){n(A),m()},function(A){r(A),m()},C),y=null}"onloadend"in y?y.onloadend=b:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(b)},y.onabort=function(){y&&(r(new $t("Request aborted",$t.ECONNABORTED,t,y)),y=null)},y.onerror=function(){r(new $t("Network Error",$t.ERR_NETWORK,t,y)),y=null},y.ontimeout=function(){let S=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const C=i.transitional||T5;i.timeoutErrorMessage&&(S=i.timeoutErrorMessage),r(new $t(S,C.clarifyTimeoutError?$t.ETIMEDOUT:$t.ECONNABORTED,t,y)),y=null},o===void 0&&s.setContentType(null),"setRequestHeader"in y&&ie.forEach(s.toJSON(),function(S,C){y.setRequestHeader(C,S)}),ie.isUndefined(i.withCredentials)||(y.withCredentials=!!i.withCredentials),c&&c!=="json"&&(y.responseType=i.responseType),u&&([h,g]=Wy(u,!0),y.addEventListener("progress",h)),l&&y.upload&&([f,p]=Wy(l),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",p)),(i.cancelToken||i.signal)&&(d=w=>{y&&(r(!w||w.type?new Uf(null,t,y):w),y.abort(),y=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const x=_ee(i.url);if(x&&ri.protocols.indexOf(x)===-1){r(new $t("Unsupported protocol "+x+":",$t.ERR_BAD_REQUEST,t));return}y.send(o||null)})},Iee=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const o=function(u){if(!i){i=!0,c();const d=u instanceof Error?u:this.reason;r.abort(d instanceof $t?d:new Uf(d instanceof Error?d.message:d))}};let s=e&&setTimeout(()=>{s=null,o(new $t(`timeout ${e} of ms exceeded`,$t.ETIMEDOUT))},e);const c=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),t=null)};t.forEach(u=>u.addEventListener("abort",o));const{signal:l}=r;return l.unsubscribe=()=>ie.asap(c),l}},Ree=function*(t,e){let n=t.byteLength;if(n{const i=Mee(t,e);let o=0,s,c=l=>{s||(s=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:d}=await i.next();if(u){c(),l.close();return}let f=d.byteLength;if(n){let h=o+=f;n(h)}l.enqueue(new Uint8Array(d))}catch(u){throw c(u),u}},cancel(l){return c(l),i.return()}},{highWaterMark:2})},S0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",R5=S0&&typeof ReadableStream=="function",$ee=S0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),M5=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Lee=R5&&M5(()=>{let t=!1;const e=new Request(ri.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),uI=64*1024,q_=R5&&M5(()=>ie.isReadableStream(new Response("").body)),qy={stream:q_&&(t=>t.body)};S0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!qy[e]&&(qy[e]=ie.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new $t(`Response type '${e}' is not supported`,$t.ERR_NOT_SUPPORT,r)})})})(new Response);const Fee=async t=>{if(t==null)return 0;if(ie.isBlob(t))return t.size;if(ie.isSpecCompliantForm(t))return(await new Request(ri.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(ie.isArrayBufferView(t)||ie.isArrayBuffer(t))return t.byteLength;if(ie.isURLSearchParams(t)&&(t=t+""),ie.isString(t))return(await $ee(t)).byteLength},Bee=async(t,e)=>{const n=ie.toFiniteNumber(t.getContentLength());return n??Fee(e)},Uee=S0&&(async t=>{let{url:e,method:n,data:r,signal:i,cancelToken:o,timeout:s,onDownloadProgress:c,onUploadProgress:l,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:h}=I5(t);u=u?(u+"").toLowerCase():"text";let p=Iee([i,o&&o.toAbortSignal()],s),g;const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let y;try{if(l&&Lee&&n!=="get"&&n!=="head"&&(y=await Bee(d,r))!==0){let C=new Request(e,{method:"POST",body:r,duplex:"half"}),_;if(ie.isFormData(r)&&(_=C.headers.get("content-type"))&&d.setContentType(_),C.body){const[A,j]=sI(y,Wy(aI(l)));r=lI(C.body,uI,A,j)}}ie.isString(f)||(f=f?"include":"omit");const b="credentials"in Request.prototype;g=new Request(e,{...h,signal:p,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:b?f:void 0});let x=await fetch(g);const w=q_&&(u==="stream"||u==="response");if(q_&&(c||w&&m)){const C={};["status","statusText","headers"].forEach(P=>{C[P]=x[P]});const _=ie.toFiniteNumber(x.headers.get("content-length")),[A,j]=c&&sI(_,Wy(aI(c),!0))||[];x=new Response(lI(x.body,uI,A,()=>{j&&j(),m&&m()}),C)}u=u||"text";let S=await qy[ie.findKey(qy,u)||"text"](x,t);return!w&&m&&m(),await new Promise((C,_)=>{k5(C,_,{data:S,headers:Mi.from(x.headers),status:x.status,statusText:x.statusText,config:t,request:g})})}catch(b){throw m&&m(),b&&b.name==="TypeError"&&/Load failed|fetch/i.test(b.message)?Object.assign(new $t("Network Error",$t.ERR_NETWORK,t,g),{cause:b.cause||b}):$t.from(b,b&&b.code,t,g)}}),Y_={http:nee,xhr:Oee,fetch:Uee};ie.forEach(Y_,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const dI=t=>`- ${t}`,Hee=t=>ie.isFunction(t)||t===null||t===!1,D5={getAdapter:t=>{t=ie.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let o=0;o`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build"));let s=e?o.length>1?`since : -`+o.map(dI).join(` -`):" "+dI(o[0]):"as no adapter specified";throw new $t("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:Y_};function DS(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Uf(null,t)}function fI(t){return DS(t),t.headers=Mi.from(t.headers),t.data=MS.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),D5.getAdapter(t.adapter||gg.adapter)(t).then(function(r){return DS(t),r.data=MS.call(t,t.transformResponse,r),r.headers=Mi.from(r.headers),r},function(r){return P5(r)||(DS(t),r&&r.response&&(r.response.data=MS.call(t,t.transformResponse,r.response),r.response.headers=Mi.from(r.response.headers))),Promise.reject(r)})}const $5="1.9.0",C0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{C0[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const hI={};C0.transitional=function(e,n,r){function i(o,s){return"[Axios v"+$5+"] Transitional option '"+o+"'"+s+(r?". "+r:"")}return(o,s,c)=>{if(e===!1)throw new $t(i(s," has been removed"+(n?" in "+n:"")),$t.ERR_DEPRECATED);return n&&!hI[s]&&(hI[s]=!0,console.warn(i(s," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(o,s,c):!0}};C0.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function zee(t,e,n){if(typeof t!="object")throw new $t("options must be an object",$t.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const o=r[i],s=e[o];if(s){const c=t[o],l=c===void 0||s(c,o,t);if(l!==!0)throw new $t("option "+o+" must be "+l,$t.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new $t("Unknown option "+o,$t.ERR_BAD_OPTION)}}const Zv={assertOptions:zee,validators:C0},ys=Zv.validators;class ql{constructor(e){this.defaults=e||{},this.interceptors={request:new iI,response:new iI}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+o):r.stack=o}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=du(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:o}=n;r!==void 0&&Zv.assertOptions(r,{silentJSONParsing:ys.transitional(ys.boolean),forcedJSONParsing:ys.transitional(ys.boolean),clarifyTimeoutError:ys.transitional(ys.boolean)},!1),i!=null&&(ie.isFunction(i)?n.paramsSerializer={serialize:i}:Zv.assertOptions(i,{encode:ys.function,serialize:ys.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Zv.assertOptions(n,{baseUrl:ys.spelling("baseURL"),withXsrfToken:ys.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=o&&ie.merge(o.common,o[n.method]);o&&ie.forEach(["delete","get","head","post","put","patch","common"],g=>{delete o[g]}),n.headers=Mi.concat(s,o);const c=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(l=l&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,f=0,h;if(!l){const g=[fI.bind(this),void 0];for(g.unshift.apply(g,c),g.push.apply(g,u),h=g.length,d=Promise.resolve(n);f{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const s=new Promise(c=>{r.subscribe(c),o=c}).then(i);return s.cancel=function(){r.unsubscribe(o)},s},e(function(o,s,c){r.reason||(r.reason=new Uf(o,s,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new HE(function(i){e=i}),cancel:e}}}function Gee(t){return function(n){return t.apply(null,n)}}function Vee(t){return ie.isObject(t)&&t.isAxiosError===!0}const Q_={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Q_).forEach(([t,e])=>{Q_[e]=t});function L5(t){const e=new ql(t),n=m5(ql.prototype.request,e);return ie.extend(n,ql.prototype,e,{allOwnKeys:!0}),ie.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return L5(du(t,i))},n}const mr=L5(gg);mr.Axios=ql;mr.CanceledError=Uf;mr.CancelToken=HE;mr.isCancel=P5;mr.VERSION=$5;mr.toFormData=w0;mr.AxiosError=$t;mr.Cancel=mr.CanceledError;mr.all=function(e){return Promise.all(e)};mr.spread=Gee;mr.isAxiosError=Vee;mr.mergeConfig=du;mr.AxiosHeaders=Mi;mr.formToJSON=t=>N5(ie.isHTMLForm(t)?new FormData(t):t);mr.getAdapter=D5.getAdapter;mr.HttpStatusCode=Q_;mr.default=mr;const F5="https://ai-sandbox.oliver.solutions/semblance_back/api",$e=mr.create({baseURL:F5,headers:{"Content-Type":"application/json"},timeout:6e5});$e.interceptors.request.use(t=>{var n,r;const e=localStorage.getItem("auth_token");return e&&(t.headers.Authorization=`Bearer ${e}`),t.method==="put"&&((n=t.url)!=null&&n.includes("/focus-groups/"))&&console.log("🌐 API Request:",{method:t.method,url:t.url,baseURL:t.baseURL,fullURL:`${t.baseURL}${t.url}`,data:t.data}),(r=t.url)!=null&&r.includes("/folders/")&&console.log("🌐 API Folder Request:",{method:t.method,url:t.url,baseURL:t.baseURL,fullURL:`${t.baseURL}${t.url}`,data:t.data}),t},t=>Promise.reject(t));const X_="auth_error",Kee=t=>{t!=null&&t.isPersonaCreation||(localStorage.removeItem("auth_token"),localStorage.removeItem("user"));const e=new CustomEvent(X_,{detail:t||{}});window.dispatchEvent(e)};$e.interceptors.response.use(t=>t,t=>{var e,n,r,i,o,s;if(t.response&&t.response.status===401){const c=t.config&&(((e=t.config.url)==null?void 0:e.includes("/personas"))||((n=t.config.url)==null?void 0:n.includes("/personas/batch"))||t.config.method&&((r=t.config.url)==null?void 0:r.startsWith("/personas")));console.log("API Error:",{url:(i=t.config)==null?void 0:i.url,method:(o=t.config)==null?void 0:o.method,isPersonaRequest:c}),c?console.warn("Authentication error in persona request, letting component handle it"):Kee({source:(s=t.config)==null?void 0:s.url,isPersonaCreation:!1})}return Promise.reject(t)});const ey={login:(t,e)=>$e.post("/auth/login",{username:t,password:e}),loginWithMicrosoft:t=>$e.post("/auth/microsoft",{id_token:t}),register:(t,e,n)=>$e.post("/auth/register",{username:t,email:e,password:n}),getProfile:()=>$e.get("/auth/me")},zr={getAll:()=>$e.get("/personas/all"),getById:t=>$e.get(`/personas/${t}`),create:t=>$e.post("/personas",t),update:(t,e)=>t&&t.startsWith("local-")?(console.log("Cannot update with local ID, creating new instead:",t),$e.post("/personas",e)):$e.put(`/personas/${t}`,e),delete:t=>{const e=typeof t=="object"&&t!==null&&t._id||t;return console.log(`Deleting persona with ID: ${e}`),$e.delete(`/personas/${e}`)},createBatch:t=>$e.post("/personas/batch",t)},ua={generate:t=>$e.post("/ai-personas/generate",t||{},{timeout:6e5}),generateAndSave:t=>$e.post("/ai-personas/generate-and-save",t||{},{timeout:6e5}),batchGenerate:t=>$e.post("/ai-personas/batch-generate",t,{timeout:6e5}),batchGenerateAndSave:t=>$e.post("/ai-personas/batch-generate-and-save",t,{timeout:6e5}),generateBasicProfiles:(t,e=5,n=.8)=>$e.post("/ai-personas/generate-basic-profiles",{audience_brief:t,count:e,temperature:n},{timeout:6e5}),completePersona:(t,e=.7)=>$e.post("/ai-personas/complete-persona",{basic_profile:t,temperature:e},{timeout:6e5}),completeAndSavePersona:(t,e=.7)=>$e.post("/ai-personas/complete-and-save-persona",{basic_profile:t,temperature:e},{timeout:6e5}),generatePersonaSummary:(t,e=.7)=>$e.post("/ai-personas/generate-persona-summary",{persona_data:t,temperature:e},{timeout:6e5}),batchGenerateWithStages:async(t,e,n=5,r=.7,i,o)=>{var s;try{console.log(`šŸ“” API call to generate-basic-profiles with model: ${o||"gemini-2.5-pro"}`);const l=(await $e.post("/ai-personas/generate-basic-profiles",{audience_brief:t,research_objective:e,count:n,temperature:.7,customer_data_session_id:i,llm_model:o||"gemini-2.5-pro"},{timeout:6e5})).data.profiles,u=[],d=[],f=[];console.log(`šŸ“” API call to complete-and-save-persona with model: ${o||"gemini-2.5-pro"}`);const h=l.map(g=>$e.post("/ai-personas/complete-and-save-persona",{basic_profile:g,temperature:r,customer_data_session_id:i,llm_model:o||"gemini-2.5-pro"},{timeout:6e5}));if((await Promise.allSettled(h)).forEach((g,m)=>{if(g.status==="fulfilled")u.push(g.value.data.persona),d.push(g.value.data.persona_id);else{const y=l[m],b={index:m,name:y.name||`Persona ${m+1}`,error:g.reason};f.push(b),console.error(`Failed to complete persona ${m+1} (${y.name||"unnamed"}):`,g.reason)}}),u.length===0&&f.length>0)throw new Error(`Failed to generate any personas. ${f.length} profile(s) failed.`);return{data:{message:`Generated and saved ${u.length} personas${f.length>0?` (${f.length} failed)`:""}`,personas:u,persona_ids:d,errors:f.length>0?f:void 0,partial_success:f.length>0&&u.length>0}}}catch(c){throw((s=c.response)==null?void 0:s.status)===504||c.code==="ECONNABORTED"?new Error("Timeout error: The server took too long to generate personas. Please try with fewer personas or try again later."):c}},enhanceAudienceBrief:(t,e,n=.7)=>$e.post("/ai-personas/enhance-audience-brief",{audience_brief:t,research_objective:e,temperature:n},{timeout:6e5}),batchGenerateSummaries:(t,e=.7,n)=>(console.log(`šŸ“” Frontend: API call to batch-generate-summaries with model: ${n||"gemini-2.5-pro"}`),$e.post("/ai-personas/batch-generate-summaries",{persona_ids:t,temperature:e,llm_model:n||"gemini-2.5-pro"},{timeout:9e5})),uploadCustomerData:t=>{const e=new FormData;for(let n=0;n$e.delete(`/ai-personas/cleanup-customer-data/${t}`)},Ot={getAll:()=>$e.get("/focus-groups"),getById:t=>$e.get(`/focus-groups/${t}`),create:t=>$e.post("/focus-groups",t),update:(t,e)=>$e.put(`/focus-groups/${t}`,e),delete:t=>$e.delete(`/focus-groups/${t}`),addParticipant:(t,e)=>$e.post(`/focus-groups/${t}/participants`,{persona_id:e}),removeParticipant:(t,e)=>$e.delete(`/focus-groups/${t}/participants/${e}`),sendMessage:(t,e)=>$e.post(`/focus-groups/${t}/messages`,e),getMessages:t=>$e.get(`/focus-groups/${t}/messages`),updateMessageHighlight:(t,e,n)=>$e.patch(`/focus-groups/${t}/messages/${e}`,{highlighted:n}),describeAsset:(t,e)=>$e.post(`/focus-groups/${t}/describe-asset`,{asset_filename:e},{timeout:12e4}),generateDiscussionGuide:t=>$e.post("/focus-groups/generate-discussion-guide",t,{timeout:6e5}),generateDiscussionGuideForGroup:(t,e)=>$e.post(`/focus-groups/${t}/generate-discussion-guide`,e,{timeout:6e5}),downloadDiscussionGuide:async t=>{try{const e=await $e.get(`/focus-groups/${t}/discussion-guide/download`,{responseType:"blob",timeout:3e4}),n=e.headers["content-disposition"];let r="discussion-guide.md";if(n){const c=n.match(/filename="([^"]+)"/);c&&(r=c[1])}const i=new Blob([e.data],{type:"text/markdown"}),o=URL.createObjectURL(i),s=document.createElement("a");return s.href=o,s.download=r,s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o),{success:!0,filename:r}}catch(e){throw console.error("Error downloading discussion guide:",e),new Error("Failed to download discussion guide")}},createNote:(t,e)=>$e.post(`/focus-groups/${t}/notes`,e),getNotes:t=>$e.get(`/focus-groups/${t}/notes`),deleteNote:(t,e)=>$e.delete(`/focus-groups/${t}/notes/${e}`),uploadAssets:(t,e,n)=>(n===!0&&e.append("replace","true"),$e.post(`/focus-groups/${t}/assets`,e,{headers:{"Content-Type":"multipart/form-data"},timeout:12e4})),getAssets:t=>$e.get(`/focus-groups/${t}/assets`),getAssetUrl:(t,e)=>`${F5}/focus-groups/${t}/assets/${e}`,deleteAsset:(t,e)=>$e.delete(`/focus-groups/${t}/assets/${e}`)},Xn={generateResponse:(t,e,n,r=.7)=>$e.post("/focus-group-ai/generate-response",{focus_group_id:t,persona_id:e,current_topic:n,temperature:r},{timeout:6e5}),generateKeyThemes:(t,e=.7)=>$e.post("/focus-group-ai/generate-key-themes",{focus_group_id:t,temperature:e},{timeout:6e5}),getKeyThemes:t=>$e.get(`/focus-group-ai/key-themes/${t}`),deleteKeyTheme:(t,e)=>$e.delete(`/focus-group-ai/key-themes/${t}/${e}`),getModeratorStatus:t=>$e.get(`/focus-group-ai/moderator/status/${t}`),advanceModeratorDiscussion:t=>$e.post(`/focus-group-ai/moderator/advance/${t}`,{},{timeout:6e5}),setModeratorPosition:(t,e,n)=>$e.put(`/focus-group-ai/moderator/position/${t}`,{section_id:e,item_id:n}),startAutonomousConversation:(t,e)=>$e.post(`/focus-group-ai/autonomous/start/${t}`,{initial_prompt:e},{timeout:6e5}),stopAutonomousConversation:(t,e)=>$e.post(`/focus-group-ai/autonomous/stop/${t}`,{reason:e}),getAutonomousConversationStatus:t=>$e.get(`/focus-group-ai/autonomous/status/${t}`),getConversationState:t=>$e.get(`/focus-group-ai/conversation/state/${t}`),getConversationAnalytics:t=>$e.get(`/focus-group-ai/conversation/analytics/${t}`),makeConversationDecision:(t,e=.7,n="ai")=>$e.post(`/focus-group-ai/conversation/decision/${t}`,{temperature:e,mode:n},{timeout:6e5}),getConversationInsights:t=>$e.get(`/focus-group-ai/conversation/insights/${t}`,{timeout:6e5}),manualIntervention:(t,e,n,r)=>$e.post(`/focus-group-ai/conversation/intervene/${t}`,{action:e,message:n,participant_id:r}),getReasoningHistory:t=>$e.get(`/focus-group-ai/conversation/reasoning-history/${t}`),endSession:(t,e)=>$e.post(`/focus-group-ai/moderator/end-session/${t}`,{reason:e||"session_ended"})},js={getAll:()=>$e.get("/folders"),getById:t=>$e.get(`/folders/${t}`),create:t=>$e.post("/folders",t),update:(t,e)=>$e.put(`/folders/${t}`,e),delete:t=>$e.delete(`/folders/${t}`),addPersona:(t,e)=>$e.post(`/folders/${t}/personas`,{persona_id:e}),removePersona:(t,e)=>$e.delete(`/folders/${t}/personas/${e}`),addPersonasBatch:(t,e)=>$e.post(`/folders/${t}/personas/batch`,{persona_ids:e}),removePersonasBatch:(t,e)=>(console.log(`🌐 API removePersonasBatch: Sending POST to /folders/${t}/personas/remove-batch with persona_ids:`,e),$e.post(`/folders/${t}/personas/remove-batch`,{persona_ids:e})),addPersonaToMultipleFolders:(t,e)=>{const n=e.map(r=>$e.post(`/folders/${r}/personas`,{persona_id:t}));return Promise.all(n)},removePersonaFromAllFolders:t=>{throw new Error("Use removePersona for specific folders")}};/*! @azure/msal-common v15.10.0 2025-08-05 */const pe={LIBRARY_NAME:"MSAL.JS",SKU:"msal.js.common",DEFAULT_AUTHORITY:"https://login.microsoftonline.com/common/",DEFAULT_AUTHORITY_HOST:"login.microsoftonline.com",DEFAULT_COMMON_TENANT:"common",ADFS:"adfs",DSTS:"dstsv2",AAD_INSTANCE_DISCOVERY_ENDPT:"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",CIAM_AUTH_URL:".ciamlogin.com",AAD_TENANT_DOMAIN_SUFFIX:".onmicrosoft.com",RESOURCE_DELIM:"|",NO_ACCOUNT:"NO_ACCOUNT",CLAIMS:"claims",CONSUMER_UTID:"9188040d-6c67-4c5b-b112-36a304b66dad",OPENID_SCOPE:"openid",PROFILE_SCOPE:"profile",OFFLINE_ACCESS_SCOPE:"offline_access",EMAIL_SCOPE:"email",CODE_GRANT_TYPE:"authorization_code",RT_GRANT_TYPE:"refresh_token",S256_CODE_CHALLENGE_METHOD:"S256",URL_FORM_CONTENT_TYPE:"application/x-www-form-urlencoded;charset=utf-8",AUTHORIZATION_PENDING:"authorization_pending",NOT_DEFINED:"not_defined",EMPTY_STRING:"",NOT_APPLICABLE:"N/A",NOT_AVAILABLE:"Not Available",FORWARD_SLASH:"/",IMDS_ENDPOINT:"http://169.254.169.254/metadata/instance/compute/location",IMDS_VERSION:"2020-06-01",IMDS_TIMEOUT:2e3,AZURE_REGION_AUTO_DISCOVER_FLAG:"TryAutoDetect",REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX:"login.microsoft.com",KNOWN_PUBLIC_CLOUDS:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"],SHR_NONCE_VALIDITY:240,INVALID_INSTANCE:"invalid_instance"},wc={SUCCESS:200,SUCCESS_RANGE_START:200,SUCCESS_RANGE_END:299,REDIRECT:302,CLIENT_ERROR:400,CLIENT_ERROR_RANGE_START:400,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,REQUEST_TIMEOUT:408,GONE:410,TOO_MANY_REQUESTS:429,CLIENT_ERROR_RANGE_END:499,SERVER_ERROR:500,SERVER_ERROR_RANGE_START:500,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,SERVER_ERROR_RANGE_END:599,MULTI_SIDED_ERROR:600},Ol={GET:"GET",POST:"POST"},vg=[pe.OPENID_SCOPE,pe.PROFILE_SCOPE,pe.OFFLINE_ACCESS_SCOPE],pI=[...vg,pe.EMAIL_SCOPE],di={CONTENT_TYPE:"Content-Type",CONTENT_LENGTH:"Content-Length",RETRY_AFTER:"Retry-After",CCS_HEADER:"X-AnchorMailbox",WWWAuthenticate:"WWW-Authenticate",AuthenticationInfo:"Authentication-Info",X_MS_REQUEST_ID:"x-ms-request-id",X_MS_HTTP_VERSION:"x-ms-httpver"},mI={ACTIVE_ACCOUNT_FILTERS:"active-account-filters"},Ic={COMMON:"common",ORGANIZATIONS:"organizations",CONSUMERS:"consumers"},lv={ACCESS_TOKEN:"access_token",XMS_CC:"xms_cc"},pi={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",CREATE:"create",NO_SESSION:"no_session"},zE={CODE:"code",IDTOKEN_TOKEN:"id_token token",IDTOKEN_TOKEN_REFRESHTOKEN:"id_token token refresh_token"},_0={QUERY:"query",FRAGMENT:"fragment"},Wee={QUERY:"query",FRAGMENT:"fragment",FORM_POST:"form_post"},B5={IMPLICIT_GRANT:"implicit",AUTHORIZATION_CODE_GRANT:"authorization_code",CLIENT_CREDENTIALS_GRANT:"client_credentials",RESOURCE_OWNER_PASSWORD_GRANT:"password",REFRESH_TOKEN_GRANT:"refresh_token",DEVICE_CODE_GRANT:"device_code",JWT_BEARER:"urn:ietf:params:oauth:grant-type:jwt-bearer"},uv={MSSTS_ACCOUNT_TYPE:"MSSTS",ADFS_ACCOUNT_TYPE:"ADFS",MSAV1_ACCOUNT_TYPE:"MSA",GENERIC_ACCOUNT_TYPE:"Generic"},Qp={CACHE_KEY_SEPARATOR:"-",CLIENT_INFO_SEPARATOR:"."},Hr={ID_TOKEN:"IdToken",ACCESS_TOKEN:"AccessToken",ACCESS_TOKEN_WITH_AUTH_SCHEME:"AccessToken_With_AuthScheme",REFRESH_TOKEN:"RefreshToken"},GE="appmetadata",qee="client_info",Yy="1",Qy={CACHE_KEY:"authority-metadata",REFRESH_TIME_SECONDS:3600*24},Ui={CONFIG:"config",CACHE:"cache",NETWORK:"network",HARDCODED_VALUES:"hardcoded_values"},Lr={SCHEMA_VERSION:5,MAX_LAST_HEADER_BYTES:330,MAX_CACHED_ERRORS:50,CACHE_KEY:"server-telemetry",CATEGORY_SEPARATOR:"|",VALUE_SEPARATOR:",",OVERFLOW_TRUE:"1",OVERFLOW_FALSE:"0",UNKNOWN_ERROR:"unknown_error"},yn={BEARER:"Bearer",POP:"pop",SSH:"ssh-cert"},cp={DEFAULT_THROTTLE_TIME_SECONDS:60,DEFAULT_MAX_THROTTLE_TIME_SECONDS:3600,THROTTLING_PREFIX:"throttling",X_MS_LIB_CAPABILITY_VALUE:"retry-after, h429"},gI={INVALID_GRANT_ERROR:"invalid_grant",CLIENT_MISMATCH_ERROR:"client_mismatch"},$u={FAILED_AUTO_DETECTION:"1",INTERNAL_CACHE:"2",ENVIRONMENT_VARIABLE:"3",IMDS:"4"},$S={CONFIGURED_NO_AUTO_DETECTION:"2",AUTO_DETECTION_REQUESTED_SUCCESSFUL:"4",AUTO_DETECTION_REQUESTED_FAILED:"5"},Cl={NOT_APPLICABLE:"0",FORCE_REFRESH_OR_CLAIMS:"1",NO_CACHED_ACCESS_TOKEN:"2",CACHED_ACCESS_TOKEN_EXPIRED:"3",PROACTIVELY_REFRESHED:"4"},Yee={Jwt:"JWT",Jwk:"JWK",Pop:"pop"},U5=300;/*! @azure/msal-common v15.10.0 2025-08-05 */const Xy="unexpected_error",Qee="post_request_failed";/*! @azure/msal-common v15.10.0 2025-08-05 */const vI={[Xy]:"Unexpected error in authentication.",[Qee]:"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."};class _n extends Error{constructor(e,n,r){const i=n?`${e}: ${n}`:e;super(i),Object.setPrototypeOf(this,_n.prototype),this.errorCode=e||pe.EMPTY_STRING,this.errorMessage=n||pe.EMPTY_STRING,this.subError=r||pe.EMPTY_STRING,this.name="AuthError"}setCorrelationId(e){this.correlationId=e}}function J_(t,e){return new _n(t,e?`${vI[t]} ${e}`:vI[t])}/*! @azure/msal-common v15.10.0 2025-08-05 */const VE="client_info_decoding_error",H5="client_info_empty_error",KE="token_parsing_error",z5="null_or_empty_token",da="endpoints_resolution_error",G5="network_error",V5="openid_config_error",K5="hash_not_deserialized",Xd="invalid_state",W5="state_mismatch",Z_="state_not_found",q5="nonce_mismatch",WE="auth_time_not_found",Y5="max_age_transpired",Xee="multiple_matching_tokens",Jee="multiple_matching_accounts",Q5="multiple_matching_appMetadata",X5="request_cannot_be_made",J5="cannot_remove_empty_scope",Z5="cannot_append_scopeset",eA="empty_input_scopeset",Zee="device_code_polling_cancelled",ete="device_code_expired",tte="device_code_unknown_error",qE="no_account_in_silent_request",eB="invalid_cache_record",YE="invalid_cache_environment",tA="no_account_found",nA="no_crypto_object",nte="unexpected_credential_type",rte="invalid_assertion",ite="invalid_client_credential",Rc="token_refresh_required",ote="user_timeout_reached",tB="token_claims_cnf_required_for_signedjwt",nB="authorization_code_missing_from_server_response",rB="binding_key_not_removed",iB="end_session_endpoint_not_supported",QE="key_id_missing",ste="no_network_connectivity",ate="user_canceled",cte="missing_tenant_id_error",Kt="method_not_implemented",lte="nested_app_auth_bridge_disabled";/*! @azure/msal-common v15.10.0 2025-08-05 */const yI={[VE]:"The client info could not be parsed/decoded correctly",[H5]:"The client info was empty",[KE]:"Token cannot be parsed",[z5]:"The token is null or empty",[da]:"Endpoints cannot be resolved",[G5]:"Network request failed",[V5]:"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints.",[K5]:"The hash parameters could not be deserialized",[Xd]:"State was not the expected format",[W5]:"State mismatch error",[Z_]:"State not found",[q5]:"Nonce mismatch error",[WE]:"Max Age was requested and the ID token is missing the auth_time variable. auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information.",[Y5]:"Max Age is set to 0, or too much time has elapsed since the last end-user authentication.",[Xee]:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account.",[Jee]:"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account",[Q5]:"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata",[X5]:"Token request cannot be made without authorization code or refresh token.",[J5]:"Cannot remove null or empty scope from ScopeSet",[Z5]:"Cannot append ScopeSet",[eA]:"Empty input ScopeSet cannot be processed",[Zee]:"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.",[ete]:"Device code is expired.",[tte]:"Device code stopped polling for unknown reasons.",[qE]:"Please pass an account object, silent flow is not supported without account information",[eB]:"Cache record object was null or undefined.",[YE]:"Invalid environment when attempting to create cache entry",[tA]:"No account found in cache for given key.",[nA]:"No crypto object detected.",[nte]:"Unexpected credential type.",[rte]:"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515",[ite]:"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential",[Rc]:"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired.",[ote]:"User defined timeout for device code polling reached",[tB]:"Cannot generate a POP jwt if the token_claims are not populated",[nB]:"Server response does not contain an authorization code to proceed",[rB]:"Could not remove the credential's binding key from storage.",[iB]:"The provided authority does not support logout",[QE]:"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.",[ste]:"No network connectivity. Check your internet connection.",[ate]:"User cancelled the flow.",[cte]:"A tenant id - not common, organizations, or consumers - must be specified when using the client_credentials flow.",[Kt]:"This method has not been implemented",[lte]:"The nested app auth bridge is disabled"};class XE extends _n{constructor(e,n){super(e,n?`${yI[e]}: ${n}`:yI[e]),this.name="ClientAuthError",Object.setPrototypeOf(this,XE.prototype)}}function we(t,e){return new XE(t,e)}/*! @azure/msal-common v15.10.0 2025-08-05 */const Jy={createNewGuid:()=>{throw we(Kt)},base64Decode:()=>{throw we(Kt)},base64Encode:()=>{throw we(Kt)},base64UrlEncode:()=>{throw we(Kt)},encodeKid:()=>{throw we(Kt)},async getPublicKeyThumbprint(){throw we(Kt)},async removeTokenBindingKey(){throw we(Kt)},async clearKeystore(){throw we(Kt)},async signJwt(){throw we(Kt)},async hashString(){throw we(Kt)}};/*! @azure/msal-common v15.10.0 2025-08-05 */var Dn;(function(t){t[t.Error=0]="Error",t[t.Warning=1]="Warning",t[t.Info=2]="Info",t[t.Verbose=3]="Verbose",t[t.Trace=4]="Trace"})(Dn||(Dn={}));class Da{constructor(e,n,r){this.level=Dn.Info;const i=()=>{},o=e||Da.createDefaultLoggerOptions();this.localCallback=o.loggerCallback||i,this.piiLoggingEnabled=o.piiLoggingEnabled||!1,this.level=typeof o.logLevel=="number"?o.logLevel:Dn.Info,this.correlationId=o.correlationId||pe.EMPTY_STRING,this.packageName=n||pe.EMPTY_STRING,this.packageVersion=r||pe.EMPTY_STRING}static createDefaultLoggerOptions(){return{loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:Dn.Info}}clone(e,n,r){return new Da({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level,correlationId:r||this.correlationId},e,n)}logMessage(e,n){if(n.logLevel>this.level||!this.piiLoggingEnabled&&n.containsPii)return;const o=`${`[${new Date().toUTCString()}] : [${n.correlationId||this.correlationId||""}]`} : ${this.packageName}@${this.packageVersion} : ${Dn[n.logLevel]} - ${e}`;this.executeCallback(n.logLevel,o,n.containsPii||!1)}executeCallback(e,n,r){this.localCallback&&this.localCallback(e,n,r)}error(e,n){this.logMessage(e,{logLevel:Dn.Error,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}errorPii(e,n){this.logMessage(e,{logLevel:Dn.Error,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}warning(e,n){this.logMessage(e,{logLevel:Dn.Warning,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}warningPii(e,n){this.logMessage(e,{logLevel:Dn.Warning,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}info(e,n){this.logMessage(e,{logLevel:Dn.Info,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}infoPii(e,n){this.logMessage(e,{logLevel:Dn.Info,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}verbose(e,n){this.logMessage(e,{logLevel:Dn.Verbose,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}verbosePii(e,n){this.logMessage(e,{logLevel:Dn.Verbose,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}trace(e,n){this.logMessage(e,{logLevel:Dn.Trace,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}tracePii(e,n){this.logMessage(e,{logLevel:Dn.Trace,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}isPiiLoggingEnabled(){return this.piiLoggingEnabled||!1}}/*! @azure/msal-common v15.10.0 2025-08-05 */const oB="@azure/msal-common",JE="15.10.0";/*! @azure/msal-common v15.10.0 2025-08-05 */const ZE={None:"none",AzurePublic:"https://login.microsoftonline.com",AzurePpe:"https://login.windows-ppe.net",AzureChina:"https://login.chinacloudapi.cn",AzureGermany:"https://login.microsoftonline.de",AzureUsGovernment:"https://login.microsoftonline.us"};/*! @azure/msal-common v15.10.0 2025-08-05 */const sB="redirect_uri_empty",ute="claims_request_parsing_error",aB="authority_uri_insecure",Gh="url_parse_error",cB="empty_url_error",lB="empty_input_scopes_error",eT="invalid_claims",uB="token_request_empty",dB="logout_request_empty",dte="invalid_code_challenge_method",tT="pkce_params_missing",nT="invalid_cloud_discovery_metadata",fB="invalid_authority_metadata",hB="untrusted_authority",A0="missing_ssh_jwk",pB="missing_ssh_kid",fte="missing_nonce_authentication_header",hte="invalid_authentication_header",mB="cannot_set_OIDCOptions",gB="cannot_allow_platform_broker",vB="authority_mismatch",yB="invalid_request_method_for_EAR",xB="invalid_authorize_post_body_parameters";/*! @azure/msal-common v15.10.0 2025-08-05 */const pte={[sB]:"A redirect URI is required for all calls, and none has been set.",[ute]:"Could not parse the given claims request object.",[aB]:"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options",[Gh]:"URL could not be parsed into appropriate segments.",[cB]:"URL was empty or null.",[lB]:"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.",[eT]:"Given claims parameter must be a stringified JSON object.",[uB]:"Token request was empty and not found in cache.",[dB]:"The logout request was null or undefined.",[dte]:'code_challenge_method passed is invalid. Valid values are "plain" and "S256".',[tT]:"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request",[nT]:"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields",[fB]:"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields.",[hB]:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.",[A0]:"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme.",[pB]:"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme.",[fte]:"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.",[hte]:"Invalid authentication header provided",[mB]:"Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",[gB]:"Cannot set allowPlatformBroker parameter to true when not in AAD protocol mode.",[vB]:"Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority.",[xB]:"Invalid authorize post body parameters provided. If you are using authorizePostBodyParameters, the request method must be POST. Please check the request method and parameters.",[yB]:"Invalid request method for EAR protocol mode. The request method cannot be GET when using EAR protocol mode. Please change the request method to POST."};class rT extends _n{constructor(e){super(e,pte[e]),this.name="ClientConfigurationError",Object.setPrototypeOf(this,rT.prototype)}}function jn(t){return new rT(t)}/*! @azure/msal-common v15.10.0 2025-08-05 */class $s{static isEmptyObj(e){if(e)try{const n=JSON.parse(e);return Object.keys(n).length===0}catch{}return!0}static startsWith(e,n){return e.indexOf(n)===0}static endsWith(e,n){return e.length>=n.length&&e.lastIndexOf(n)===e.length-n.length}static queryStringToObject(e){const n={},r=e.split("&"),i=o=>decodeURIComponent(o.replace(/\+/g," "));return r.forEach(o=>{if(o.trim()){const[s,c]=o.split(/=(.+)/g,2);s&&c&&(n[i(s)]=i(c))}}),n}static trimArrayEntries(e){return e.map(n=>n.trim())}static removeEmptyStringsFromArray(e){return e.filter(n=>!!n)}static jsonParseHelper(e){try{return JSON.parse(e)}catch{return null}}static matchPattern(e,n){return new RegExp(e.replace(/\\/g,"\\\\").replace(/\*/g,"[^ ]*").replace(/\?/g,"\\?")).test(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Ar{constructor(e){const n=e?$s.trimArrayEntries([...e]):[],r=n?$s.removeEmptyStringsFromArray(n):[];if(!r||!r.length)throw jn(lB);this.scopes=new Set,r.forEach(i=>this.scopes.add(i))}static fromString(e){const r=(e||pe.EMPTY_STRING).split(" ");return new Ar(r)}static createSearchScopes(e){const n=new Ar(e);return n.containsOnlyOIDCScopes()?n.removeScope(pe.OFFLINE_ACCESS_SCOPE):n.removeOIDCScopes(),n}containsScope(e){const n=this.printScopesLowerCase().split(" "),r=new Ar(n);return e?r.scopes.has(e.toLowerCase()):!1}containsScopeSet(e){return!e||e.scopes.size<=0?!1:this.scopes.size>=e.scopes.size&&e.asArray().every(n=>this.containsScope(n))}containsOnlyOIDCScopes(){let e=0;return pI.forEach(n=>{this.containsScope(n)&&(e+=1)}),this.scopes.size===e}appendScope(e){e&&this.scopes.add(e.trim())}appendScopes(e){try{e.forEach(n=>this.appendScope(n))}catch{throw we(Z5)}}removeScope(e){if(!e)throw we(J5);this.scopes.delete(e.trim())}removeOIDCScopes(){pI.forEach(e=>{this.scopes.delete(e)})}unionScopeSets(e){if(!e)throw we(eA);const n=new Set;return e.scopes.forEach(r=>n.add(r.toLowerCase())),this.scopes.forEach(r=>n.add(r.toLowerCase())),n}intersectingScopeSets(e){if(!e)throw we(eA);e.containsOnlyOIDCScopes()||e.removeOIDCScopes();const n=this.unionScopeSets(e),r=e.getScopeCount(),i=this.getScopeCount();return n.sizee.push(n)),e}printScopes(){return this.scopes?this.asArray().join(" "):pe.EMPTY_STRING}printScopesLowerCase(){return this.printScopes().toLowerCase()}}/*! @azure/msal-common v15.10.0 2025-08-05 */function xI(t,e){return!!t&&!!e&&t===e.split(".")[1]}function iT(t,e,n,r){if(r){const{oid:i,sub:o,tid:s,name:c,tfp:l,acr:u,preferred_username:d,upn:f,login_hint:h}=r,p=s||l||u||"";return{tenantId:p,localAccountId:i||o||"",name:c,username:d||f||"",loginHint:h,isHomeTenant:xI(p,t)}}else return{tenantId:n,localAccountId:e,username:"",isHomeTenant:xI(n,t)}}function oT(t,e,n,r){let i=t;if(e){const{isHomeTenant:o,...s}=e;i={...t,...s}}if(n){const{isHomeTenant:o,...s}=iT(t.homeAccountId,t.localAccountId,t.tenantId,n);return i={...i,...s,idTokenClaims:n,idToken:r},i}return i}/*! @azure/msal-common v15.10.0 2025-08-05 */function Hf(t,e){const n=mte(t);try{const r=e(n);return JSON.parse(r)}catch{throw we(KE)}}function mte(t){if(!t)throw we(z5);const n=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(t);if(!n||n.length<4)throw we(KE);return n[2]}function bB(t,e){if(e===0||Date.now()-3e5>t+e)throw we(Y5)}/*! @azure/msal-common v15.10.0 2025-08-05 */function wB(t){return t.startsWith("#/")?t.substring(2):t.startsWith("#")||t.startsWith("?")?t.substring(1):t}function Zy(t){if(!t||t.indexOf("=")<0)return null;try{const e=wB(t),n=Object.fromEntries(new URLSearchParams(e));if(n.code||n.ear_jwe||n.error||n.error_description||n.state)return n}catch{throw we(K5)}return null}function Xp(t,e=!0,n){const r=new Array;return t.forEach((i,o)=>{!e&&n&&o in n?r.push(`${o}=${i}`):r.push(`${o}=${encodeURIComponent(i)}`)}),r.join("&")}/*! @azure/msal-common v15.10.0 2025-08-05 */class tn{get urlString(){return this._urlString}constructor(e){if(this._urlString=e,!this._urlString)throw jn(cB);e.includes("#")||(this._urlString=tn.canonicalizeUri(e))}static canonicalizeUri(e){if(e){let n=e.toLowerCase();return $s.endsWith(n,"?")?n=n.slice(0,-1):$s.endsWith(n,"?/")&&(n=n.slice(0,-2)),$s.endsWith(n,"/")||(n+="/"),n}return e}validateAsUri(){let e;try{e=this.getUrlComponents()}catch{throw jn(Gh)}if(!e.HostNameAndPort||!e.PathSegments)throw jn(Gh);if(!e.Protocol||e.Protocol.toLowerCase()!=="https:")throw jn(aB)}static appendQueryString(e,n){return n?e.indexOf("?")<0?`${e}?${n}`:`${e}&${n}`:e}static removeHashFromUrl(e){return tn.canonicalizeUri(e.split("#")[0])}replaceTenantPath(e){const n=this.getUrlComponents(),r=n.PathSegments;return e&&r.length!==0&&(r[0]===Ic.COMMON||r[0]===Ic.ORGANIZATIONS)&&(r[0]=e),tn.constructAuthorityUriFromObject(n)}getUrlComponents(){const e=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),n=this.urlString.match(e);if(!n)throw jn(Gh);const r={Protocol:n[1],HostNameAndPort:n[4],AbsolutePath:n[5],QueryString:n[7]};let i=r.AbsolutePath.split("/");return i=i.filter(o=>o&&o.length>0),r.PathSegments=i,r.QueryString&&r.QueryString.endsWith("/")&&(r.QueryString=r.QueryString.substring(0,r.QueryString.length-1)),r}static getDomainFromUrl(e){const n=RegExp("^([^:/?#]+://)?([^/?#]*)"),r=e.match(n);if(!r)throw jn(Gh);return r[2]}static getAbsoluteUrl(e,n){if(e[0]===pe.FORWARD_SLASH){const i=new tn(n).getUrlComponents();return i.Protocol+"//"+i.HostNameAndPort+e}return e}static constructAuthorityUriFromObject(e){return new tn(e.Protocol+"//"+e.HostNameAndPort+"/"+e.PathSegments.join("/"))}static hashContainsKnownProperties(e){return!!Zy(e)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const SB={endpointMetadata:{"login.microsoftonline.com":{token_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.com/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/logout"},"login.chinacloudapi.cn":{token_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.chinacloudapi.cn/{tenantid}/discovery/v2.0/keys",issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",authorization_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/logout"},"login.microsoftonline.us":{token_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.us/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/logout"}},instanceDiscoveryMetadata:{metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]}},bI=SB.endpointMetadata,sT=SB.instanceDiscoveryMetadata,CB=new Set;sT.metadata.forEach(t=>{t.aliases.forEach(e=>{CB.add(e)})});function gte(t,e){var i;let n;const r=t.canonicalAuthority;if(r){const o=new tn(r).getUrlComponents().HostNameAndPort;n=wI(o,(i=t.cloudDiscoveryMetadata)==null?void 0:i.metadata,Ui.CONFIG,e)||wI(o,sT.metadata,Ui.HARDCODED_VALUES,e)||t.knownAuthorities}return n||[]}function wI(t,e,n,r){if(r==null||r.trace(`getAliasesFromMetadata called with source: ${n}`),t&&e){const i=ex(e,t);if(i)return r==null||r.trace(`getAliasesFromMetadata: found cloud discovery metadata in ${n}, returning aliases`),i.aliases;r==null||r.trace(`getAliasesFromMetadata: did not find cloud discovery metadata in ${n}`)}return null}function vte(t){return ex(sT.metadata,t)}function ex(t,e){for(let n=0;n1?r.sort(o=>o.idTokenClaims?-1:1)[0]:r.length===1?r[0]:null}getBaseAccountInfo(e,n){const r=this.getAccountsFilteredBy(e,n);return r.length>0?r[0].getAccountInfo():null}buildTenantProfiles(e,n,r){return e.flatMap(i=>this.getTenantProfilesFromAccountEntity(i,n,r==null?void 0:r.tenantId,r))}getTenantedAccountInfoByFilter(e,n,r,i,o){let s=null,c;if(o&&!this.tenantProfileMatchesFilter(r,o))return null;const l=this.getIdToken(e,i,n,r.tenantId);return l&&(c=Hf(l.secret,this.cryptoImpl.base64Decode),!this.idTokenClaimsMatchTenantProfileFilter(c,o))?null:(s=oT(e,r,c,l==null?void 0:l.secret),s)}getTenantProfilesFromAccountEntity(e,n,r,i){const o=e.getAccountInfo();let s=o.tenantProfiles||new Map;const c=this.getTokenKeys();if(r){const u=s.get(r);if(u)s=new Map([[r,u]]);else return[]}const l=[];return s.forEach(u=>{const d=this.getTenantedAccountInfoByFilter(o,c,u,n,i);d&&l.push(d)}),l}tenantProfileMatchesFilter(e,n){return!(n.localAccountId&&!this.matchLocalAccountIdFromTenantProfile(e,n.localAccountId)||n.name&&e.name!==n.name||n.isHomeTenant!==void 0&&e.isHomeTenant!==n.isHomeTenant)}idTokenClaimsMatchTenantProfileFilter(e,n){return!(n&&(n.localAccountId&&!this.matchLocalAccountIdFromTokenClaims(e,n.localAccountId)||n.loginHint&&!this.matchLoginHintFromTokenClaims(e,n.loginHint)||n.username&&!this.matchUsername(e.preferred_username,n.username)||n.name&&!this.matchName(e,n.name)||n.sid&&!this.matchSid(e,n.sid)))}async saveCacheRecord(e,n,r){var i;if(!e)throw we(eB);try{e.account&&await this.setAccount(e.account,n),e.idToken&&(r==null?void 0:r.idToken)!==!1&&await this.setIdTokenCredential(e.idToken,n),e.accessToken&&(r==null?void 0:r.accessToken)!==!1&&await this.saveAccessToken(e.accessToken,n),e.refreshToken&&(r==null?void 0:r.refreshToken)!==!1&&await this.setRefreshTokenCredential(e.refreshToken,n),e.appMetadata&&this.setAppMetadata(e.appMetadata,n)}catch(o){throw(i=this.commonLogger)==null||i.error("CacheManager.saveCacheRecord: failed"),o instanceof _n?o:rA(o)}}async saveAccessToken(e,n){const r={clientId:e.clientId,credentialType:e.credentialType,environment:e.environment,homeAccountId:e.homeAccountId,realm:e.realm,tokenType:e.tokenType,requestedClaimsHash:e.requestedClaimsHash},i=this.getTokenKeys(),o=Ar.fromString(e.target);i.accessToken.forEach(s=>{if(!this.accessTokenKeyMatchesFilter(s,r,!1))return;const c=this.getAccessTokenCredential(s,n);c&&this.credentialMatchesFilter(c,r)&&Ar.fromString(c.target).intersectingScopeSets(o)&&this.removeAccessToken(s,n)}),await this.setAccessTokenCredential(e,n)}getAccountsFilteredBy(e,n){const r=this.getAccountKeys(),i=[];return r.forEach(o=>{var u;const s=this.getAccount(o,n);if(!s||e.homeAccountId&&!this.matchHomeAccountId(s,e.homeAccountId)||e.username&&!this.matchUsername(s.username,e.username)||e.environment&&!this.matchEnvironment(s,e.environment)||e.realm&&!this.matchRealm(s,e.realm)||e.nativeAccountId&&!this.matchNativeAccountId(s,e.nativeAccountId)||e.authorityType&&!this.matchAuthorityType(s,e.authorityType))return;const c={localAccountId:e==null?void 0:e.localAccountId,name:e==null?void 0:e.name},l=(u=s.tenantProfiles)==null?void 0:u.filter(d=>this.tenantProfileMatchesFilter(d,c));l&&l.length===0||i.push(s)}),i}credentialMatchesFilter(e,n){return!(n.clientId&&!this.matchClientId(e,n.clientId)||n.userAssertionHash&&!this.matchUserAssertionHash(e,n.userAssertionHash)||typeof n.homeAccountId=="string"&&!this.matchHomeAccountId(e,n.homeAccountId)||n.environment&&!this.matchEnvironment(e,n.environment)||n.realm&&!this.matchRealm(e,n.realm)||n.credentialType&&!this.matchCredentialType(e,n.credentialType)||n.familyId&&!this.matchFamilyId(e,n.familyId)||n.target&&!this.matchTarget(e,n.target)||(n.requestedClaimsHash||e.requestedClaimsHash)&&e.requestedClaimsHash!==n.requestedClaimsHash||e.credentialType===Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME&&(n.tokenType&&!this.matchTokenType(e,n.tokenType)||n.tokenType===yn.SSH&&n.keyId&&!this.matchKeyId(e,n.keyId)))}getAppMetadataFilteredBy(e){const n=this.getKeys(),r={};return n.forEach(i=>{if(!this.isAppMetadata(i))return;const o=this.getAppMetadata(i);o&&(e.environment&&!this.matchEnvironment(o,e.environment)||e.clientId&&!this.matchClientId(o,e.clientId)||(r[i]=o))}),r}getAuthorityMetadataByAlias(e){const n=this.getAuthorityMetadataKeys();let r=null;return n.forEach(i=>{if(!this.isAuthorityMetadata(i)||i.indexOf(this.clientId)===-1)return;const o=this.getAuthorityMetadata(i);o&&o.aliases.indexOf(e)!==-1&&(r=o)}),r}removeAllAccounts(e){this.getAllAccounts({},e).forEach(r=>{this.removeAccount(r,e)})}removeAccount(e,n){this.removeAccountContext(e,n);const r=this.getAccountKeys(),i=o=>o.includes(e.homeAccountId)&&o.includes(e.environment);r.filter(i).forEach(o=>{this.removeItem(o,n),this.performanceClient.incrementFields({accountsRemoved:1},n)})}removeAccountContext(e,n){const r=this.getTokenKeys(),i=o=>o.includes(e.homeAccountId)&&o.includes(e.environment);r.idToken.filter(i).forEach(o=>{this.removeIdToken(o,n)}),r.accessToken.filter(i).forEach(o=>{this.removeAccessToken(o,n)}),r.refreshToken.filter(i).forEach(o=>{this.removeRefreshToken(o,n)})}removeAccessToken(e,n){const r=this.getAccessTokenCredential(e,n);if(this.removeItem(e,n),this.performanceClient.incrementFields({accessTokensRemoved:1},n),!r||r.credentialType.toLowerCase()!==Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()||r.tokenType!==yn.POP)return;const i=r.keyId;i&&this.cryptoImpl.removeTokenBindingKey(i).catch(()=>{var o;this.commonLogger.error(`Failed to remove token binding key ${i}`,n),(o=this.performanceClient)==null||o.incrementFields({removeTokenBindingKeyFailure:1},n)})}removeAppMetadata(e){return this.getKeys().forEach(r=>{this.isAppMetadata(r)&&this.removeItem(r,e)}),!0}getIdToken(e,n,r,i,o){this.commonLogger.trace("CacheManager - getIdToken called");const s={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:Hr.ID_TOKEN,clientId:this.clientId,realm:i},c=this.getIdTokensByFilter(s,n,r),l=c.size;if(l<1)return this.commonLogger.info("CacheManager:getIdToken - No token found"),null;if(l>1){let u=c;if(!i){const d=new Map;c.forEach((h,p)=>{h.realm===e.tenantId&&d.set(p,h)});const f=d.size;if(f<1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account but none match account entity tenant id, returning first result"),c.values().next().value;if(f===1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account, defaulting to home tenant profile"),d.values().next().value;u=d}return this.commonLogger.info("CacheManager:getIdToken - Multiple matching ID tokens found, clearing them"),u.forEach((d,f)=>{this.removeIdToken(f,n)}),o&&n&&o.addFields({multiMatchedID:c.size},n),null}return this.commonLogger.info("CacheManager:getIdToken - Returning ID token"),c.values().next().value}getIdTokensByFilter(e,n,r){const i=r&&r.idToken||this.getTokenKeys().idToken,o=new Map;return i.forEach(s=>{if(!this.idTokenKeyMatchesFilter(s,{clientId:this.clientId,...e}))return;const c=this.getIdTokenCredential(s,n);c&&this.credentialMatchesFilter(c,e)&&o.set(s,c)}),o}idTokenKeyMatchesFilter(e,n){const r=e.toLowerCase();return!(n.clientId&&r.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&r.indexOf(n.homeAccountId.toLowerCase())===-1)}removeIdToken(e,n){this.removeItem(e,n)}removeRefreshToken(e,n){this.removeItem(e,n)}getAccessToken(e,n,r,i){const o=n.correlationId;this.commonLogger.trace("CacheManager - getAccessToken called",o);const s=Ar.createSearchScopes(n.scopes),c=n.authenticationScheme||yn.BEARER,l=c&&c.toLowerCase()!==yn.BEARER.toLowerCase()?Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME:Hr.ACCESS_TOKEN,u={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:l,clientId:this.clientId,realm:i||e.tenantId,target:s,tokenType:c,keyId:n.sshKid,requestedClaimsHash:n.requestedClaimsHash},d=r&&r.accessToken||this.getTokenKeys().accessToken,f=[];d.forEach(p=>{if(this.accessTokenKeyMatchesFilter(p,u,!0)){const g=this.getAccessTokenCredential(p,o);g&&this.credentialMatchesFilter(g,u)&&f.push(g)}});const h=f.length;return h<1?(this.commonLogger.info("CacheManager:getAccessToken - No token found",o),null):h>1?(this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them",o),f.forEach(p=>{this.removeAccessToken(this.generateCredentialKey(p),o)}),this.performanceClient.addFields({multiMatchedAT:f.length},o),null):(this.commonLogger.info("CacheManager:getAccessToken - Returning access token",o),f[0])}accessTokenKeyMatchesFilter(e,n,r){const i=e.toLowerCase();if(n.clientId&&i.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&i.indexOf(n.homeAccountId.toLowerCase())===-1||n.realm&&i.indexOf(n.realm.toLowerCase())===-1||n.requestedClaimsHash&&i.indexOf(n.requestedClaimsHash.toLowerCase())===-1)return!1;if(n.target){const o=n.target.asArray();for(let s=0;s{if(!this.accessTokenKeyMatchesFilter(o,e,!0))return;const s=this.getAccessTokenCredential(o,n);s&&this.credentialMatchesFilter(s,e)&&i.push(s)}),i}getRefreshToken(e,n,r,i,o){this.commonLogger.trace("CacheManager - getRefreshToken called");const s=n?Yy:void 0,c={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:Hr.REFRESH_TOKEN,clientId:this.clientId,familyId:s},l=i&&i.refreshToken||this.getTokenKeys().refreshToken,u=[];l.forEach(f=>{if(this.refreshTokenKeyMatchesFilter(f,c)){const h=this.getRefreshTokenCredential(f,r);h&&this.credentialMatchesFilter(h,c)&&u.push(h)}});const d=u.length;return d<1?(this.commonLogger.info("CacheManager:getRefreshToken - No refresh token found."),null):(d>1&&o&&r&&o.addFields({multiMatchedRT:d},r),this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token"),u[0])}refreshTokenKeyMatchesFilter(e,n){const r=e.toLowerCase();return!(n.familyId&&r.indexOf(n.familyId.toLowerCase())===-1||!n.familyId&&n.clientId&&r.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&r.indexOf(n.homeAccountId.toLowerCase())===-1)}readAppMetadataFromCache(e){const n={environment:e,clientId:this.clientId},r=this.getAppMetadataFilteredBy(n),i=Object.keys(r).map(s=>r[s]),o=i.length;if(o<1)return null;if(o>1)throw we(Q5);return i[0]}isAppMetadataFOCI(e){const n=this.readAppMetadataFromCache(e);return!!(n&&n.familyId===Yy)}matchHomeAccountId(e,n){return typeof e.homeAccountId=="string"&&n===e.homeAccountId}matchLocalAccountIdFromTokenClaims(e,n){const r=e.oid||e.sub;return n===r}matchLocalAccountIdFromTenantProfile(e,n){return e.localAccountId===n}matchName(e,n){var r;return n.toLowerCase()===((r=e.name)==null?void 0:r.toLowerCase())}matchUsername(e,n){return!!(e&&typeof e=="string"&&(n==null?void 0:n.toLowerCase())===e.toLowerCase())}matchUserAssertionHash(e,n){return!!(e.userAssertionHash&&n===e.userAssertionHash)}matchEnvironment(e,n){if(this.staticAuthorityOptions){const i=gte(this.staticAuthorityOptions,this.commonLogger);if(i.includes(n)&&i.includes(e.environment))return!0}const r=this.getAuthorityMetadataByAlias(n);return!!(r&&r.aliases.indexOf(e.environment)>-1)}matchCredentialType(e,n){return e.credentialType&&n.toLowerCase()===e.credentialType.toLowerCase()}matchClientId(e,n){return!!(e.clientId&&n===e.clientId)}matchFamilyId(e,n){return!!(e.familyId&&n===e.familyId)}matchRealm(e,n){var r;return((r=e.realm)==null?void 0:r.toLowerCase())===n.toLowerCase()}matchNativeAccountId(e,n){return!!(e.nativeAccountId&&n===e.nativeAccountId)}matchLoginHintFromTokenClaims(e,n){return e.login_hint===n||e.preferred_username===n||e.upn===n}matchSid(e,n){return e.sid===n}matchAuthorityType(e,n){return!!(e.authorityType&&n.toLowerCase()===e.authorityType.toLowerCase())}matchTarget(e,n){return e.credentialType!==Hr.ACCESS_TOKEN&&e.credentialType!==Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target?!1:Ar.fromString(e.target).containsScopeSet(n)}matchTokenType(e,n){return!!(e.tokenType&&e.tokenType===n)}matchKeyId(e,n){return!!(e.keyId&&e.keyId===n)}isAppMetadata(e){return e.indexOf(GE)!==-1}isAuthorityMetadata(e){return e.indexOf(Qy.CACHE_KEY)!==-1}generateAuthorityMetadataCacheKey(e){return`${Qy.CACHE_KEY}-${this.clientId}-${e}`}static toObject(e,n){for(const r in n)e[r]=n[r];return e}}class yte extends iA{async setAccount(){throw we(Kt)}getAccount(){throw we(Kt)}async setIdTokenCredential(){throw we(Kt)}getIdTokenCredential(){throw we(Kt)}async setAccessTokenCredential(){throw we(Kt)}getAccessTokenCredential(){throw we(Kt)}async setRefreshTokenCredential(){throw we(Kt)}getRefreshTokenCredential(){throw we(Kt)}setAppMetadata(){throw we(Kt)}getAppMetadata(){throw we(Kt)}setServerTelemetry(){throw we(Kt)}getServerTelemetry(){throw we(Kt)}setAuthorityMetadata(){throw we(Kt)}getAuthorityMetadata(){throw we(Kt)}getAuthorityMetadataKeys(){throw we(Kt)}setThrottlingCache(){throw we(Kt)}getThrottlingCache(){throw we(Kt)}removeItem(){throw we(Kt)}getKeys(){throw we(Kt)}getAccountKeys(){throw we(Kt)}getTokenKeys(){throw we(Kt)}generateCredentialKey(){throw we(Kt)}generateAccountKey(){throw we(Kt)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Di={AAD:"AAD",OIDC:"OIDC",EAR:"EAR"};/*! @azure/msal-common v15.10.0 2025-08-05 */const K={AcquireTokenByCode:"acquireTokenByCode",AcquireTokenByRefreshToken:"acquireTokenByRefreshToken",AcquireTokenSilent:"acquireTokenSilent",AcquireTokenSilentAsync:"acquireTokenSilentAsync",AcquireTokenPopup:"acquireTokenPopup",AcquireTokenPreRedirect:"acquireTokenPreRedirect",AcquireTokenRedirect:"acquireTokenRedirect",CryptoOptsGetPublicKeyThumbprint:"cryptoOptsGetPublicKeyThumbprint",CryptoOptsSignJwt:"cryptoOptsSignJwt",SilentCacheClientAcquireToken:"silentCacheClientAcquireToken",SilentIframeClientAcquireToken:"silentIframeClientAcquireToken",AwaitConcurrentIframe:"awaitConcurrentIframe",SilentRefreshClientAcquireToken:"silentRefreshClientAcquireToken",SsoSilent:"ssoSilent",StandardInteractionClientGetDiscoveredAuthority:"standardInteractionClientGetDiscoveredAuthority",FetchAccountIdWithNativeBroker:"fetchAccountIdWithNativeBroker",NativeInteractionClientAcquireToken:"nativeInteractionClientAcquireToken",BaseClientCreateTokenRequestHeaders:"baseClientCreateTokenRequestHeaders",NetworkClientSendPostRequestAsync:"networkClientSendPostRequestAsync",RefreshTokenClientExecutePostToTokenEndpoint:"refreshTokenClientExecutePostToTokenEndpoint",AuthorizationCodeClientExecutePostToTokenEndpoint:"authorizationCodeClientExecutePostToTokenEndpoint",BrokerHandhshake:"brokerHandshake",AcquireTokenByRefreshTokenInBroker:"acquireTokenByRefreshTokenInBroker",AcquireTokenByBroker:"acquireTokenByBroker",RefreshTokenClientExecuteTokenRequest:"refreshTokenClientExecuteTokenRequest",RefreshTokenClientAcquireToken:"refreshTokenClientAcquireToken",RefreshTokenClientAcquireTokenWithCachedRefreshToken:"refreshTokenClientAcquireTokenWithCachedRefreshToken",RefreshTokenClientAcquireTokenByRefreshToken:"refreshTokenClientAcquireTokenByRefreshToken",RefreshTokenClientCreateTokenRequestBody:"refreshTokenClientCreateTokenRequestBody",AcquireTokenFromCache:"acquireTokenFromCache",SilentFlowClientAcquireCachedToken:"silentFlowClientAcquireCachedToken",SilentFlowClientGenerateResultFromCacheRecord:"silentFlowClientGenerateResultFromCacheRecord",AcquireTokenBySilentIframe:"acquireTokenBySilentIframe",InitializeBaseRequest:"initializeBaseRequest",InitializeSilentRequest:"initializeSilentRequest",InitializeClientApplication:"initializeClientApplication",InitializeCache:"initializeCache",SilentIframeClientTokenHelper:"silentIframeClientTokenHelper",SilentHandlerInitiateAuthRequest:"silentHandlerInitiateAuthRequest",SilentHandlerMonitorIframeForHash:"silentHandlerMonitorIframeForHash",SilentHandlerLoadFrame:"silentHandlerLoadFrame",SilentHandlerLoadFrameSync:"silentHandlerLoadFrameSync",StandardInteractionClientCreateAuthCodeClient:"standardInteractionClientCreateAuthCodeClient",StandardInteractionClientGetClientConfiguration:"standardInteractionClientGetClientConfiguration",StandardInteractionClientInitializeAuthorizationRequest:"standardInteractionClientInitializeAuthorizationRequest",GetAuthCodeUrl:"getAuthCodeUrl",GetStandardParams:"getStandardParams",HandleCodeResponseFromServer:"handleCodeResponseFromServer",HandleCodeResponse:"handleCodeResponse",HandleResponseEar:"handleResponseEar",HandleResponsePlatformBroker:"handleResponsePlatformBroker",HandleResponseCode:"handleResponseCode",UpdateTokenEndpointAuthority:"updateTokenEndpointAuthority",AuthClientAcquireToken:"authClientAcquireToken",AuthClientExecuteTokenRequest:"authClientExecuteTokenRequest",AuthClientCreateTokenRequestBody:"authClientCreateTokenRequestBody",PopTokenGenerateCnf:"popTokenGenerateCnf",PopTokenGenerateKid:"popTokenGenerateKid",HandleServerTokenResponse:"handleServerTokenResponse",DeserializeResponse:"deserializeResponse",AuthorityFactoryCreateDiscoveredInstance:"authorityFactoryCreateDiscoveredInstance",AuthorityResolveEndpointsAsync:"authorityResolveEndpointsAsync",AuthorityResolveEndpointsFromLocalSources:"authorityResolveEndpointsFromLocalSources",AuthorityGetCloudDiscoveryMetadataFromNetwork:"authorityGetCloudDiscoveryMetadataFromNetwork",AuthorityUpdateCloudDiscoveryMetadata:"authorityUpdateCloudDiscoveryMetadata",AuthorityGetEndpointMetadataFromNetwork:"authorityGetEndpointMetadataFromNetwork",AuthorityUpdateEndpointMetadata:"authorityUpdateEndpointMetadata",AuthorityUpdateMetadataWithRegionalInformation:"authorityUpdateMetadataWithRegionalInformation",RegionDiscoveryDetectRegion:"regionDiscoveryDetectRegion",RegionDiscoveryGetRegionFromIMDS:"regionDiscoveryGetRegionFromIMDS",RegionDiscoveryGetCurrentVersion:"regionDiscoveryGetCurrentVersion",AcquireTokenByCodeAsync:"acquireTokenByCodeAsync",GetEndpointMetadataFromNetwork:"getEndpointMetadataFromNetwork",GetCloudDiscoveryMetadataFromNetworkMeasurement:"getCloudDiscoveryMetadataFromNetworkMeasurement",HandleRedirectPromiseMeasurement:"handleRedirectPromise",HandleNativeRedirectPromiseMeasurement:"handleNativeRedirectPromise",UpdateCloudDiscoveryMetadataMeasurement:"updateCloudDiscoveryMetadataMeasurement",UsernamePasswordClientAcquireToken:"usernamePasswordClientAcquireToken",NativeMessageHandlerHandshake:"nativeMessageHandlerHandshake",NativeGenerateAuthResult:"nativeGenerateAuthResult",RemoveHiddenIframe:"removeHiddenIframe",ClearTokensAndKeysWithClaims:"clearTokensAndKeysWithClaims",CacheManagerGetRefreshToken:"cacheManagerGetRefreshToken",ImportExistingCache:"importExistingCache",SetUserData:"setUserData",LocalStorageUpdated:"localStorageUpdated",GeneratePkceCodes:"generatePkceCodes",GenerateCodeVerifier:"generateCodeVerifier",GenerateCodeChallengeFromVerifier:"generateCodeChallengeFromVerifier",Sha256Digest:"sha256Digest",GetRandomValues:"getRandomValues",GenerateHKDF:"generateHKDF",GenerateBaseKey:"generateBaseKey",Base64Decode:"base64Decode",UrlEncodeArr:"urlEncodeArr",Encrypt:"encrypt",Decrypt:"decrypt",GenerateEarKey:"generateEarKey",DecryptEarResponse:"decryptEarResponse"},xte={NotStarted:0,InProgress:1,Completed:2};/*! @azure/msal-common v15.10.0 2025-08-05 */class SI{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class _B{generateId(){return"callback-id"}startMeasurement(e,n){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:xte.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:n||""},measurement:new SI}}startPerformanceMeasurement(){return new SI}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}/*! @azure/msal-common v15.10.0 2025-08-05 */const AB={tokenRenewalOffsetSeconds:U5,preventCorsPreflight:!1},bte={loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:Dn.Info,correlationId:pe.EMPTY_STRING},wte={claimsBasedCachingEnabled:!1},Ste={async sendGetRequestAsync(){throw we(Kt)},async sendPostRequestAsync(){throw we(Kt)}},Cte={sku:pe.SKU,version:JE,cpu:pe.EMPTY_STRING,os:pe.EMPTY_STRING},_te={clientSecret:pe.EMPTY_STRING,clientAssertion:void 0},Ate={azureCloudInstance:ZE.None,tenant:`${pe.DEFAULT_COMMON_TENANT}`},jte={application:{appName:"",appVersion:""}};function Ete({authOptions:t,systemOptions:e,loggerOptions:n,cacheOptions:r,storageInterface:i,networkInterface:o,cryptoInterface:s,clientCredentials:c,libraryInfo:l,telemetry:u,serverTelemetryManager:d,persistencePlugin:f,serializableCache:h}){const p={...bte,...n};return{authOptions:Tte(t),systemOptions:{...AB,...e},loggerOptions:p,cacheOptions:{...wte,...r},storageInterface:i||new yte(t.clientId,Jy,new Da(p),new _B),networkInterface:o||Ste,cryptoInterface:s||Jy,clientCredentials:c||_te,libraryInfo:{...Cte,...l},telemetry:{...jte,...u},serverTelemetryManager:d||null,persistencePlugin:f||null,serializableCache:h||null}}function Tte(t){return{clientCapabilities:[],azureCloudOptions:Ate,skipAuthorityMetadataCache:!1,instanceAware:!1,encodeExtraQueryParams:!1,...t}}function jB(t){return t.authOptions.authority.options.protocolMode===Di.OIDC}/*! @azure/msal-common v15.10.0 2025-08-05 */const Wo={HOME_ACCOUNT_ID:"home_account_id",UPN:"UPN"};/*! @azure/msal-common v15.10.0 2025-08-05 */function nx(t,e){if(!t)throw we(H5);try{const n=e(t);return JSON.parse(n)}catch{throw we(VE)}}function Cd(t){if(!t)throw we(VE);const e=t.split(Qp.CLIENT_INFO_SEPARATOR,2);return{uid:e[0],utid:e.length<2?pe.EMPTY_STRING:e[1]}}/*! @azure/msal-common v15.10.0 2025-08-05 */const fu="client_id",EB="redirect_uri",Nte="response_type",Pte="response_mode",kte="grant_type",Ote="claims",Ite="scope",Rte="refresh_token",Mte="state",Dte="nonce",$te="prompt",Lte="code",Fte="code_challenge",Bte="code_challenge_method",Ute="code_verifier",Hte="client-request-id",zte="x-client-SKU",Gte="x-client-VER",Vte="x-client-OS",Kte="x-client-CPU",Wte="x-client-current-telemetry",qte="x-client-last-telemetry",Yte="x-ms-lib-capability",Qte="x-app-name",Xte="x-app-ver",Jte="post_logout_redirect_uri",Zte="id_token_hint",ene="client_secret",tne="client_assertion",nne="client_assertion_type",TB="token_type",NB="req_cnf",CI="return_spa_code",rne="nativebroker",ine="logout_hint",one="sid",sne="login_hint",ane="domain_hint",cne="x-client-xtra-sku",rx="brk_client_id",ix="brk_redirect_uri",oA="instance_aware",lne="ear_jwk",une="ear_jwe_crypto";/*! @azure/msal-common v15.10.0 2025-08-05 */function j0(t,e,n){if(!e)return;const r=t.get(fu);r&&t.has(rx)&&(n==null||n.addFields({embeddedClientId:r,embeddedRedirectUri:t.get(EB)},e))}function cT(t,e){t.set(Nte,e)}function dne(t,e){t.set(Pte,e||Wee.QUERY)}function fne(t){t.set(rne,"1")}function lT(t,e,n=!0,r=vg){n&&!r.includes("openid")&&!e.includes("openid")&&r.push("openid");const i=n?[...e||[],...r]:e||[],o=new Ar(i);t.set(Ite,o.printScopes())}function uT(t,e){t.set(fu,e)}function dT(t,e){t.set(EB,e)}function hne(t,e){t.set(Jte,e)}function pne(t,e){t.set(Zte,e)}function mne(t,e){t.set(ane,e)}function dv(t,e){t.set(sne,e)}function ox(t,e){t.set(di.CCS_HEADER,`UPN:${e}`)}function lp(t,e){t.set(di.CCS_HEADER,`Oid:${e.uid}@${e.utid}`)}function _I(t,e){t.set(one,e)}function fT(t,e,n){const r=wne(e,n);try{JSON.parse(r)}catch{throw jn(eT)}t.set(Ote,r)}function hT(t,e){t.set(Hte,e)}function pT(t,e){t.set(zte,e.sku),t.set(Gte,e.version),e.os&&t.set(Vte,e.os),e.cpu&&t.set(Kte,e.cpu)}function mT(t,e){e!=null&&e.appName&&t.set(Qte,e.appName),e!=null&&e.appVersion&&t.set(Xte,e.appVersion)}function gne(t,e){t.set($te,e)}function PB(t,e){e&&t.set(Mte,e)}function vne(t,e){t.set(Dte,e)}function kB(t,e,n){if(e&&n)t.set(Fte,e),t.set(Bte,n);else throw jn(tT)}function yne(t,e){t.set(Lte,e)}function xne(t,e){t.set(Rte,e)}function bne(t,e){t.set(Ute,e)}function OB(t,e){t.set(ene,e)}function IB(t,e){e&&t.set(tne,e)}function RB(t,e){e&&t.set(nne,e)}function MB(t,e){t.set(kte,e)}function gT(t){t.set(qee,"1")}function DB(t){t.has(oA)||t.set(oA,"true")}function Mc(t,e){Object.entries(e).forEach(([n,r])=>{!t.has(n)&&r&&t.set(n,r)})}function wne(t,e){let n;if(!t)n={};else try{n=JSON.parse(t)}catch{throw jn(eT)}return e&&e.length>0&&(n.hasOwnProperty(lv.ACCESS_TOKEN)||(n[lv.ACCESS_TOKEN]={}),n[lv.ACCESS_TOKEN][lv.XMS_CC]={values:e}),JSON.stringify(n)}function vT(t,e){e&&(t.set(TB,yn.POP),t.set(NB,e))}function $B(t,e){e&&(t.set(TB,yn.SSH),t.set(NB,e))}function LB(t,e){t.set(Wte,e.generateCurrentRequestHeaderValue()),t.set(qte,e.generateLastRequestHeaderValue())}function FB(t){t.set(Yte,cp.X_MS_LIB_CAPABILITY_VALUE)}function Sne(t,e){t.set(ine,e)}function E0(t,e,n){t.has(rx)||t.set(rx,e),t.has(ix)||t.set(ix,n)}function Cne(t,e){t.set(lne,encodeURIComponent(e)),t.set(une,"eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0")}function _ne(t,e){Object.entries(e).forEach(([n,r])=>{r&&t.set(n,r)})}/*! @azure/msal-common v15.10.0 2025-08-05 */const Uo={Default:0,Adfs:1,Dsts:2,Ciam:3};/*! @azure/msal-common v15.10.0 2025-08-05 */function Ane(t){return t.hasOwnProperty("authorization_endpoint")&&t.hasOwnProperty("token_endpoint")&&t.hasOwnProperty("issuer")&&t.hasOwnProperty("jwks_uri")}/*! @azure/msal-common v15.10.0 2025-08-05 */function jne(t){return t.hasOwnProperty("tenant_discovery_endpoint")&&t.hasOwnProperty("metadata")}/*! @azure/msal-common v15.10.0 2025-08-05 */function Ene(t){return t.hasOwnProperty("error")&&t.hasOwnProperty("error_description")}/*! @azure/msal-common v15.10.0 2025-08-05 */const Zi=(t,e,n,r,i)=>(...o)=>{n.trace(`Executing function ${e}`);const s=r==null?void 0:r.startMeasurement(e,i);if(i){const c=e+"CallCount";r==null||r.incrementFields({[c]:1},i)}try{const c=t(...o);return s==null||s.end({success:!0}),n.trace(`Returning result from ${e}`),c}catch(c){n.trace(`Error occurred in ${e}`);try{n.trace(JSON.stringify(c))}catch{n.trace("Unable to print error message.")}throw s==null||s.end({success:!1},c),c}},fe=(t,e,n,r,i)=>(...o)=>{n.trace(`Executing function ${e}`);const s=r==null?void 0:r.startMeasurement(e,i);if(i){const c=e+"CallCount";r==null||r.incrementFields({[c]:1},i)}return r==null||r.setPreQueueTime(e,i),t(...o).then(c=>(n.trace(`Returning result from ${e}`),s==null||s.end({success:!0}),c)).catch(c=>{n.trace(`Error occurred in ${e}`);try{n.trace(JSON.stringify(c))}catch{n.trace("Unable to print error message.")}throw s==null||s.end({success:!1},c),c})};/*! @azure/msal-common v15.10.0 2025-08-05 */class T0{constructor(e,n,r,i){this.networkInterface=e,this.logger=n,this.performanceClient=r,this.correlationId=i}async detectRegion(e,n){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.RegionDiscoveryDetectRegion,this.correlationId);let r=e;if(r)n.region_source=$u.ENVIRONMENT_VARIABLE;else{const o=T0.IMDS_OPTIONS;try{const s=await fe(this.getRegionFromIMDS.bind(this),K.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(pe.IMDS_VERSION,o);if(s.status===wc.SUCCESS&&(r=s.body,n.region_source=$u.IMDS),s.status===wc.BAD_REQUEST){const c=await fe(this.getCurrentVersion.bind(this),K.RegionDiscoveryGetCurrentVersion,this.logger,this.performanceClient,this.correlationId)(o);if(!c)return n.region_source=$u.FAILED_AUTO_DETECTION,null;const l=await fe(this.getRegionFromIMDS.bind(this),K.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(c,o);l.status===wc.SUCCESS&&(r=l.body,n.region_source=$u.IMDS)}}catch{return n.region_source=$u.FAILED_AUTO_DETECTION,null}}return r||(n.region_source=$u.FAILED_AUTO_DETECTION),r||null}async getRegionFromIMDS(e,n){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(K.RegionDiscoveryGetRegionFromIMDS,this.correlationId),this.networkInterface.sendGetRequestAsync(`${pe.IMDS_ENDPOINT}?api-version=${e}&format=text`,n,pe.IMDS_TIMEOUT)}async getCurrentVersion(e){var n;(n=this.performanceClient)==null||n.addQueueMeasurement(K.RegionDiscoveryGetCurrentVersion,this.correlationId);try{const r=await this.networkInterface.sendGetRequestAsync(`${pe.IMDS_ENDPOINT}?format=json`,e);return r.status===wc.BAD_REQUEST&&r.body&&r.body["newest-versions"]&&r.body["newest-versions"].length>0?r.body["newest-versions"][0]:null}catch{return null}}}T0.IMDS_OPTIONS={headers:{Metadata:"true"}};/*! @azure/msal-common v15.10.0 2025-08-05 */function $i(){return Math.round(new Date().getTime()/1e3)}function AI(t){return t.getTime()/1e3}function _d(t){return t?new Date(Number(t)*1e3):new Date}function sx(t,e){const n=Number(t)||0;return $i()+e>n}function Tne(t,e){const n=Number(t)+e*24*60*60*1e3;return Date.now()>n}function Nne(t){return Number(t)>$i()}/*! @azure/msal-common v15.10.0 2025-08-05 */function N0(t,e,n,r,i){return{credentialType:Hr.ID_TOKEN,homeAccountId:t,environment:e,clientId:r,secret:n,realm:i,lastUpdatedAt:Date.now().toString()}}function P0(t,e,n,r,i,o,s,c,l,u,d,f,h,p,g){var y,b;const m={homeAccountId:t,credentialType:Hr.ACCESS_TOKEN,secret:n,cachedAt:$i().toString(),expiresOn:s.toString(),extendedExpiresOn:c.toString(),environment:e,clientId:r,realm:i,target:o,tokenType:d||yn.BEARER,lastUpdatedAt:Date.now().toString()};if(f&&(m.userAssertionHash=f),u&&(m.refreshOn=u.toString()),p&&(m.requestedClaims=p,m.requestedClaimsHash=g),((y=m.tokenType)==null?void 0:y.toLowerCase())!==yn.BEARER.toLowerCase())switch(m.credentialType=Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME,m.tokenType){case yn.POP:const x=Hf(n,l);if(!((b=x==null?void 0:x.cnf)!=null&&b.kid))throw we(tB);m.keyId=x.cnf.kid;break;case yn.SSH:m.keyId=h}return m}function BB(t,e,n,r,i,o,s){const c={credentialType:Hr.REFRESH_TOKEN,homeAccountId:t,environment:e,clientId:r,secret:n,lastUpdatedAt:Date.now().toString()};return o&&(c.userAssertionHash=o),i&&(c.familyId=i),s&&(c.expiresOn=s.toString()),c}function yT(t){return t.hasOwnProperty("homeAccountId")&&t.hasOwnProperty("environment")&&t.hasOwnProperty("credentialType")&&t.hasOwnProperty("clientId")&&t.hasOwnProperty("secret")}function jI(t){return t?yT(t)&&t.hasOwnProperty("realm")&&t.hasOwnProperty("target")&&(t.credentialType===Hr.ACCESS_TOKEN||t.credentialType===Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME):!1}function Pne(t){return t?yT(t)&&t.hasOwnProperty("realm")&&t.credentialType===Hr.ID_TOKEN:!1}function EI(t){return t?yT(t)&&t.credentialType===Hr.REFRESH_TOKEN:!1}function kne(t,e){const n=t.indexOf(Lr.CACHE_KEY)===0;let r=!0;return e&&(r=e.hasOwnProperty("failedRequests")&&e.hasOwnProperty("errors")&&e.hasOwnProperty("cacheHits")),n&&r}function One(t,e){let n=!1;t&&(n=t.indexOf(cp.THROTTLING_PREFIX)===0);let r=!0;return e&&(r=e.hasOwnProperty("throttleTime")),n&&r}function Ine({environment:t,clientId:e}){return[GE,t,e].join(Qp.CACHE_KEY_SEPARATOR).toLowerCase()}function Rne(t,e){return e?t.indexOf(GE)===0&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("environment"):!1}function Mne(t,e){return e?t.indexOf(Qy.CACHE_KEY)===0&&e.hasOwnProperty("aliases")&&e.hasOwnProperty("preferred_cache")&&e.hasOwnProperty("preferred_network")&&e.hasOwnProperty("canonical_authority")&&e.hasOwnProperty("authorization_endpoint")&&e.hasOwnProperty("token_endpoint")&&e.hasOwnProperty("issuer")&&e.hasOwnProperty("aliasesFromNetwork")&&e.hasOwnProperty("endpointsFromNetwork")&&e.hasOwnProperty("expiresAt")&&e.hasOwnProperty("jwks_uri"):!1}function TI(){return $i()+Qy.REFRESH_TIME_SECONDS}function fv(t,e,n){t.authorization_endpoint=e.authorization_endpoint,t.token_endpoint=e.token_endpoint,t.end_session_endpoint=e.end_session_endpoint,t.issuer=e.issuer,t.endpointsFromNetwork=n,t.jwks_uri=e.jwks_uri}function FS(t,e,n){t.aliases=e.aliases,t.preferred_cache=e.preferred_cache,t.preferred_network=e.preferred_network,t.aliasesFromNetwork=n}function NI(t){return t.expiresAt<=$i()}/*! @azure/msal-common v15.10.0 2025-08-05 */class Zr{constructor(e,n,r,i,o,s,c,l){this.canonicalAuthority=e,this._canonicalAuthority.validateAsUri(),this.networkInterface=n,this.cacheManager=r,this.authorityOptions=i,this.regionDiscoveryMetadata={region_used:void 0,region_source:void 0,region_outcome:void 0},this.logger=o,this.performanceClient=c,this.correlationId=s,this.managedIdentity=l||!1,this.regionDiscovery=new T0(n,this.logger,this.performanceClient,this.correlationId)}getAuthorityType(e){if(e.HostNameAndPort.endsWith(pe.CIAM_AUTH_URL))return Uo.Ciam;const n=e.PathSegments;if(n.length)switch(n[0].toLowerCase()){case pe.ADFS:return Uo.Adfs;case pe.DSTS:return Uo.Dsts}return Uo.Default}get authorityType(){return this.getAuthorityType(this.canonicalAuthorityUrlComponents)}get protocolMode(){return this.authorityOptions.protocolMode}get options(){return this.authorityOptions}get canonicalAuthority(){return this._canonicalAuthority.urlString}set canonicalAuthority(e){this._canonicalAuthority=new tn(e),this._canonicalAuthority.validateAsUri(),this._canonicalAuthorityUrlComponents=null}get canonicalAuthorityUrlComponents(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents}get hostnameAndPort(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()}get tenant(){return this.canonicalAuthorityUrlComponents.PathSegments[0]}get authorizationEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.authorization_endpoint);throw we(da)}get tokenEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw we(da)}get deviceCodeEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));throw we(da)}get endSessionEndpoint(){if(this.discoveryComplete()){if(!this.metadata.end_session_endpoint)throw we(iB);return this.replacePath(this.metadata.end_session_endpoint)}else throw we(da)}get selfSignedJwtAudience(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw we(da)}get jwksUri(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw we(da)}canReplaceTenant(e){return e.PathSegments.length===1&&!Zr.reservedTenantDomains.has(e.PathSegments[0])&&this.getAuthorityType(e)===Uo.Default&&this.protocolMode!==Di.OIDC}replaceTenant(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)}replacePath(e){let n=e;const i=new tn(this.metadata.canonical_authority).getUrlComponents(),o=i.PathSegments;return this.canonicalAuthorityUrlComponents.PathSegments.forEach((c,l)=>{let u=o[l];if(l===0&&this.canReplaceTenant(i)){const d=new tn(this.metadata.authorization_endpoint).getUrlComponents().PathSegments[0];u!==d&&(this.logger.verbose(`Replacing tenant domain name ${u} with id ${d}`),u=d)}c!==u&&(n=n.replace(`/${u}/`,`/${c}/`))}),this.replaceTenant(n)}get defaultOpenIdConfigurationEndpoint(){const e=this.hostnameAndPort;return this.canonicalAuthority.endsWith("v2.0/")||this.authorityType===Uo.Adfs||this.protocolMode===Di.OIDC&&!this.isAliasOfKnownMicrosoftAuthority(e)?`${this.canonicalAuthority}.well-known/openid-configuration`:`${this.canonicalAuthority}v2.0/.well-known/openid-configuration`}discoveryComplete(){return!!this.metadata}async resolveEndpointsAsync(){var i,o;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityResolveEndpointsAsync,this.correlationId);const e=this.getCurrentMetadataEntity(),n=await fe(this.updateCloudDiscoveryMetadata.bind(this),K.AuthorityUpdateCloudDiscoveryMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,e.preferred_network);const r=await fe(this.updateEndpointMetadata.bind(this),K.AuthorityUpdateEndpointMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.updateCachedMetadata(e,n,{source:r}),(o=this.performanceClient)==null||o.addFields({cloudDiscoverySource:n,authorityEndpointSource:r},this.correlationId)}getCurrentMetadataEntity(){let e=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);return e||(e={aliases:[],preferred_cache:this.hostnameAndPort,preferred_network:this.hostnameAndPort,canonical_authority:this.canonicalAuthority,authorization_endpoint:"",token_endpoint:"",end_session_endpoint:"",issuer:"",aliasesFromNetwork:!1,endpointsFromNetwork:!1,expiresAt:TI(),jwks_uri:""}),e}updateCachedMetadata(e,n,r){n!==Ui.CACHE&&(r==null?void 0:r.source)!==Ui.CACHE&&(e.expiresAt=TI(),e.canonical_authority=this.canonicalAuthority);const i=this.cacheManager.generateAuthorityMetadataCacheKey(e.preferred_cache);this.cacheManager.setAuthorityMetadata(i,e),this.metadata=e}async updateEndpointMetadata(e){var i,o,s;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityUpdateEndpointMetadata,this.correlationId);const n=this.updateEndpointMetadataFromLocalSources(e);if(n){if(n.source===Ui.HARDCODED_VALUES&&(o=this.authorityOptions.azureRegionConfiguration)!=null&&o.azureRegion&&n.metadata){const c=await fe(this.updateMetadataWithRegionalInformation.bind(this),K.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(n.metadata);fv(e,c,!1),e.canonical_authority=this.canonicalAuthority}return n.source}let r=await fe(this.getEndpointMetadataFromNetwork.bind(this),K.AuthorityGetEndpointMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return(s=this.authorityOptions.azureRegionConfiguration)!=null&&s.azureRegion&&(r=await fe(this.updateMetadataWithRegionalInformation.bind(this),K.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(r)),fv(e,r,!0),Ui.NETWORK;throw we(V5,this.defaultOpenIdConfigurationEndpoint)}updateEndpointMetadataFromLocalSources(e){this.logger.verbose("Attempting to get endpoint metadata from authority configuration");const n=this.getEndpointMetadataFromConfig();if(n)return this.logger.verbose("Found endpoint metadata in authority configuration"),fv(e,n,!1),{source:Ui.CONFIG};if(this.logger.verbose("Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values."),this.authorityOptions.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get endpoint metadata from the network metadata cache.");else{const i=this.getEndpointMetadataFromHardcodedValues();if(i)return fv(e,i,!1),{source:Ui.HARDCODED_VALUES,metadata:i};this.logger.verbose("Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache.")}const r=NI(e);return this.isAuthoritySameType(e)&&e.endpointsFromNetwork&&!r?(this.logger.verbose("Found endpoint metadata in the cache."),{source:Ui.CACHE}):(r&&this.logger.verbose("The metadata entity is expired."),null)}isAuthoritySameType(e){return new tn(e.canonical_authority).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length}getEndpointMetadataFromConfig(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch{throw jn(fB)}return null}async getEndpointMetadataFromNetwork(){var r;(r=this.performanceClient)==null||r.addQueueMeasurement(K.AuthorityGetEndpointMetadataFromNetwork,this.correlationId);const e={},n=this.defaultOpenIdConfigurationEndpoint;this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from ${n}`);try{const i=await this.networkInterface.sendGetRequestAsync(n,e);return Ane(i.body)?i.body:(this.logger.verbose("Authority.getEndpointMetadataFromNetwork: could not parse response as OpenID configuration"),null)}catch(i){return this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: ${i}`),null}}getEndpointMetadataFromHardcodedValues(){return this.hostnameAndPort in bI?bI[this.hostnameAndPort]:null}async updateMetadataWithRegionalInformation(e){var r,i,o;(r=this.performanceClient)==null||r.addQueueMeasurement(K.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId);const n=(i=this.authorityOptions.azureRegionConfiguration)==null?void 0:i.azureRegion;if(n){if(n!==pe.AZURE_REGION_AUTO_DISCOVER_FLAG)return this.regionDiscoveryMetadata.region_outcome=$S.CONFIGURED_NO_AUTO_DETECTION,this.regionDiscoveryMetadata.region_used=n,Zr.replaceWithRegionalInformation(e,n);const s=await fe(this.regionDiscovery.detectRegion.bind(this.regionDiscovery),K.RegionDiscoveryDetectRegion,this.logger,this.performanceClient,this.correlationId)((o=this.authorityOptions.azureRegionConfiguration)==null?void 0:o.environmentRegion,this.regionDiscoveryMetadata);if(s)return this.regionDiscoveryMetadata.region_outcome=$S.AUTO_DETECTION_REQUESTED_SUCCESSFUL,this.regionDiscoveryMetadata.region_used=s,Zr.replaceWithRegionalInformation(e,s);this.regionDiscoveryMetadata.region_outcome=$S.AUTO_DETECTION_REQUESTED_FAILED}return e}async updateCloudDiscoveryMetadata(e){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId);const n=this.updateCloudDiscoveryMetadataFromLocalSources(e);if(n)return n;const r=await fe(this.getCloudDiscoveryMetadataFromNetwork.bind(this),K.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return FS(e,r,!0),Ui.NETWORK;throw jn(hB)}updateCloudDiscoveryMetadataFromLocalSources(e){this.logger.verbose("Attempting to get cloud discovery metadata from authority configuration"),this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities||pe.NOT_APPLICABLE}`),this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata||pe.NOT_APPLICABLE}`),this.logger.verbosePii(`Canonical Authority: ${e.canonical_authority||pe.NOT_APPLICABLE}`);const n=this.getCloudDiscoveryMetadataFromConfig();if(n)return this.logger.verbose("Found cloud discovery metadata in authority configuration"),FS(e,n,!1),Ui.CONFIG;if(this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values."),this.options.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded cloud discovery metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get cloud discovery metadata from the network metadata cache.");else{const i=vte(this.hostnameAndPort);if(i)return this.logger.verbose("Found cloud discovery metadata from hardcoded values."),FS(e,i,!1),Ui.HARDCODED_VALUES;this.logger.verbose("Did not find cloud discovery metadata in hardcoded values... Attempting to get cloud discovery metadata from the network metadata cache.")}const r=NI(e);return this.isAuthoritySameType(e)&&e.aliasesFromNetwork&&!r?(this.logger.verbose("Found cloud discovery metadata in the cache."),Ui.CACHE):(r&&this.logger.verbose("The metadata entity is expired."),null)}getCloudDiscoveryMetadataFromConfig(){if(this.authorityType===Uo.Ciam)return this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host."),Zr.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);if(this.authorityOptions.cloudDiscoveryMetadata){this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");try{this.logger.verbose("Attempting to parse the cloud discovery metadata.");const e=JSON.parse(this.authorityOptions.cloudDiscoveryMetadata),n=ex(e.metadata,this.hostnameAndPort);if(this.logger.verbose("Parsed the cloud discovery metadata."),n)return this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata."),n;this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.")}catch{throw this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error."),jn(nT)}}return this.isInKnownAuthorities()?(this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host."),Zr.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null}async getCloudDiscoveryMetadataFromNetwork(){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId);const e=`${pe.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`,n={};let r=null;try{const o=await this.networkInterface.sendGetRequestAsync(e,n);let s,c;if(jne(o.body))s=o.body,c=s.metadata,this.logger.verbosePii(`tenant_discovery_endpoint is: ${s.tenant_discovery_endpoint}`);else if(Ene(o.body)){if(this.logger.warning(`A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: ${o.status}`),s=o.body,s.error===pe.INVALID_INSTANCE)return this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance."),null;this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error is ${s.error}`),this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error description is ${s.error_description}`),this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []"),c=[]}else return this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse"),null;this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request."),r=ex(c,this.hostnameAndPort)}catch(o){if(o instanceof _n)this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata. -Error: ${o.errorCode} -Error Description: ${o.errorMessage}`);else{const s=o;this.logger.error(`A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata. -Error: ${s.name} -Error Description: ${s.message}`)}return null}return r||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),r=Zr.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),r}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter(n=>n&&tn.getDomainFromUrl(n).toLowerCase()===this.hostnameAndPort).length>0}static generateAuthority(e,n){let r;if(n&&n.azureCloudInstance!==ZE.None){const i=n.tenant?n.tenant:pe.DEFAULT_COMMON_TENANT;r=`${n.azureCloudInstance}/${i}/`}return r||e}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}getPreferredCache(){if(this.managedIdentity)return pe.DEFAULT_AUTHORITY_HOST;if(this.discoveryComplete())return this.metadata.preferred_cache;throw we(da)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return CB.has(e)}static isPublicCloudAuthority(e){return pe.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,n,r){const i=new tn(e);i.validateAsUri();const o=i.getUrlComponents();let s=`${n}.${o.HostNameAndPort}`;this.isPublicCloudAuthority(o.HostNameAndPort)&&(s=`${n}.${pe.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const c=tn.constructAuthorityUriFromObject({...i.getUrlComponents(),HostNameAndPort:s}).urlString;return r?`${c}?${r}`:c}static replaceWithRegionalInformation(e,n){const r={...e};return r.authorization_endpoint=Zr.buildRegionalAuthorityString(r.authorization_endpoint,n),r.token_endpoint=Zr.buildRegionalAuthorityString(r.token_endpoint,n),r.end_session_endpoint&&(r.end_session_endpoint=Zr.buildRegionalAuthorityString(r.end_session_endpoint,n)),r}static transformCIAMAuthority(e){let n=e;const i=new tn(e).getUrlComponents();if(i.PathSegments.length===0&&i.HostNameAndPort.endsWith(pe.CIAM_AUTH_URL)){const o=i.HostNameAndPort.split(".")[0];n=`${n}${o}${pe.AAD_TENANT_DOMAIN_SUFFIX}`}return n}}Zr.reservedTenantDomains=new Set(["{tenant}","{tenantid}",Ic.COMMON,Ic.CONSUMERS,Ic.ORGANIZATIONS]);function Dne(t){var i;const r=(i=new tn(t).getUrlComponents().PathSegments.slice(-1)[0])==null?void 0:i.toLowerCase();switch(r){case Ic.COMMON:case Ic.ORGANIZATIONS:case Ic.CONSUMERS:return;default:return r}}function UB(t){return t.endsWith(pe.FORWARD_SLASH)?t:`${t}${pe.FORWARD_SLASH}`}function $ne(t){const e=t.cloudDiscoveryMetadata;let n;if(e)try{n=JSON.parse(e)}catch{throw jn(nT)}return{canonicalAuthority:t.authority?UB(t.authority):void 0,knownAuthorities:t.knownAuthorities,cloudDiscoveryMetadata:n}}/*! @azure/msal-common v15.10.0 2025-08-05 */async function HB(t,e,n,r,i,o,s){s==null||s.addQueueMeasurement(K.AuthorityFactoryCreateDiscoveredInstance,o);const c=Zr.transformCIAMAuthority(UB(t)),l=new Zr(c,e,n,r,i,o,s);try{return await fe(l.resolveEndpointsAsync.bind(l),K.AuthorityResolveEndpointsAsync,i,s,o)(),l}catch{throw we(da)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Tu extends _n{constructor(e,n,r,i,o){super(e,n,r),this.name="ServerError",this.errorNo=i,this.status=o,Object.setPrototypeOf(this,Tu.prototype)}}/*! @azure/msal-common v15.10.0 2025-08-05 */function k0(t,e,n){var r;return{clientId:t,authority:e.authority,scopes:e.scopes,homeAccountIdentifier:n,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,embeddedClientId:e.embeddedClientId||((r=e.tokenBodyParameters)==null?void 0:r.clientId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Ts{static generateThrottlingStorageKey(e){return`${cp.THROTTLING_PREFIX}.${JSON.stringify(e)}`}static preProcess(e,n,r){var s;const i=Ts.generateThrottlingStorageKey(n),o=e.getThrottlingCache(i);if(o){if(o.throttleTime=500&&e.status<600}static checkResponseForRetryAfter(e){return e.headers?e.headers.hasOwnProperty(di.RETRY_AFTER)&&(e.status<200||e.status>=300):!1}static calculateThrottleTime(e){const n=e<=0?0:e,r=Date.now()/1e3;return Math.floor(Math.min(r+(n||cp.DEFAULT_THROTTLE_TIME_SECONDS),r+cp.DEFAULT_MAX_THROTTLE_TIME_SECONDS)*1e3)}static removeThrottle(e,n,r,i){const o=k0(n,r,i),s=this.generateThrottlingStorageKey(o);e.removeItem(s,r.correlationId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class O0 extends _n{constructor(e,n,r){super(e.errorCode,e.errorMessage,e.subError),Object.setPrototypeOf(this,O0.prototype),this.name="NetworkError",this.error=e,this.httpStatus=n,this.responseHeaders=r}}function Vh(t,e,n,r){return t.errorMessage=`${t.errorMessage}, additionalErrorInfo: error.name:${r==null?void 0:r.name}, error.message:${r==null?void 0:r.message}`,new O0(t,e,n)}/*! @azure/msal-common v15.10.0 2025-08-05 */class xT{constructor(e,n){this.config=Ete(e),this.logger=new Da(this.config.loggerOptions,oB,JE),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=n}createTokenRequestHeaders(e){const n={};if(n[di.CONTENT_TYPE]=pe.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case Wo.HOME_ACCOUNT_ID:try{const r=Cd(e.credential);n[di.CCS_HEADER]=`Oid:${r.uid}@${r.utid}`}catch(r){this.logger.verbose("Could not parse home account ID for CCS Header: "+r)}break;case Wo.UPN:n[di.CCS_HEADER]=`UPN: ${e.credential}`;break}return n}async executePostToTokenEndpoint(e,n,r,i,o,s){var l;s&&((l=this.performanceClient)==null||l.addQueueMeasurement(s,o));const c=await this.sendPostRequest(i,e,{body:n,headers:r},o);return this.config.serverTelemetryManager&&c.status<500&&c.status!==429&&this.config.serverTelemetryManager.clearTelemetryCache(),c}async sendPostRequest(e,n,r,i){var s,c,l;Ts.preProcess(this.cacheManager,e,i);let o;try{o=await fe(this.networkClient.sendPostRequestAsync.bind(this.networkClient),K.NetworkClientSendPostRequestAsync,this.logger,this.performanceClient,i)(n,r);const u=o.headers||{};(c=this.performanceClient)==null||c.addFields({refreshTokenSize:((s=o.body.refresh_token)==null?void 0:s.length)||0,httpVerToken:u[di.X_MS_HTTP_VERSION]||"",requestId:u[di.X_MS_REQUEST_ID]||""},i)}catch(u){if(u instanceof O0){const d=u.responseHeaders;throw d&&((l=this.performanceClient)==null||l.addFields({httpVerToken:d[di.X_MS_HTTP_VERSION]||"",requestId:d[di.X_MS_REQUEST_ID]||"",contentTypeHeader:d[di.CONTENT_TYPE]||void 0,contentLengthHeader:d[di.CONTENT_LENGTH]||void 0,httpStatus:u.httpStatus},i)),u.error}throw u instanceof _n?u:we(G5)}return Ts.postProcess(this.cacheManager,e,o,i),o}async updateAuthority(e,n){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(K.UpdateTokenEndpointAuthority,n);const r=`https://${e}/${this.authority.tenant}/`,i=await HB(r,this.networkClient,this.cacheManager,this.authority.options,this.logger,n,this.performanceClient);this.authority=i}createTokenQueryParameters(e){const n=new Map;return e.embeddedClientId&&E0(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenQueryParameters&&Mc(n,e.tokenQueryParameters),hT(n,e.correlationId),j0(n,e.correlationId,this.performanceClient),Xp(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */function zB(t){return t&&(t.tid||t.tfp||t.acr)||null}/*! @azure/msal-common v15.10.0 2025-08-05 */class cs{getAccountInfo(){return{homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId,loginHint:this.loginHint,name:this.name,nativeAccountId:this.nativeAccountId,authorityType:this.authorityType,tenantProfiles:new Map((this.tenantProfiles||[]).map(e=>[e.tenantId,e]))}}isSingleTenant(){return!this.tenantProfiles}static createAccount(e,n,r){var u,d,f,h,p,g,m;const i=new cs;n.authorityType===Uo.Adfs?i.authorityType=uv.ADFS_ACCOUNT_TYPE:n.protocolMode===Di.OIDC?i.authorityType=uv.GENERIC_ACCOUNT_TYPE:i.authorityType=uv.MSSTS_ACCOUNT_TYPE;let o;e.clientInfo&&r&&(o=nx(e.clientInfo,r)),i.clientInfo=e.clientInfo,i.homeAccountId=e.homeAccountId,i.nativeAccountId=e.nativeAccountId;const s=e.environment||n&&n.getPreferredCache();if(!s)throw we(YE);i.environment=s,i.realm=(o==null?void 0:o.utid)||zB(e.idTokenClaims)||"",i.localAccountId=(o==null?void 0:o.uid)||((u=e.idTokenClaims)==null?void 0:u.oid)||((d=e.idTokenClaims)==null?void 0:d.sub)||"";const c=((f=e.idTokenClaims)==null?void 0:f.preferred_username)||((h=e.idTokenClaims)==null?void 0:h.upn),l=(p=e.idTokenClaims)!=null&&p.emails?e.idTokenClaims.emails[0]:null;if(i.username=c||l||"",i.loginHint=(g=e.idTokenClaims)==null?void 0:g.login_hint,i.name=((m=e.idTokenClaims)==null?void 0:m.name)||"",i.cloudGraphHostName=e.cloudGraphHostName,i.msGraphHost=e.msGraphHost,e.tenantProfiles)i.tenantProfiles=e.tenantProfiles;else{const y=iT(e.homeAccountId,i.localAccountId,i.realm,e.idTokenClaims);i.tenantProfiles=[y]}return i}static createFromAccountInfo(e,n,r){var o;const i=new cs;return i.authorityType=e.authorityType||uv.GENERIC_ACCOUNT_TYPE,i.homeAccountId=e.homeAccountId,i.localAccountId=e.localAccountId,i.nativeAccountId=e.nativeAccountId,i.realm=e.tenantId,i.environment=e.environment,i.username=e.username,i.name=e.name,i.loginHint=e.loginHint,i.cloudGraphHostName=n,i.msGraphHost=r,i.tenantProfiles=Array.from(((o=e.tenantProfiles)==null?void 0:o.values())||[]),i}static generateHomeAccountId(e,n,r,i,o){if(!(n===Uo.Adfs||n===Uo.Dsts)){if(e)try{const s=nx(e,i.base64Decode);if(s.uid&&s.utid)return`${s.uid}.${s.utid}`}catch{}r.warning("No client info in response")}return(o==null?void 0:o.sub)||""}static isAccountEntity(e){return e?e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("localAccountId")&&e.hasOwnProperty("username")&&e.hasOwnProperty("authorityType"):!1}static accountInfoIsEqual(e,n,r){if(!e||!n)return!1;let i=!0;if(r){const o=e.idTokenClaims||{},s=n.idTokenClaims||{};i=o.iat===s.iat&&o.nonce===s.nonce}return e.homeAccountId===n.homeAccountId&&e.localAccountId===n.localAccountId&&e.username===n.username&&e.tenantId===n.tenantId&&e.loginHint===n.loginHint&&e.environment===n.environment&&e.nativeAccountId===n.nativeAccountId&&i}}/*! @azure/msal-common v15.10.0 2025-08-05 */const ax="no_tokens_found",GB="native_account_unavailable",bT="refresh_token_expired",wT="ux_not_allowed",Lne="interaction_required",Fne="consent_required",Bne="login_required",I0="bad_token";/*! @azure/msal-common v15.10.0 2025-08-05 */const PI=[Lne,Fne,Bne,I0,wT],Une=["message_only","additional_action","basic_action","user_password_expired","consent_required","bad_token"],Hne={[ax]:"No refresh token found in the cache. Please sign-in.",[GB]:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.",[bT]:"Refresh token has expired.",[I0]:"Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve.",[wT]:"`canShowUI` flag in Edge was set to false. User interaction required on web page. Please invoke an interactive API to resolve."};class ls extends _n{constructor(e,n,r,i,o,s,c,l){super(e,n,r),Object.setPrototypeOf(this,ls.prototype),this.timestamp=i||pe.EMPTY_STRING,this.traceId=o||pe.EMPTY_STRING,this.correlationId=s||pe.EMPTY_STRING,this.claims=c||pe.EMPTY_STRING,this.name="InteractionRequiredAuthError",this.errorNo=l}}function VB(t,e,n){const r=!!t&&PI.indexOf(t)>-1,i=!!n&&Une.indexOf(n)>-1,o=!!e&&PI.some(s=>e.indexOf(s)>-1);return r||o||i}function cx(t){return new ls(t,Hne[t])}/*! @azure/msal-common v15.10.0 2025-08-05 */class zf{static setRequestState(e,n,r){const i=zf.generateLibraryState(e,r);return n?`${i}${pe.RESOURCE_DELIM}${n}`:i}static generateLibraryState(e,n){if(!e)throw we(nA);const r={id:e.createNewGuid()};n&&(r.meta=n);const i=JSON.stringify(r);return e.base64Encode(i)}static parseRequestState(e,n){if(!e)throw we(nA);if(!n)throw we(Xd);try{const r=n.split(pe.RESOURCE_DELIM),i=r[0],o=r.length>1?r.slice(1).join(pe.RESOURCE_DELIM):pe.EMPTY_STRING,s=e.base64Decode(i),c=JSON.parse(s);return{userRequestState:o||pe.EMPTY_STRING,libraryState:c}}catch{throw we(Xd)}}}/*! @azure/msal-common v15.10.0 2025-08-05 */const zne={SW:"sw"};class Jd{constructor(e,n){this.cryptoUtils=e,this.performanceClient=n}async generateCnf(e,n){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(K.PopTokenGenerateCnf,e.correlationId);const r=await fe(this.generateKid.bind(this),K.PopTokenGenerateCnf,n,this.performanceClient,e.correlationId)(e),i=this.cryptoUtils.base64UrlEncode(JSON.stringify(r));return{kid:r.kid,reqCnfString:i}}async generateKid(e){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(K.PopTokenGenerateKid,e.correlationId),{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:zne.SW}}async signPopToken(e,n,r){return this.signPayload(e,n,r)}async signPayload(e,n,r,i){const{resourceRequestMethod:o,resourceRequestUri:s,shrClaims:c,shrNonce:l,shrOptions:u}=r,d=s?new tn(s):void 0,f=d==null?void 0:d.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:$i(),m:o==null?void 0:o.toUpperCase(),u:f==null?void 0:f.HostNameAndPort,nonce:l||this.cryptoUtils.createNewGuid(),p:f==null?void 0:f.AbsolutePath,q:f!=null&&f.QueryString?[[],f.QueryString]:void 0,client_claims:c||void 0,...i},n,u,r.correlationId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Gne{constructor(e,n){this.cache=e,this.hasChanged=n}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}/*! @azure/msal-common v15.10.0 2025-08-05 */class hu{constructor(e,n,r,i,o,s,c){this.clientId=e,this.cacheStorage=n,this.cryptoObj=r,this.logger=i,this.serializableCache=o,this.persistencePlugin=s,this.performanceClient=c}validateTokenResponse(e,n){var r;if(e.error||e.error_description||e.suberror){const i=`Error(s): ${e.error_codes||pe.NOT_AVAILABLE} - Timestamp: ${e.timestamp||pe.NOT_AVAILABLE} - Description: ${e.error_description||pe.NOT_AVAILABLE} - Correlation ID: ${e.correlation_id||pe.NOT_AVAILABLE} - Trace ID: ${e.trace_id||pe.NOT_AVAILABLE}`,o=(r=e.error_codes)!=null&&r.length?e.error_codes[0]:void 0,s=new Tu(e.error,i,e.suberror,o,e.status);if(n&&e.status&&e.status>=wc.SERVER_ERROR_RANGE_START&&e.status<=wc.SERVER_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed. -${s}`);return}else if(n&&e.status&&e.status>=wc.CLIENT_ERROR_RANGE_START&&e.status<=wc.CLIENT_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently available but is unable to refresh the access token. -${s}`);return}throw VB(e.error,e.error_description,e.suberror)?new ls(e.error,e.error_description,e.suberror,e.timestamp||pe.EMPTY_STRING,e.trace_id||pe.EMPTY_STRING,e.correlation_id||pe.EMPTY_STRING,e.claims||pe.EMPTY_STRING,o):s}}async handleServerTokenResponse(e,n,r,i,o,s,c,l,u){var g;(g=this.performanceClient)==null||g.addQueueMeasurement(K.HandleServerTokenResponse,e.correlation_id);let d;if(e.id_token){if(d=Hf(e.id_token||pe.EMPTY_STRING,this.cryptoObj.base64Decode),o&&o.nonce&&d.nonce!==o.nonce)throw we(q5);if(i.maxAge||i.maxAge===0){const m=d.auth_time;if(!m)throw we(WE);bB(m,i.maxAge)}}this.homeAccountIdentifier=cs.generateHomeAccountId(e.client_info||pe.EMPTY_STRING,n.authorityType,this.logger,this.cryptoObj,d);let f;o&&o.state&&(f=zf.parseRequestState(this.cryptoObj,o.state)),e.key_id=e.key_id||i.sshKid||void 0;const h=this.generateCacheRecord(e,n,r,i,d,s,o);let p;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),p=new Gne(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(p)),c&&!l&&h.account){const m=this.cacheStorage.generateAccountKey(h.account.getAccountInfo());if(!this.cacheStorage.getAccount(m,i.correlationId))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await hu.generateAuthenticationResult(this.cryptoObj,n,h,!1,i,d,f,void 0,u)}await this.cacheStorage.saveCacheRecord(h,i.correlationId,i.storeInCache)}finally{this.persistencePlugin&&this.serializableCache&&p&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(p))}return hu.generateAuthenticationResult(this.cryptoObj,n,h,!1,i,d,f,e,u)}generateCacheRecord(e,n,r,i,o,s,c){const l=n.getPreferredCache();if(!l)throw we(YE);const u=zB(o);let d,f;e.id_token&&o&&(d=N0(this.homeAccountIdentifier,l,e.id_token,this.clientId,u||""),f=ST(this.cacheStorage,n,this.homeAccountIdentifier,this.cryptoObj.base64Decode,i.correlationId,o,e.client_info,l,u,c,void 0,this.logger));let h=null;if(e.access_token){const m=e.scope?Ar.fromString(e.scope):new Ar(i.scopes||[]),y=(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,b=(typeof e.ext_expires_in=="string"?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,x=(typeof e.refresh_in=="string"?parseInt(e.refresh_in,10):e.refresh_in)||void 0,w=r+y,S=w+b,C=x&&x>0?r+x:void 0;h=P0(this.homeAccountIdentifier,l,e.access_token,this.clientId,u||n.tenant||"",m.printScopes(),w,S,this.cryptoObj.base64Decode,C,e.token_type,s,e.key_id,i.claims,i.requestedClaimsHash)}let p=null;if(e.refresh_token){let m;if(e.refresh_token_expires_in){const y=typeof e.refresh_token_expires_in=="string"?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in;m=r+y}p=BB(this.homeAccountIdentifier,l,e.refresh_token,this.clientId,e.foci,s,m)}let g=null;return e.foci&&(g={clientId:this.clientId,environment:l,familyId:e.foci}),{account:f,idToken:d,accessToken:h,refreshToken:p,appMetadata:g}}static async generateAuthenticationResult(e,n,r,i,o,s,c,l,u){var w,S,C,_,A;let d=pe.EMPTY_STRING,f=[],h=null,p,g,m=pe.EMPTY_STRING;if(r.accessToken){if(r.accessToken.tokenType===yn.POP&&!o.popKid){const j=new Jd(e),{secret:P,keyId:k}=r.accessToken;if(!k)throw we(QE);d=await j.signPopToken(P,k,o)}else d=r.accessToken.secret;f=Ar.fromString(r.accessToken.target).asArray(),h=_d(r.accessToken.expiresOn),p=_d(r.accessToken.extendedExpiresOn),r.accessToken.refreshOn&&(g=_d(r.accessToken.refreshOn))}r.appMetadata&&(m=r.appMetadata.familyId===Yy?Yy:"");const y=(s==null?void 0:s.oid)||(s==null?void 0:s.sub)||"",b=(s==null?void 0:s.tid)||"";l!=null&&l.spa_accountid&&r.account&&(r.account.nativeAccountId=l==null?void 0:l.spa_accountid);const x=r.account?oT(r.account.getAccountInfo(),void 0,s,(w=r.idToken)==null?void 0:w.secret):null;return{authority:n.canonicalAuthority,uniqueId:y,tenantId:b,scopes:f,account:x,idToken:((S=r==null?void 0:r.idToken)==null?void 0:S.secret)||"",idTokenClaims:s||{},accessToken:d,fromCache:i,expiresOn:h,extExpiresOn:p,refreshOn:g,correlationId:o.correlationId,requestId:u||pe.EMPTY_STRING,familyId:m,tokenType:((C=r.accessToken)==null?void 0:C.tokenType)||pe.EMPTY_STRING,state:c?c.userRequestState:pe.EMPTY_STRING,cloudGraphHostName:((_=r.account)==null?void 0:_.cloudGraphHostName)||pe.EMPTY_STRING,msGraphHost:((A=r.account)==null?void 0:A.msGraphHost)||pe.EMPTY_STRING,code:l==null?void 0:l.spa_code,fromNativeBroker:!1}}}function ST(t,e,n,r,i,o,s,c,l,u,d,f){f==null||f.verbose("setCachedAccount called");const p=t.getAccountKeys().find(x=>x.startsWith(n));let g=null;p&&(g=t.getAccount(p,i));const m=g||cs.createAccount({homeAccountId:n,idTokenClaims:o,clientInfo:s,environment:c,cloudGraphHostName:u==null?void 0:u.cloud_graph_host_name,msGraphHost:u==null?void 0:u.msgraph_host,nativeAccountId:d},e,r),y=m.tenantProfiles||[],b=l||m.realm;if(b&&!y.find(x=>x.tenantId===b)){const x=iT(n,m.localAccountId,b,o);y.push(x)}return m.tenantProfiles=y,m}/*! @azure/msal-common v15.10.0 2025-08-05 */async function KB(t,e,n){return typeof t=="string"?t:t({clientId:e,tokenEndpoint:n})}/*! @azure/msal-common v15.10.0 2025-08-05 */class WB extends xT{constructor(e,n){var r;super(e,n),this.includeRedirectUri=!0,this.oidcDefaultScopes=(r=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:r.defaultScopes}async acquireToken(e,n){var c,l;if((c=this.performanceClient)==null||c.addQueueMeasurement(K.AuthClientAcquireToken,e.correlationId),!e.code)throw we(X5);const r=$i(),i=await fe(this.executeTokenRequest.bind(this),K.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),o=(l=i.headers)==null?void 0:l[di.X_MS_REQUEST_ID],s=new hu(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return s.validateTokenResponse(i.body),fe(s.handleServerTokenResponse.bind(s),K.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(i.body,this.authority,r,e,n,void 0,void 0,void 0,o)}getLogoutUri(e){if(!e)throw jn(dB);const n=this.createLogoutUrlQueryString(e);return tn.appendQueryString(this.authority.endSessionEndpoint,n)}async executeTokenRequest(e,n){var u;(u=this.performanceClient)==null||u.addQueueMeasurement(K.AuthClientExecuteTokenRequest,n.correlationId);const r=this.createTokenQueryParameters(n),i=tn.appendQueryString(e.tokenEndpoint,r),o=await fe(this.createTokenRequestBody.bind(this),K.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,n.correlationId)(n);let s;if(n.clientInfo)try{const d=nx(n.clientInfo,this.cryptoUtils.base64Decode);s={credential:`${d.uid}${Qp.CLIENT_INFO_SEPARATOR}${d.utid}`,type:Wo.HOME_ACCOUNT_ID}}catch(d){this.logger.verbose("Could not parse client info for CCS Header: "+d)}const c=this.createTokenRequestHeaders(s||n.ccsCredential),l=k0(this.config.authOptions.clientId,n);return fe(this.executePostToTokenEndpoint.bind(this),K.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,n.correlationId)(i,o,c,l,n.correlationId,K.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var i,o;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(uT(n,e.embeddedClientId||((o=e.tokenBodyParameters)==null?void 0:o[fu])||this.config.authOptions.clientId),this.includeRedirectUri)dT(n,e.redirectUri);else if(!e.redirectUri)throw jn(sB);if(lT(n,e.scopes,!0,this.oidcDefaultScopes),yne(n,e.code),pT(n,this.config.libraryInfo),mT(n,this.config.telemetry.application),FB(n),this.serverTelemetryManager&&!jB(this.config)&&LB(n,this.serverTelemetryManager),e.codeVerifier&&bne(n,e.codeVerifier),this.config.clientCredentials.clientSecret&&OB(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const s=this.config.clientCredentials.clientAssertion;IB(n,await KB(s.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),RB(n,s.assertionType)}if(MB(n,B5.AUTHORIZATION_CODE_GRANT),gT(n),e.authenticationScheme===yn.POP){const s=new Jd(this.cryptoUtils,this.performanceClient);let c;e.popKid?c=this.cryptoUtils.encodeKid(e.popKid):c=(await fe(s.generateCnf.bind(s),K.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,vT(n,c)}else if(e.authenticationScheme===yn.SSH)if(e.sshJwk)$B(n,e.sshJwk);else throw jn(A0);(!$s.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&fT(n,e.claims,this.config.authOptions.clientCapabilities);let r;if(e.clientInfo)try{const s=nx(e.clientInfo,this.cryptoUtils.base64Decode);r={credential:`${s.uid}${Qp.CLIENT_INFO_SEPARATOR}${s.utid}`,type:Wo.HOME_ACCOUNT_ID}}catch(s){this.logger.verbose("Could not parse client info for CCS Header: "+s)}else r=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&r)switch(r.type){case Wo.HOME_ACCOUNT_ID:try{const s=Cd(r.credential);lp(n,s)}catch(s){this.logger.verbose("Could not parse home account ID for CCS Header: "+s)}break;case Wo.UPN:ox(n,r.credential);break}return e.embeddedClientId&&E0(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&Mc(n,e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[CI])&&Mc(n,{[CI]:"1"}),j0(n,e.correlationId,this.performanceClient),Xp(n)}createLogoutUrlQueryString(e){const n=new Map;return e.postLogoutRedirectUri&&hne(n,e.postLogoutRedirectUri),e.correlationId&&hT(n,e.correlationId),e.idTokenHint&&pne(n,e.idTokenHint),e.state&&PB(n,e.state),e.logoutHint&&Sne(n,e.logoutHint),e.extraQueryParameters&&Mc(n,e.extraQueryParameters),this.config.authOptions.instanceAware&&DB(n),Xp(n,this.config.authOptions.encodeExtraQueryParams,e.extraQueryParameters)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Vne=300;class Kne extends xT{constructor(e,n){super(e,n)}async acquireToken(e){var s,c;(s=this.performanceClient)==null||s.addQueueMeasurement(K.RefreshTokenClientAcquireToken,e.correlationId);const n=$i(),r=await fe(this.executeTokenRequest.bind(this),K.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),i=(c=r.headers)==null?void 0:c[di.X_MS_REQUEST_ID],o=new hu(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return o.validateTokenResponse(r.body),fe(o.handleServerTokenResponse.bind(o),K.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(r.body,this.authority,n,e,void 0,void 0,!0,e.forceCache,i)}async acquireTokenByRefreshToken(e){var r;if(!e)throw jn(uB);if((r=this.performanceClient)==null||r.addQueueMeasurement(K.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw we(qE);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await fe(this.acquireTokenWithCachedRefreshToken.bind(this),K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(i){const o=i instanceof ls&&i.errorCode===ax,s=i instanceof Tu&&i.errorCode===gI.INVALID_GRANT_ERROR&&i.subError===gI.CLIENT_MISMATCH_ERROR;if(o||s)return fe(this.acquireTokenWithCachedRefreshToken.bind(this),K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1);throw i}return fe(this.acquireTokenWithCachedRefreshToken.bind(this),K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,n){var o,s,c;(o=this.performanceClient)==null||o.addQueueMeasurement(K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const r=Zi(this.cacheManager.getRefreshToken.bind(this.cacheManager),K.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,n,e.correlationId,void 0,this.performanceClient);if(!r)throw cx(ax);if(r.expiresOn&&sx(r.expiresOn,e.refreshTokenExpirationOffsetSeconds||Vne))throw(s=this.performanceClient)==null||s.addFields({rtExpiresOnMs:Number(r.expiresOn)},e.correlationId),cx(bT);const i={...e,refreshToken:r.secret,authenticationScheme:e.authenticationScheme||yn.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:Wo.HOME_ACCOUNT_ID}};try{return await fe(this.acquireToken.bind(this),K.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(i)}catch(l){if(l instanceof ls&&((c=this.performanceClient)==null||c.addFields({rtExpiresOnMs:Number(r.expiresOn)},e.correlationId),l.subError===I0)){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const u=this.cacheManager.generateCredentialKey(r);this.cacheManager.removeRefreshToken(u,e.correlationId)}throw l}}async executeTokenRequest(e,n){var l;(l=this.performanceClient)==null||l.addQueueMeasurement(K.RefreshTokenClientExecuteTokenRequest,e.correlationId);const r=this.createTokenQueryParameters(e),i=tn.appendQueryString(n.tokenEndpoint,r),o=await fe(this.createTokenRequestBody.bind(this),K.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),s=this.createTokenRequestHeaders(e.ccsCredential),c=k0(this.config.authOptions.clientId,e);return fe(this.executePostToTokenEndpoint.bind(this),K.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(i,o,s,c,e.correlationId,K.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var r,i,o;(r=this.performanceClient)==null||r.addQueueMeasurement(K.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(uT(n,e.embeddedClientId||((i=e.tokenBodyParameters)==null?void 0:i[fu])||this.config.authOptions.clientId),e.redirectUri&&dT(n,e.redirectUri),lT(n,e.scopes,!0,(o=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:o.defaultScopes),MB(n,B5.REFRESH_TOKEN_GRANT),gT(n),pT(n,this.config.libraryInfo),mT(n,this.config.telemetry.application),FB(n),this.serverTelemetryManager&&!jB(this.config)&&LB(n,this.serverTelemetryManager),xne(n,e.refreshToken),this.config.clientCredentials.clientSecret&&OB(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const s=this.config.clientCredentials.clientAssertion;IB(n,await KB(s.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),RB(n,s.assertionType)}if(e.authenticationScheme===yn.POP){const s=new Jd(this.cryptoUtils,this.performanceClient);let c;e.popKid?c=this.cryptoUtils.encodeKid(e.popKid):c=(await fe(s.generateCnf.bind(s),K.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,vT(n,c)}else if(e.authenticationScheme===yn.SSH)if(e.sshJwk)$B(n,e.sshJwk);else throw jn(A0);if((!$s.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&fT(n,e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case Wo.HOME_ACCOUNT_ID:try{const s=Cd(e.ccsCredential.credential);lp(n,s)}catch(s){this.logger.verbose("Could not parse home account ID for CCS Header: "+s)}break;case Wo.UPN:ox(n,e.ccsCredential.credential);break}return e.embeddedClientId&&E0(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&Mc(n,e.tokenBodyParameters),j0(n,e.correlationId,this.performanceClient),Xp(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Wne extends xT{constructor(e,n){super(e,n)}async acquireCachedToken(e){var l;(l=this.performanceClient)==null||l.addQueueMeasurement(K.SilentFlowClientAcquireCachedToken,e.correlationId);let n=Cl.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!$s.isEmptyObj(e.claims))throw this.setCacheOutcome(Cl.FORCE_REFRESH_OR_CLAIMS,e.correlationId),we(Rc);if(!e.account)throw we(qE);const r=e.account.tenantId||Dne(e.authority),i=this.cacheManager.getTokenKeys(),o=this.cacheManager.getAccessToken(e.account,e,i,r);if(o){if(Nne(o.cachedAt)||sx(o.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(Cl.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),we(Rc);o.refreshOn&&sx(o.refreshOn,0)&&(n=Cl.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(Cl.NO_CACHED_ACCESS_TOKEN,e.correlationId),we(Rc);const s=e.authority||this.authority.getPreferredCache(),c={account:this.cacheManager.getAccount(this.cacheManager.generateAccountKey(e.account),e.correlationId),accessToken:o,idToken:this.cacheManager.getIdToken(e.account,e.correlationId,i,r,this.performanceClient),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(s)};return this.setCacheOutcome(n,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await fe(this.generateResultFromCacheRecord.bind(this),K.SilentFlowClientGenerateResultFromCacheRecord,this.logger,this.performanceClient,e.correlationId)(c,e),n]}setCacheOutcome(e,n){var r,i;(r=this.serverTelemetryManager)==null||r.setCacheOutcome(e),(i=this.performanceClient)==null||i.addFields({cacheOutcome:e},n),e!==Cl.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,n){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.SilentFlowClientGenerateResultFromCacheRecord,n.correlationId);let r;if(e.idToken&&(r=Hf(e.idToken.secret,this.config.cryptoInterface.base64Decode)),n.maxAge||n.maxAge===0){const o=r==null?void 0:r.auth_time;if(!o)throw we(WE);bB(o,n.maxAge)}return hu.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,n,r)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const qne={sendGetRequestAsync:()=>Promise.reject(we(Kt)),sendPostRequestAsync:()=>Promise.reject(we(Kt))};/*! @azure/msal-common v15.10.0 2025-08-05 */function Yne(t,e,n,r){var c,l;const i=e.correlationId,o=new Map;uT(o,e.embeddedClientId||((c=e.extraQueryParameters)==null?void 0:c[fu])||t.clientId);const s=[...e.scopes||[],...e.extraScopesToConsent||[]];if(lT(o,s,!0,(l=t.authority.options.OIDCOptions)==null?void 0:l.defaultScopes),dT(o,e.redirectUri),hT(o,i),dne(o,e.responseMode),gT(o),e.prompt&&(gne(o,e.prompt),r==null||r.addFields({prompt:e.prompt},i)),e.domainHint&&(mne(o,e.domainHint),r==null||r.addFields({domainHintFromRequest:!0},i)),e.prompt!==pi.SELECT_ACCOUNT)if(e.sid&&e.prompt===pi.NONE)n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),_I(o,e.sid),r==null||r.addFields({sidFromRequest:!0},i);else if(e.account){const u=Jne(e.account);let d=Zne(e.account);if(d&&e.domainHint&&(n.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),d=null),d){n.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),dv(o,d),r==null||r.addFields({loginHintFromClaim:!0},i);try{const f=Cd(e.account.homeAccountId);lp(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(u&&e.prompt===pi.NONE){n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),_I(o,u),r==null||r.addFields({sidFromClaim:!0},i);try{const f=Cd(e.account.homeAccountId);lp(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)n.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),dv(o,e.loginHint),ox(o,e.loginHint),r==null||r.addFields({loginHintFromRequest:!0},i);else if(e.account.username){n.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),dv(o,e.account.username),r==null||r.addFields({loginHintFromUpn:!0},i);try{const f=Cd(e.account.homeAccountId);lp(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(n.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),dv(o,e.loginHint),ox(o,e.loginHint),r==null||r.addFields({loginHintFromRequest:!0},i));else n.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");return e.nonce&&vne(o,e.nonce),e.state&&PB(o,e.state),(e.claims||t.clientCapabilities&&t.clientCapabilities.length>0)&&fT(o,e.claims,t.clientCapabilities),e.embeddedClientId&&E0(o,t.clientId,t.redirectUri),t.instanceAware&&(!e.extraQueryParameters||!Object.keys(e.extraQueryParameters).includes(oA))&&DB(o),o}function CT(t,e,n,r){const i=Xp(e,n,r);return tn.appendQueryString(t.authorizationEndpoint,i)}function Qne(t,e){if(qB(t,e),!t.code)throw we(nB);return t}function qB(t,e){if(!t.state||!e)throw t.state?we(Z_,"Cached State"):we(Z_,"Server State");let n,r;try{n=decodeURIComponent(t.state)}catch{throw we(Xd,t.state)}try{r=decodeURIComponent(e)}catch{throw we(Xd,t.state)}if(n!==r)throw we(W5);if(t.error||t.error_description||t.suberror){const i=Xne(t);throw VB(t.error,t.error_description,t.suberror)?new ls(t.error||"",t.error_description,t.suberror,t.timestamp||"",t.trace_id||"",t.correlation_id||"",t.claims||"",i):new Tu(t.error||"",t.error_description,t.suberror,i)}}function Xne(t){var r,i;const e="code=",n=(r=t.error_uri)==null?void 0:r.lastIndexOf(e);return n&&n>=0?(i=t.error_uri)==null?void 0:i.substring(n+e.length):void 0}function Jne(t){var e;return((e=t.idTokenClaims)==null?void 0:e.sid)||null}function Zne(t){var e;return t.loginHint||((e=t.idTokenClaims)==null?void 0:e.login_hint)||null}/*! @azure/msal-common v15.10.0 2025-08-05 */const kI=",",YB="|";function ere(t){const{skus:e,libraryName:n,libraryVersion:r,extensionName:i,extensionVersion:o}=t,s=new Map([[0,[n,r]],[2,[i,o]]]);let c=[];if(e!=null&&e.length){if(c=e.split(kI),c.length<4)return e}else c=Array.from({length:4},()=>YB);return s.forEach((l,u)=>{var d,f;l.length===2&&((d=l[0])!=null&&d.length)&&((f=l[1])!=null&&f.length)&&tre({skuArr:c,index:u,skuName:l[0],skuVersion:l[1]})}),c.join(kI)}function tre(t){const{skuArr:e,index:n,skuName:r,skuVersion:i}=t;n>=e.length||(e[n]=[r,i].join(YB))}class Jp{constructor(e,n){this.cacheOutcome=Cl.NOT_APPLICABLE,this.cacheManager=n,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||pe.EMPTY_STRING,this.wrapperVer=e.wrapperVer||pe.EMPTY_STRING,this.telemetryCacheKey=Lr.CACHE_KEY+Qp.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${Lr.VALUE_SEPARATOR}${this.cacheOutcome}`,n=[this.wrapperSKU,this.wrapperVer],r=this.getNativeBrokerErrorCode();r!=null&&r.length&&n.push(`broker_error=${r}`);const i=n.join(Lr.VALUE_SEPARATOR),o=this.getRegionDiscoveryFields(),s=[e,o].join(Lr.VALUE_SEPARATOR);return[Lr.SCHEMA_VERSION,s,i].join(Lr.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),n=Jp.maxErrorsToSend(e),r=e.failedRequests.slice(0,2*n).join(Lr.VALUE_SEPARATOR),i=e.errors.slice(0,n).join(Lr.VALUE_SEPARATOR),o=e.errors.length,s=n=Lr.MAX_CACHED_ERRORS&&(n.failedRequests.shift(),n.failedRequests.shift(),n.errors.shift()),n.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof _n?e.subError?n.errors.push(e.subError):e.errorCode?n.errors.push(e.errorCode):n.errors.push(e.toString()):n.errors.push(e.toString()):n.errors.push(Lr.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,n,this.correlationId)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e,this.correlationId),e.cacheHits}getLastRequests(){const e={failedRequests:[],errors:[],cacheHits:0};return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),n=Jp.maxErrorsToSend(e),r=e.errors.length;if(n===r)this.cacheManager.removeItem(this.telemetryCacheKey,this.correlationId);else{const i={failedRequests:e.failedRequests.slice(n*2),errors:e.errors.slice(n),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,i,this.correlationId)}}static maxErrorsToSend(e){let n,r=0,i=0;const o=e.errors.length;for(n=0;nString.fromCodePoint(n)).join("");return btoa(e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Zo(t){return new TextDecoder().decode(Dc(t))}function Dc(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw Ge(CU)}const n=atob(e);return Uint8Array.from(n,r=>r.codePointAt(0)||0)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const hre="RSASSA-PKCS1-v1_5",Gf="AES-GCM",NU="HKDF",OT="SHA-256",pre=2048,mre=new Uint8Array([1,0,1]),MI="0123456789abcdef",DI=new Uint32Array(1),IT="raw",PU="encrypt",RT="decrypt",gre="deriveKey",vre="crypto_subtle_undefined",MT={name:hre,hash:OT,modulusLength:pre,publicExponent:mre};function yre(t){if(!window)throw Ge(D0);if(!window.crypto)throw Ge(sA);if(!t&&!window.crypto.subtle)throw Ge(sA,vre)}async function kU(t,e,n){e==null||e.addQueueMeasurement(K.Sha256Digest,n);const i=new TextEncoder().encode(t);return window.crypto.subtle.digest(OT,i)}function xre(t){return window.crypto.getRandomValues(t)}function BS(){return window.crypto.getRandomValues(DI),DI[0]}function us(){const t=Date.now(),e=BS()*1024+(BS()&1023),n=new Uint8Array(16),r=Math.trunc(e/2**30),i=e&2**30-1,o=BS();n[0]=t/2**40,n[1]=t/2**32,n[2]=t/2**24,n[3]=t/2**16,n[4]=t/2**8,n[5]=t,n[6]=112|r>>>8,n[7]=r,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=o>>>24,n[13]=o>>>16,n[14]=o>>>8,n[15]=o;let s="";for(let c=0;c>>4),s+=MI.charAt(n[c]&15),(c===3||c===5||c===7||c===9)&&(s+="-");return s}async function bre(t,e){return window.crypto.subtle.generateKey(MT,t,e)}async function US(t){return window.crypto.subtle.exportKey(EU,t)}async function wre(t,e,n){return window.crypto.subtle.importKey(EU,t,MT,e,n)}async function Sre(t,e){return window.crypto.subtle.sign(MT,t,e)}async function DT(){const t=await OU(),n={alg:"dir",kty:"oct",k:Xc(new Uint8Array(t))};return em(JSON.stringify(n))}async function Cre(t){const e=Zo(t),r=JSON.parse(e).k,i=Dc(r);return window.crypto.subtle.importKey(IT,i,Gf,!1,[RT])}async function _re(t,e){const n=e.split(".");if(n.length!==5)throw Ge(ty,"jwe_length");const r=await Cre(t).catch(()=>{throw Ge(ty,"import_key")});try{const i=new TextEncoder().encode(n[0]),o=Dc(n[2]),s=Dc(n[3]),c=Dc(n[4]),l=c.byteLength*8,u=new Uint8Array(s.length+c.length);u.set(s),u.set(c,s.length);const d=await window.crypto.subtle.decrypt({name:Gf,iv:o,tagLength:l,additionalData:i},r,u);return new TextDecoder().decode(d)}catch{throw Ge(ty,"decrypt")}}async function OU(){const t=await window.crypto.subtle.generateKey({name:Gf,length:256},!0,[PU,RT]);return window.crypto.subtle.exportKey(IT,t)}async function $I(t){return window.crypto.subtle.importKey(IT,t,NU,!1,[gre])}async function IU(t,e,n){return window.crypto.subtle.deriveKey({name:NU,salt:e,hash:OT,info:new TextEncoder().encode(n)},t,{name:Gf,length:256},!1,[PU,RT])}async function Are(t,e,n){const r=new TextEncoder().encode(e),i=window.crypto.getRandomValues(new Uint8Array(16)),o=await IU(t,i,n),s=await window.crypto.subtle.encrypt({name:Gf,iv:new Uint8Array(12)},o,r);return{data:Xc(new Uint8Array(s)),nonce:Xc(i)}}async function LI(t,e,n,r){const i=Dc(r),o=await IU(t,Dc(e),n),s=await window.crypto.subtle.decrypt({name:Gf,iv:new Uint8Array(12)},o,i);return new TextDecoder().decode(s)}async function RU(t){const e=await kU(t),n=new Uint8Array(e);return Xc(n)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const tm="storage_not_supported",cr="stubbed_public_client_application_called",dx="in_mem_redirect_unavailable";/*! @azure/msal-browser v4.19.0 2025-08-05 */const ny={[tm]:"Given storage configuration option was not supported.",[cr]:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",[dx]:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."};ny[tm],ny[cr],ny[dx];class $T extends _n{constructor(e,n){super(e,n),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,$T.prototype)}}function lr(t){return new $T(t,ny[t])}/*! @azure/msal-browser v4.19.0 2025-08-05 */function MU(t){t.location.hash="",typeof t.history.replaceState=="function"&&t.history.replaceState(null,"",`${t.location.origin}${t.location.pathname}${t.location.search}`)}function jre(t){const e=t.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function LT(){return window.parent!==window}function Ere(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${Ti.POPUP_NAME_PREFIX}.`)===0}function xa(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function Tre(){const e=new tn(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function Nre(){if(tn.hashContainsKnownProperties(window.location.hash)&<())throw Ge(cU)}function Pre(t){if(LT()&&!t)throw Ge(aU)}function kre(){if(Ere())throw Ge(lU)}function DU(){if(typeof window>"u")throw Ge(D0)}function $U(t){if(!t)throw Ge(up)}function FT(t){DU(),Nre(),kre(),$U(t)}function FI(t,e){if(FT(t),Pre(e.system.allowRedirectInIframe),e.cache.cacheLocation===jr.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw lr(dx)}function LU(t){const e=document.createElement("link");e.rel="preconnect",e.href=new URL(t).origin,e.crossOrigin="anonymous",document.head.appendChild(e),window.setTimeout(()=>{try{document.head.removeChild(e)}catch{}},1e4)}function Ore(){return us()}/*! @azure/msal-browser v4.19.0 2025-08-05 */class fx{navigateInternal(e,n){return fx.defaultNavigateWindow(e,n)}navigateExternal(e,n){return fx.defaultNavigateWindow(e,n)}static defaultNavigateWindow(e,n){return n.noHistory?window.location.replace(e):window.location.assign(e),new Promise((r,i)=>{setTimeout(()=>{i(Ge(ux,"failed_to_redirect"))},n.timeout)})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Ire{async sendGetRequestAsync(e,n){let r,i={},o=0;const s=BI(n);try{r=await fetch(e,{method:II.GET,headers:s})}catch(c){throw Vh(Ge(window.navigator.onLine?pU:lx),void 0,void 0,c)}i=UI(r.headers);try{return o=r.status,{headers:i,body:await r.json(),status:o}}catch(c){throw Vh(Ge(aA),o,i,c)}}async sendPostRequestAsync(e,n){const r=n&&n.body||"",i=BI(n);let o,s=0,c={};try{o=await fetch(e,{method:II.POST,headers:i,body:r})}catch(l){throw Vh(Ge(window.navigator.onLine?hU:lx),void 0,void 0,l)}c=UI(o.headers);try{return s=o.status,{headers:c,body:await o.json(),status:s}}catch(l){throw Vh(Ge(aA),s,c,l)}}}function BI(t){try{const e=new Headers;if(!(t&&t.headers))return e;const n=t.headers;return Object.entries(n).forEach(([r,i])=>{e.append(r,i)}),e}catch(e){throw Vh(Ge(AU),void 0,void 0,e)}}function UI(t){try{const e={};return t.forEach((n,r)=>{e[r]=n}),e}catch{throw Ge(jU)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Rre=6e4,lA=1e4,Mre=3e4,FU=2e3;function Dre({auth:t,cache:e,system:n,telemetry:r},i){const o={clientId:pe.EMPTY_STRING,authority:`${pe.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:pe.EMPTY_STRING,authorityMetadata:pe.EMPTY_STRING,redirectUri:typeof window<"u"?xa():"",postLogoutRedirectUri:pe.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:Di.AAD,OIDCOptions:{serverResponseType:_0.FRAGMENT,defaultScopes:[pe.OPENID_SCOPE,pe.PROFILE_SCOPE,pe.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:ZE.None,tenant:pe.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1,encodeExtraQueryParams:!1},s={cacheLocation:jr.SessionStorage,cacheRetentionDays:5,temporaryCacheLocation:jr.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===jr.LocalStorage),claimsBasedCachingEnabled:!1},c={loggerCallback:()=>{},logLevel:Dn.Info,piiLoggingEnabled:!1},u={...{...AB,loggerOptions:c,networkClient:i?new Ire:qne,navigationClient:new fx,loadFrameTimeout:0,windowHashTimeout:(n==null?void 0:n.loadFrameTimeout)||Rre,iframeHashTimeout:(n==null?void 0:n.loadFrameTimeout)||lA,navigateFrameWait:0,redirectNavigationTimeout:Mre,asyncPopups:!1,allowRedirectInIframe:!1,allowPlatformBroker:!1,nativeBrokerHandshakeTimeout:(n==null?void 0:n.nativeBrokerHandshakeTimeout)||FU,pollIntervalMilliseconds:Ti.DEFAULT_POLL_INTERVAL_MS},...n,loggerOptions:(n==null?void 0:n.loggerOptions)||c},d={application:{appName:pe.EMPTY_STRING,appVersion:pe.EMPTY_STRING},client:new _B};if((t==null?void 0:t.protocolMode)!==Di.OIDC&&(t!=null&&t.OIDCOptions)&&new Da(u.loggerOptions).warning(JSON.stringify(jn(mB))),t!=null&&t.protocolMode&&t.protocolMode===Di.OIDC&&(u!=null&&u.allowPlatformBroker))throw jn(gB);return{auth:{...o,...t,OIDCOptions:{...o.OIDCOptions,...t==null?void 0:t.OIDCOptions}},cache:{...s,...e},system:u,telemetry:{...d,...r}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const $re="@azure/msal-browser",pu="4.19.0";/*! @azure/msal-browser v4.19.0 2025-08-05 */const Pr="msal",BT="browser",HS="-",ec=1,uA=1,Lre=`${Pr}.${BT}.log.level`,Fre=`${Pr}.${BT}.log.pii`,Bre=`${Pr}.${BT}.platform.auth.dom`,HI=`${Pr}.version`,zI="account.keys",GI="token.keys";function ws(t=uA){return t<1?`${Pr}.${zI}`:`${Pr}.${t}.${zI}`}function Il(t,e=ec){return e<1?`${Pr}.${GI}.${t}`:`${Pr}.${e}.${GI}.${t}`}/*! @azure/msal-browser v4.19.0 2025-08-05 */class UT{static loggerCallback(e,n){switch(e){case Dn.Error:console.error(n);return;case Dn.Info:console.info(n);return;case Dn.Verbose:console.debug(n);return;case Dn.Warning:console.warn(n);return;default:console.log(n);return}}constructor(e){var l;this.browserEnvironment=typeof window<"u",this.config=Dre(e,this.browserEnvironment);let n;try{n=window[jr.SessionStorage]}catch{}const r=n==null?void 0:n.getItem(Lre),i=(l=n==null?void 0:n.getItem(Fre))==null?void 0:l.toLowerCase(),o=i==="true"?!0:i==="false"?!1:void 0,s={...this.config.system.loggerOptions},c=r&&Object.keys(Dn).includes(r)?Dn[r]:void 0;c&&(s.loggerCallback=UT.loggerCallback,s.logLevel=c),o!==void 0&&(s.piiLoggingEnabled=o),this.logger=new Da(s,$re,pu),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class mu extends UT{getModuleName(){return mu.MODULE_NAME}getId(){return mu.ID}async initialize(){return this.available=typeof window<"u",this.available}}mu.MODULE_NAME="";mu.ID="StandardOperatingContext";/*! @azure/msal-browser v4.19.0 2025-08-05 */class Ure{constructor(){this.dbName=cA,this.version=ure,this.tableName=dre,this.dbOpen=!1}async open(){return new Promise((e,n)=>{const r=window.indexedDB.open(this.dbName,this.version);r.addEventListener("upgradeneeded",i=>{i.target.result.createObjectStore(this.tableName)}),r.addEventListener("success",i=>{const o=i;this.db=o.target.result,this.dbOpen=!0,e()}),r.addEventListener("error",()=>n(Ge(PT)))})}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Ge(Wu));const s=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);s.addEventListener("success",c=>{const l=c;this.closeConnection(),n(l.target.result)}),s.addEventListener("error",c=>{this.closeConnection(),r(c)})})}async setItem(e,n){return await this.validateDbIsOpen(),new Promise((r,i)=>{if(!this.db)return i(Ge(Wu));const c=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(n,e);c.addEventListener("success",()=>{this.closeConnection(),r()}),c.addEventListener("error",l=>{this.closeConnection(),i(l)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Ge(Wu));const s=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);s.addEventListener("success",()=>{this.closeConnection(),n()}),s.addEventListener("error",c=>{this.closeConnection(),r(c)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,n)=>{if(!this.db)return n(Ge(Wu));const o=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();o.addEventListener("success",s=>{const c=s;this.closeConnection(),e(c.target.result)}),o.addEventListener("error",s=>{this.closeConnection(),n(s)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Ge(Wu));const s=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);s.addEventListener("success",c=>{const l=c;this.closeConnection(),n(l.target.result===1)}),s.addEventListener("error",c=>{this.closeConnection(),r(c)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,n)=>{const r=window.indexedDB.deleteDatabase(cA),i=setTimeout(()=>n(!1),200);r.addEventListener("success",()=>(clearTimeout(i),e(!0))),r.addEventListener("blocked",()=>(clearTimeout(i),e(!0))),r.addEventListener("error",()=>(clearTimeout(i),n(!1)))})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class $0{constructor(){this.cache=new Map}async initialize(){}getItem(e){return this.cache.get(e)||null}getUserData(e){return this.getItem(e)}setItem(e,n){this.cache.set(e,n)}async setUserData(e,n){this.setItem(e,n)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((n,r)=>{e.push(r)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}decryptData(){return Promise.resolve(null)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Hre{constructor(e){this.inMemoryCache=new $0,this.indexedDBCache=new Ure,this.logger=e}handleDatabaseAccessError(e){if(e instanceof yg&&e.errorCode===PT)this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");else throw e}async getItem(e){const n=this.inMemoryCache.getItem(e);if(!n)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(r){this.handleDatabaseAccessError(r)}return n}async setItem(e,n){this.inMemoryCache.setItem(e,n);try{await this.indexedDBCache.setItem(e,n)}catch(r){this.handleDatabaseAccessError(r)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(n){this.handleDatabaseAccessError(n)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(e.length===0)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(n){this.handleDatabaseAccessError(n)}return e}async containsKey(e){const n=this.inMemoryCache.containsKey(e);if(!n)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(r){this.handleDatabaseAccessError(r)}return n}clearInMemory(){this.logger.verbose("Deleting in-memory keystore"),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore deleted")}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class $a{constructor(e,n,r){this.logger=e,yre(r??!1),this.cache=new Hre(this.logger),this.performanceClient=n}createNewGuid(){return us()}base64Encode(e){return em(e)}base64Decode(e){return Zo(e)}base64UrlEncode(e){return pv(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){var d;const n=(d=this.performanceClient)==null?void 0:d.startMeasurement(K.CryptoOptsGetPublicKeyThumbprint,e.correlationId),r=await bre($a.EXTRACTABLE,$a.POP_KEY_USAGES),i=await US(r.publicKey),o={e:i.e,kty:i.kty,n:i.n},s=VI(o),c=await this.hashString(s),l=await US(r.privateKey),u=await wre(l,!1,["sign"]);return await this.cache.setItem(c,{privateKey:u,publicKey:r.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),n&&n.end({success:!0}),c}async removeTokenBindingKey(e){if(await this.cache.removeItem(e),await this.cache.containsKey(e))throw we(rB)}async clearKeystore(){this.cache.clearInMemory();try{return await this.cache.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}async signJwt(e,n,r,i){var w;const o=(w=this.performanceClient)==null?void 0:w.startMeasurement(K.CryptoOptsSignJwt,i),s=await this.cache.getItem(n);if(!s)throw Ge(NT);const c=await US(s.publicKey),l=VI(c),u=pv(JSON.stringify({kid:n})),d=AT.getShrHeaderString({...r==null?void 0:r.header,alg:c.alg,kid:u}),f=pv(d);e.cnf={jwk:JSON.parse(l)};const h=pv(JSON.stringify(e)),p=`${f}.${h}`,m=new TextEncoder().encode(p),y=await Sre(s.privateKey,m),b=Xc(new Uint8Array(y)),x=`${p}.${b}`;return o&&o.end({success:!0}),x}async hashString(e){return RU(e)}}$a.POP_KEY_USAGES=["sign","verify"];$a.EXTRACTABLE=!0;function VI(t){return JSON.stringify(t,Object.keys(t).sort())}/*! @azure/msal-browser v4.19.0 2025-08-05 */const zre=24*60*60*1e3,dA={Lax:"Lax",None:"None"};class BU{initialize(){return Promise.resolve()}getItem(e){const n=`${encodeURIComponent(e)}`,r=document.cookie.split(";");for(let i=0;i{const i=decodeURIComponent(r).trim().split("=");n.push(i[0])}),n}containsKey(e){return this.getKeys().includes(e)}decryptData(){return Promise.resolve(null)}}function Gre(t){const e=new Date;return new Date(e.getTime()+t*zre).toUTCString()}/*! @azure/msal-browser v4.19.0 2025-08-05 */function dp(t,e){const n=t.getItem(ws(e));return n?JSON.parse(n):[]}function fp(t,e,n){const r=e.getItem(Il(t,n));if(r){const i=JSON.parse(r);if(i&&i.hasOwnProperty("idToken")&&i.hasOwnProperty("accessToken")&&i.hasOwnProperty("refreshToken"))return i}return{idToken:[],accessToken:[],refreshToken:[]}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function fA(t){return t.hasOwnProperty("id")&&t.hasOwnProperty("nonce")&&t.hasOwnProperty("data")}/*! @azure/msal-browser v4.19.0 2025-08-05 */const KI="msal.cache.encryption",Vre="msal.broadcast.cache";class Kre{constructor(e,n,r){if(!window.localStorage)throw lr(tm);this.memoryStorage=new $0,this.initialized=!1,this.clientId=e,this.logger=n,this.performanceClient=r,this.broadcast=new BroadcastChannel(Vre)}async initialize(e){const n=new BU,r=n.getItem(KI);let i={key:"",id:""};if(r)try{i=JSON.parse(r)}catch{}if(i.key&&i.id){const o=Zi(Dc,K.Base64Decode,this.logger,this.performanceClient,e)(i.key);this.encryptionCookie={id:i.id,key:await fe($I,K.GenerateHKDF,this.logger,this.performanceClient,e)(o)}}else{const o=us(),s=await fe(OU,K.GenerateBaseKey,this.logger,this.performanceClient,e)(),c=Zi(Xc,K.UrlEncodeArr,this.logger,this.performanceClient,e)(new Uint8Array(s));this.encryptionCookie={id:o,key:await fe($I,K.GenerateHKDF,this.logger,this.performanceClient,e)(s)};const l={id:o,key:c};n.setItem(KI,JSON.stringify(l),0,!0,dA.None)}await fe(this.importExistingCache.bind(this),K.ImportExistingCache,this.logger,this.performanceClient,e)(e),this.broadcast.addEventListener("message",this.updateCache.bind(this)),this.initialized=!0}getItem(e){return window.localStorage.getItem(e)}getUserData(e){if(!this.initialized)throw Ge(up);return this.memoryStorage.getItem(e)}async decryptData(e,n,r){if(!this.initialized||!this.encryptionCookie)throw Ge(up);if(n.id!==this.encryptionCookie.id)return this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},r),null;const i=await fe(LI,K.Decrypt,this.logger,this.performanceClient,r)(this.encryptionCookie.key,n.nonce,this.getContext(e),n.data);if(!i)return null;try{return JSON.parse(i)}catch{return this.performanceClient.incrementFields({encryptedCacheCorruptionCount:1},r),null}}setItem(e,n){window.localStorage.setItem(e,n)}async setUserData(e,n,r,i){if(!this.initialized||!this.encryptionCookie)throw Ge(up);const{data:o,nonce:s}=await fe(Are,K.Encrypt,this.logger,this.performanceClient,r)(this.encryptionCookie.key,n,this.getContext(e)),c={id:this.encryptionCookie.id,nonce:s,data:o,lastUpdatedAt:i};this.memoryStorage.setItem(e,n),this.setItem(e,JSON.stringify(c)),this.broadcast.postMessage({key:e,value:n,context:this.getContext(e)})}removeItem(e){this.memoryStorage.containsKey(e)&&(this.memoryStorage.removeItem(e),this.broadcast.postMessage({key:e,value:null,context:this.getContext(e)})),window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}clear(){this.memoryStorage.clear(),dp(this).forEach(r=>this.removeItem(r));const n=fp(this.clientId,this);n.idToken.forEach(r=>this.removeItem(r)),n.accessToken.forEach(r=>this.removeItem(r)),n.refreshToken.forEach(r=>this.removeItem(r)),this.getKeys().forEach(r=>{(r.startsWith(Pr)||r.indexOf(this.clientId)!==-1)&&this.removeItem(r)})}async importExistingCache(e){if(!this.encryptionCookie)return;let n=dp(this);n=await this.importArray(n,e),n.length?this.setItem(ws(),JSON.stringify(n)):this.removeItem(ws());const r=fp(this.clientId,this);r.idToken=await this.importArray(r.idToken,e),r.accessToken=await this.importArray(r.accessToken,e),r.refreshToken=await this.importArray(r.refreshToken,e),r.idToken.length||r.accessToken.length||r.refreshToken.length?this.setItem(Il(this.clientId),JSON.stringify(r)):this.removeItem(Il(this.clientId))}async getItemFromEncryptedCache(e,n){if(!this.encryptionCookie)return null;const r=this.getItem(e);if(!r)return null;let i;try{i=JSON.parse(r)}catch{return null}return fA(i)?i.id!==this.encryptionCookie.id?(this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},n),null):fe(LI,K.Decrypt,this.logger,this.performanceClient,n)(this.encryptionCookie.key,i.nonce,this.getContext(e),i.data):(this.performanceClient.incrementFields({unencryptedCacheCount:1},n),i)}async importArray(e,n){const r=[],i=[];return e.forEach(o=>{const s=this.getItemFromEncryptedCache(o,n).then(c=>{c?(this.memoryStorage.setItem(o,c),r.push(o)):this.removeItem(o)});i.push(s)}),await Promise.all(i),r}getContext(e){let n="";return e.includes(this.clientId)&&(n=this.clientId),n}updateCache(e){this.logger.trace("Updating internal cache from broadcast event");const n=this.performanceClient.startMeasurement(K.LocalStorageUpdated);n.add({isBackground:!0});const{key:r,value:i,context:o}=e.data;if(!r){this.logger.error("Broadcast event missing key"),n.end({success:!1,errorCode:"noKey"});return}if(o&&o!==this.clientId){this.logger.trace(`Ignoring broadcast event from clientId: ${o}`),n.end({success:!1,errorCode:"contextMismatch"});return}i?(this.memoryStorage.setItem(r,i),this.logger.verbose("Updated item in internal cache")):(this.memoryStorage.removeItem(r),this.logger.verbose("Removed item from internal cache")),n.end({success:!0})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Wre{constructor(){if(!window.sessionStorage)throw lr(tm)}async initialize(){}getItem(e){return window.sessionStorage.getItem(e)}getUserData(e){return this.getItem(e)}setItem(e,n){window.sessionStorage.setItem(e,n)}async setUserData(e,n){this.setItem(e,n)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}decryptData(){return Promise.resolve(null)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Qe={INITIALIZE_START:"msal:initializeStart",INITIALIZE_END:"msal:initializeEnd",ACCOUNT_ADDED:"msal:accountAdded",ACCOUNT_REMOVED:"msal:accountRemoved",ACTIVE_ACCOUNT_CHANGED:"msal:activeAccountChanged",LOGIN_START:"msal:loginStart",LOGIN_SUCCESS:"msal:loginSuccess",LOGIN_FAILURE:"msal:loginFailure",ACQUIRE_TOKEN_START:"msal:acquireTokenStart",ACQUIRE_TOKEN_SUCCESS:"msal:acquireTokenSuccess",ACQUIRE_TOKEN_FAILURE:"msal:acquireTokenFailure",ACQUIRE_TOKEN_NETWORK_START:"msal:acquireTokenFromNetworkStart",SSO_SILENT_START:"msal:ssoSilentStart",SSO_SILENT_SUCCESS:"msal:ssoSilentSuccess",SSO_SILENT_FAILURE:"msal:ssoSilentFailure",ACQUIRE_TOKEN_BY_CODE_START:"msal:acquireTokenByCodeStart",ACQUIRE_TOKEN_BY_CODE_SUCCESS:"msal:acquireTokenByCodeSuccess",ACQUIRE_TOKEN_BY_CODE_FAILURE:"msal:acquireTokenByCodeFailure",HANDLE_REDIRECT_START:"msal:handleRedirectStart",HANDLE_REDIRECT_END:"msal:handleRedirectEnd",POPUP_OPENED:"msal:popupOpened",LOGOUT_START:"msal:logoutStart",LOGOUT_SUCCESS:"msal:logoutSuccess",LOGOUT_FAILURE:"msal:logoutFailure",LOGOUT_END:"msal:logoutEnd",RESTORE_FROM_BFCACHE:"msal:restoreFromBFCache",BROKER_CONNECTION_ESTABLISHED:"msal:brokerConnectionEstablished"};/*! @azure/msal-browser v4.19.0 2025-08-05 */function WI(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class hA extends iA{constructor(e,n,r,i,o,s,c){super(e,r,i,o,c),this.cacheConfig=n,this.logger=i,this.internalStorage=new $0,this.browserStorage=qI(e,n.cacheLocation,i,o),this.temporaryCacheStorage=qI(e,n.temporaryCacheLocation,i,o),this.cookieStorage=new BU,this.eventHandler=s}async initialize(e){this.performanceClient.addFields({cacheLocation:this.cacheConfig.cacheLocation,cacheRetentionDays:this.cacheConfig.cacheRetentionDays},e),await this.browserStorage.initialize(e),await this.migrateExistingCache(e),this.trackVersionChanges(e)}async migrateExistingCache(e){const n=dp(this.browserStorage,0),r=fp(this.clientId,this.browserStorage,0);this.performanceClient.addFields({oldAccountCount:n.length,oldAccessCount:r.accessToken.length,oldIdCount:r.idToken.length,oldRefreshCount:r.refreshToken.length},e);const i=dp(this.browserStorage,1),o=fp(this.clientId,this.browserStorage,1);this.performanceClient.addFields({currAccountCount:i.length,currAccessCount:o.accessToken.length,currIdCount:o.idToken.length,currRefreshCount:o.refreshToken.length},e),await Promise.all([this.updateV0ToCurrent(uA,n,i,e),this.updateV0ToCurrent(ec,r.idToken,o.idToken,e),this.updateV0ToCurrent(ec,r.accessToken,o.accessToken,e),this.updateV0ToCurrent(ec,r.refreshToken,o.refreshToken,e)]),n.length>0?this.browserStorage.setItem(ws(0),JSON.stringify(n)):this.browserStorage.removeItem(ws(0)),i.length>0?this.browserStorage.setItem(ws(1),JSON.stringify(i)):this.browserStorage.removeItem(ws(1)),this.setTokenKeys(r,e,0),this.setTokenKeys(o,e,1)}async updateV0ToCurrent(e,n,r,i){const o=[];for(const s of[...n]){const c=this.browserStorage.getItem(s),l=this.validateAndParseJson(c||"");if(!l){WI(n,s);continue}l.lastUpdatedAt||(l.lastUpdatedAt=Date.now().toString(),this.setItem(s,JSON.stringify(l),i));const u=fA(l)?await this.browserStorage.decryptData(s,l,i):l;let d;if(u&&(jI(u)||EI(u))&&(d=u.expiresOn),!u||Tne(l.lastUpdatedAt,this.cacheConfig.cacheRetentionDays)||d&&sx(d,U5)){this.browserStorage.removeItem(s),WI(n,s),this.performanceClient.incrementFields({expiredCacheRemovedCount:1},i);continue}if(this.cacheConfig.cacheLocation!==jr.LocalStorage||fA(l)){const f=`${Pr}.${e}${HS}${s}`,h=this.browserStorage.getItem(f);if(h){const p=this.validateAndParseJson(h);if(Number(l.lastUpdatedAt)>Number(p.lastUpdatedAt)){o.push(this.setUserData(f,JSON.stringify(u),i,l.lastUpdatedAt).then(()=>{this.performanceClient.incrementFields({updatedCacheFromV0Count:1},i)}));continue}}else{o.push(this.setUserData(f,JSON.stringify(u),i,l.lastUpdatedAt).then(()=>{r.push(f),this.performanceClient.incrementFields({upgradedCacheCount:1},i)}));continue}}}return Promise.all(o)}trackVersionChanges(e){const n=this.browserStorage.getItem(HI);n&&(this.logger.info(`MSAL.js was last initialized by version: ${n}`),this.performanceClient.addFields({previousLibraryVersion:n},e)),n!==pu&&this.setItem(HI,pu,e)}validateAndParseJson(e){if(!e)return null;try{const n=JSON.parse(e);return n&&typeof n=="object"?n:null}catch{return null}}setItem(e,n,r){let i=0,o=[];const s=20;for(let c=0;c<=s;c++)try{this.browserStorage.setItem(e,n),c>0&&(c<=i?this.removeAccessTokenKeys(o.slice(0,c),r,0):(this.removeAccessTokenKeys(o.slice(0,i),r,0),this.removeAccessTokenKeys(o.slice(i,c),r)));break}catch(l){const u=rA(l);if(u.errorCode===tx&&c0&&(l<=o?this.removeAccessTokenKeys(s.slice(0,l),r,0):(this.removeAccessTokenKeys(s.slice(0,o),r,0),this.removeAccessTokenKeys(s.slice(o,l),r)));break}catch(u){const d=rA(u);if(d.errorCode===tx&&l-1){if(r.splice(i,1),r.length===0){this.removeItem(ws());return}else this.setItem(ws(),JSON.stringify(r),n);this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")}else this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}removeAccount(e,n){const r=this.getActiveAccount(n);(r==null?void 0:r.homeAccountId)===e.homeAccountId&&(r==null?void 0:r.environment)===e.environment&&this.setActiveAccount(null,n),super.removeAccount(e,n),this.removeAccountKeyFromMap(this.generateAccountKey(e),n),this.browserStorage.getKeys().forEach(i=>{i.includes(e.homeAccountId)&&i.includes(e.environment)&&this.browserStorage.removeItem(i)}),this.cacheConfig.cacheLocation===jr.LocalStorage&&this.eventHandler.emitEvent(Qe.ACCOUNT_REMOVED,void 0,e)}removeIdToken(e,n){super.removeIdToken(e,n);const r=this.getTokenKeys(),i=r.idToken.indexOf(e);i>-1&&(this.logger.info("idToken removed from tokenKeys map"),r.idToken.splice(i,1),this.setTokenKeys(r,n))}removeAccessToken(e,n,r=!0){super.removeAccessToken(e,n),r&&this.removeAccessTokenKeys([e],n)}removeAccessTokenKeys(e,n,r=ec){this.logger.trace("removeAccessTokenKey called");const i=this.getTokenKeys(r);let o=0;if(e.forEach(s=>{const c=i.accessToken.indexOf(s);c>-1&&(i.accessToken.splice(c,1),o++)}),o>0){this.logger.info(`removed ${o} accessToken keys from tokenKeys map`),this.setTokenKeys(i,n,r);return}}removeRefreshToken(e,n){super.removeRefreshToken(e,n);const r=this.getTokenKeys(),i=r.refreshToken.indexOf(e);i>-1&&(this.logger.info("refreshToken removed from tokenKeys map"),r.refreshToken.splice(i,1),this.setTokenKeys(r,n))}getTokenKeys(e=ec){return fp(this.clientId,this.browserStorage,e)}setTokenKeys(e,n,r=ec){if(e.idToken.length===0&&e.accessToken.length===0&&e.refreshToken.length===0){this.removeItem(Il(this.clientId,r));return}else this.setItem(Il(this.clientId,r),JSON.stringify(e),n)}getIdTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeIdToken(e,n),null;const i=this.validateAndParseJson(r);return!i||!Pne(i)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),i)}async setIdTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const o=this.getTokenKeys();o.idToken.indexOf(r)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),o.idToken.push(r),this.setTokenKeys(o,n))}getAccessTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeAccessTokenKeys([e],n),null;const i=this.validateAndParseJson(r);return!i||!jI(i)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),i)}async setAccessTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const o=this.getTokenKeys(),s=o.accessToken.indexOf(r);s!==-1&&o.accessToken.splice(s,1),this.logger.trace(`access token ${s===-1?"added to":"updated in"} map`),o.accessToken.push(r),this.setTokenKeys(o,n)}getRefreshTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeRefreshToken(e,n),null;const i=this.validateAndParseJson(r);return!i||!EI(i)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),i)}async setRefreshTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const o=this.getTokenKeys();o.refreshToken.indexOf(r)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),o.refreshToken.push(r),this.setTokenKeys(o,n))}getAppMetadata(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!Rne(e,r)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),r)}setAppMetadata(e,n){this.logger.trace("BrowserCacheManager.setAppMetadata called");const r=Ine(e);this.setItem(r,JSON.stringify(e),n)}getServerTelemetry(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!kne(e,r)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),r)}setServerTelemetry(e,n,r){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(n),r)}getAuthorityMetadata(e){const n=this.internalStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(n);return r&&Mne(e,r)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),r):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(n=>this.isAuthorityMetadata(n))}setWrapperMetadata(e,n){this.internalStorage.setItem(hv.WRAPPER_SKU,e),this.internalStorage.setItem(hv.WRAPPER_VER,n)}getWrapperMetadata(){const e=this.internalStorage.getItem(hv.WRAPPER_SKU)||pe.EMPTY_STRING,n=this.internalStorage.getItem(hv.WRAPPER_VER)||pe.EMPTY_STRING;return[e,n]}setAuthorityMetadata(e,n){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(n))}getActiveAccount(e){const n=this.generateCacheKey(mI.ACTIVE_ACCOUNT_FILTERS),r=this.browserStorage.getItem(n);if(!r)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters found"),null;const i=this.validateAndParseJson(r);return i?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:i.homeAccountId,localAccountId:i.localAccountId,tenantId:i.tenantId},e)):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e,n){const r=this.generateCacheKey(mI.ACTIVE_ACCOUNT_FILTERS);if(e){this.logger.verbose("setActiveAccount: Active account set");const i={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId,lastUpdatedAt:$i().toString()};this.setItem(r,JSON.stringify(i),n)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(r);this.eventHandler.emitEvent(Qe.ACTIVE_ACCOUNT_CHANGED)}getThrottlingCache(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!One(e,r)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),r)}setThrottlingCache(e,n,r){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(n),r)}getTemporaryCache(e,n){const r=n?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const o=this.cookieStorage.getItem(r);if(o)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),o}const i=this.temporaryCacheStorage.getItem(r);if(!i){if(this.cacheConfig.cacheLocation===jr.LocalStorage){const o=this.browserStorage.getItem(r);if(o)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),o}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),i}setTemporaryCache(e,n,r){const i=r?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(i,n),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(i,n,void 0,this.cacheConfig.secureCookies))}removeItem(e){this.browserStorage.removeItem(e)}removeTemporaryItem(e){this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.cookieStorage.removeItem(e))}getKeys(){return this.browserStorage.getKeys()}clear(e){this.removeAllAccounts(e),this.removeAppMetadata(e),this.temporaryCacheStorage.getKeys().forEach(n=>{(n.indexOf(Pr)!==-1||n.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(n)}),this.browserStorage.getKeys().forEach(n=>{(n.indexOf(Pr)!==-1||n.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(n)}),this.internalStorage.clear()}clearTokensAndKeysWithClaims(e){this.performanceClient.addQueueMeasurement(K.ClearTokensAndKeysWithClaims,e);const n=this.getTokenKeys();let r=0;n.accessToken.forEach(i=>{const o=this.getAccessTokenCredential(i,e);o!=null&&o.requestedClaimsHash&&i.includes(o.requestedClaimsHash.toLowerCase())&&(this.removeAccessToken(i,e),r++)}),r>0&&this.logger.warning(`${r} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return $s.startsWith(e,Pr)?e:`${Pr}.${this.clientId}.${e}`}generateCredentialKey(e){const n=e.credentialType===Hr.REFRESH_TOKEN&&e.familyId||e.clientId,r=e.tokenType&&e.tokenType.toLowerCase()!==yn.BEARER.toLowerCase()?e.tokenType.toLowerCase():"";return[`${Pr}.${ec}`,e.homeAccountId,e.environment,e.credentialType,n,e.realm||"",e.target||"",e.requestedClaimsHash||"",r].join(HS).toLowerCase()}generateAccountKey(e){const n=e.homeAccountId.split(".")[1];return[`${Pr}.${uA}`,e.homeAccountId,e.environment,n||e.tenantId||""].join(HS).toLowerCase()}resetRequestCache(){this.logger.trace("BrowserCacheManager.resetRequestCache called"),this.removeTemporaryItem(this.generateCacheKey(dr.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey(dr.VERIFIER)),this.removeTemporaryItem(this.generateCacheKey(dr.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey(dr.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey(dr.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cacheAuthorizeRequest(e,n){this.logger.trace("BrowserCacheManager.cacheAuthorizeRequest called");const r=em(JSON.stringify(e));if(this.setTemporaryCache(dr.REQUEST_PARAMS,r,!0),n){const i=em(n);this.setTemporaryCache(dr.VERIFIER,i,!0)}}getCachedRequest(){this.logger.trace("BrowserCacheManager.getCachedRequest called");const e=this.getTemporaryCache(dr.REQUEST_PARAMS,!0);if(!e)throw Ge(dU);const n=this.getTemporaryCache(dr.VERIFIER,!0);let r,i="";try{r=JSON.parse(Zo(e)),n&&(i=Zo(n))}catch(o){throw this.logger.errorPii(`Attempted to parse: ${e}`),this.logger.error(`Parsing cached token request threw with error: ${o}`),Ge(fU)}return[r,i]}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(dr.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const n=this.validateAndParseJson(e);return n||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){var r;const n=(r=this.getInteractionInProgress())==null?void 0:r.clientId;return e?n===this.clientId:!!n}getInteractionInProgress(){const e=`${Pr}.${dr.INTERACTION_STATUS_KEY}`,n=this.getTemporaryCache(e,!1);try{return n?JSON.parse(n):null}catch{return this.logger.error("Cannot parse interaction status. Removing temporary cache items and clearing url hash. Retrying interaction should fix the error"),this.removeTemporaryItem(e),this.resetRequestCache(),MU(window),null}}setInteractionInProgress(e,n=lc.SIGNIN){var i;const r=`${Pr}.${dr.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw Ge(rU);this.setTemporaryCache(r,JSON.stringify({clientId:this.clientId,type:n}),!1)}else!e&&((i=this.getInteractionInProgress())==null?void 0:i.clientId)===this.clientId&&this.removeTemporaryItem(r)}async hydrateCache(e,n){var c,l,u;const r=N0((c=e.account)==null?void 0:c.homeAccountId,(l=e.account)==null?void 0:l.environment,e.idToken,this.clientId,e.tenantId);let i;n.claims&&(i=await this.cryptoImpl.hashString(n.claims));const o=P0((u=e.account)==null?void 0:u.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?AI(e.expiresOn):0,e.extExpiresOn?AI(e.extExpiresOn):0,Zo,void 0,e.tokenType,void 0,n.sshKid,n.claims,i),s={idToken:r,accessToken:o};return this.saveCacheRecord(s,e.correlationId)}async saveCacheRecord(e,n,r){try{await super.saveCacheRecord(e,n,r)}catch(i){if(i instanceof Sd&&this.performanceClient&&n)try{const o=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:o.refreshToken.length,cacheIdCount:o.idToken.length,cacheAtCount:o.accessToken.length},n)}catch{}throw i}}}function qI(t,e,n,r){try{switch(e){case jr.LocalStorage:return new Kre(t,n,r);case jr.SessionStorage:return new Wre;case jr.MemoryStorage:default:break}}catch(i){n.error(i)}return new $0}const qre=(t,e,n,r)=>{const i={cacheLocation:jr.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:jr.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new hA(t,i,Jy,e,n,r)};/*! @azure/msal-browser v4.19.0 2025-08-05 */function Yre(t,e,n,r,i){return t.verbose("getAllAccounts called"),n?e.getAllAccounts(i||{},r):[]}function Qre(t,e,n,r){if(e.trace("getAccount called"),Object.keys(t).length===0)return e.warning("getAccount: No accountFilter provided"),null;const i=n.getAccountInfoFilteredBy(t,r);return i?(e.verbose("getAccount: Account matching provided filter found, returning"),i):(e.verbose("getAccount: No matching account found, returning null"),null)}function Xre(t,e,n,r){if(e.trace("getAccountByUsername called"),!t)return e.warning("getAccountByUsername: No username provided"),null;const i=n.getAccountInfoFilteredBy({username:t},r);return i?(e.verbose("getAccountByUsername: Account matching username found, returning"),e.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${t}`),i):(e.verbose("getAccountByUsername: No matching account found, returning null"),null)}function Jre(t,e,n,r){if(e.trace("getAccountByHomeId called"),!t)return e.warning("getAccountByHomeId: No homeAccountId provided"),null;const i=n.getAccountInfoFilteredBy({homeAccountId:t},r);return i?(e.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),e.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${t}`),i):(e.verbose("getAccountByHomeId: No matching account found, returning null"),null)}function Zre(t,e,n,r){if(e.trace("getAccountByLocalId called"),!t)return e.warning("getAccountByLocalId: No localAccountId provided"),null;const i=n.getAccountInfoFilteredBy({localAccountId:t},r);return i?(e.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),e.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${t}`),i):(e.verbose("getAccountByLocalId: No matching account found, returning null"),null)}function eie(t,e,n){e.setActiveAccount(t,n)}function tie(t,e){return t.getActiveAccount(e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const nie="msal.broadcast.event";class rie{constructor(e){this.eventCallbacks=new Map,this.logger=e||new Da({}),typeof BroadcastChannel<"u"&&(this.broadcastChannel=new BroadcastChannel(nie)),this.invokeCrossTabCallbacks=this.invokeCrossTabCallbacks.bind(this)}addEventCallback(e,n,r){if(typeof window<"u"){const i=r||Ore();return this.eventCallbacks.has(i)?(this.logger.error(`Event callback with id: ${i} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(i,[e,n||[]]),this.logger.verbose(`Event callback registered with id: ${i}`),i)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,n,r,i){var s;const o={eventType:e,interactionType:n||null,payload:r||null,error:i||null,timestamp:Date.now()};switch(e){case Qe.ACCOUNT_ADDED:case Qe.ACCOUNT_REMOVED:case Qe.ACTIVE_ACCOUNT_CHANGED:(s=this.broadcastChannel)==null||s.postMessage(o);break;default:this.invokeCallbacks(o);break}}invokeCallbacks(e){this.eventCallbacks.forEach(([n,r],i)=>{(r.length===0||r.includes(e.eventType))&&(this.logger.verbose(`Emitting event to callback ${i}: ${e.eventType}`),n.apply(null,[e]))})}invokeCrossTabCallbacks(e){const n=e.data;this.invokeCallbacks(n)}subscribeCrossTab(){var e;(e=this.broadcastChannel)==null||e.addEventListener("message",this.invokeCrossTabCallbacks)}unsubscribeCrossTab(){var e;(e=this.broadcastChannel)==null||e.removeEventListener("message",this.invokeCrossTabCallbacks)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class UU{constructor(e,n,r,i,o,s,c,l,u){this.config=e,this.browserStorage=n,this.browserCrypto=r,this.networkClient=this.config.system.networkClient,this.eventHandler=o,this.navigationClient=s,this.platformAuthProvider=l,this.correlationId=u||us(),this.logger=i.clone(Ti.MSAL_SKU,pu,this.correlationId),this.performanceClient=c}async clearCacheOnLogout(e,n){if(n)try{this.browserStorage.removeAccount(n,e),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch{this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),this.browserStorage.clear(e),await this.browserCrypto.clearKeystore()}catch{this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const n=e||this.config.auth.redirectUri;return tn.getAbsoluteUrl(n,xa())}initializeServerTelemetryManager(e,n){this.logger.verbose("initializeServerTelemetryManager called");const r={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:n||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new Jp(r,this.browserStorage)}async getDiscoveredAuthority(e){const{account:n}=e,r=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(K.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const i={protocolMode:this.config.auth.protocolMode,OIDCOptions:this.config.auth.OIDCOptions,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},o=e.requestAuthority||this.config.auth.authority,s=r!=null&&r.length?r==="true":this.config.auth.instanceAware,c=n&&s?this.config.auth.authority.replace(tn.getDomainFromUrl(o),n.environment):o,l=Zr.generateAuthority(c,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),u=await fe(HB,K.AuthorityFactoryCreateDiscoveredInstance,this.logger,this.performanceClient,this.correlationId)(l,this.config.system.networkClient,this.browserStorage,i,this.logger,this.correlationId,this.performanceClient);if(n&&!u.isAlias(n.environment))throw jn(vB);return u}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function HT(t,e,n,r){n.addQueueMeasurement(K.InitializeBaseRequest,t.correlationId);const i=t.authority||e.auth.authority,o=[...t&&t.scopes||[]],s={...t,correlationId:t.correlationId,authority:i,scopes:o};if(!s.authenticationScheme)s.authenticationScheme=yn.BEARER,r.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(s.authenticationScheme===yn.SSH){if(!t.sshJwk)throw jn(A0);if(!t.sshKid)throw jn(pB)}r.verbose(`Authentication Scheme set to "${s.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&t.claims&&!$s.isEmptyObj(t.claims)&&(s.requestedClaimsHash=await RU(t.claims)),s}async function iie(t,e,n,r,i){r.addQueueMeasurement(K.InitializeSilentRequest,t.correlationId);const o=await fe(HT,K.InitializeBaseRequest,i,r,t.correlationId)(t,n,r,i);return{...t,...o,account:e,forceRefresh:t.forceRefresh||!1}}function HU(t,e){let n;const r=t.httpMethod;if(e===Di.EAR){if(n=r||Ol.POST,n!==Ol.POST)throw jn(yB)}else n=r||Ol.GET;if(t.authorizePostBodyParameters&&n!==Ol.POST)throw jn(xB);return n}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Vf extends UU{initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e==null?void 0:e.correlationId);const n={correlationId:this.correlationId||us(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const r=this.getLogoutHintFromIdTokenClaims(e.account);r&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),n.logoutHint=r)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return!e||e.postLogoutRedirectUri!==null?e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",n.correlationId),n.postLogoutRedirectUri=tn.getAbsoluteUrl(e.postLogoutRedirectUri,xa())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",n.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",n.correlationId),n.postLogoutRedirectUri=tn.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,xa())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",n.correlationId),n.postLogoutRedirectUri=tn.getAbsoluteUrl(xa(),xa())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",n.correlationId),n}getLogoutHintFromIdTokenClaims(e){const n=e.idTokenClaims;if(n){if(n.login_hint)return n.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(e){this.performanceClient.addQueueMeasurement(K.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const n=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new WB(n,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:n,requestAuthority:r,requestAzureCloudOptions:i,requestExtraQueryParameters:o,account:s}=e;this.performanceClient.addQueueMeasurement(K.StandardInteractionClientGetClientConfiguration,this.correlationId);const c=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,this.correlationId)({requestAuthority:r,requestAzureCloudOptions:i,requestExtraQueryParameters:o,account:s}),l=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:c,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:l.loggerCallback,piiLoggingEnabled:l.piiLoggingEnabled,logLevel:l.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:n,libraryInfo:{sku:Ti.MSAL_SKU,version:pu,cpu:pe.EMPTY_STRING,os:pe.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,n){this.performanceClient.addQueueMeasurement(K.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const r=this.getRedirectUri(e.redirectUri),i={interactionType:n},o=zf.setRequestState(this.browserCrypto,e&&e.state||pe.EMPTY_STRING,i),c={...await fe(HT,K.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:r,state:o,nonce:e.nonce||us(),responseMode:this.config.auth.OIDCOptions.serverResponseType},l={...c,httpMethod:HU(c,this.config.auth.protocolMode)};if(e.loginHint||e.sid)return l;const u=e.account||this.browserStorage.getActiveAccount(this.correlationId);return u&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${u.homeAccountId}`,this.correlationId),l.account=u),l}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function oie(t,e){if(!e)return null;try{return zf.parseRequestState(t,e).libraryState.meta}catch{throw we(Xd)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function hp(t,e,n){const r=Zy(t);if(!r)throw wB(t)?(n.error(`A ${e} is present in the iframe but it does not contain known properties. It's likely that the ${e} has been replaced by code running on the redirectUri page.`),n.errorPii(`The ${e} detected is: ${t}`),Ge(eU)):(n.error(`The request has returned to the redirectUri but a ${e} is not present. It's likely that the ${e} has been removed or the page has been redirected by code running on the redirectUri page.`),Ge(ZB));return r}function sie(t,e,n){if(!t.state)throw Ge(TT);const r=oie(e,t.state);if(!r)throw Ge(tU);if(r.interactionType!==n)throw Ge(nU)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class zU{constructor(e,n,r,i,o){this.authModule=e,this.browserStorage=n,this.authCodeRequest=r,this.logger=i,this.performanceClient=o}async handleCodeResponse(e,n){this.performanceClient.addQueueMeasurement(K.HandleCodeResponse,n.correlationId);let r;try{r=Qne(e,n.state)}catch(i){throw i instanceof Tu&&i.subError===Zp?Ge(Zp):i}return fe(this.handleCodeResponseFromServer.bind(this),K.HandleCodeResponseFromServer,this.logger,this.performanceClient,n.correlationId)(r,n)}async handleCodeResponseFromServer(e,n,r=!0){if(this.performanceClient.addQueueMeasurement(K.HandleCodeResponseFromServer,n.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await fe(this.authModule.updateAuthority.bind(this.authModule),K.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,n.correlationId)(e.cloud_instance_host_name,n.correlationId),r&&(e.nonce=n.nonce||void 0),e.state=n.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const o=this.createCcsCredentials(n);o&&(this.authCodeRequest.ccsCredential=o)}return await fe(this.authModule.acquireToken.bind(this.authModule),K.AuthClientAcquireToken,this.logger,this.performanceClient,n.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:Wo.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:Wo.UPN}:null}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const aie="ContentError",GU="user_switch";/*! @azure/msal-browser v4.19.0 2025-08-05 */const cie="USER_INTERACTION_REQUIRED",lie="USER_CANCEL",uie="NO_NETWORK",die="PERSISTENT_ERROR",fie="DISABLED",hie="ACCOUNT_UNAVAILABLE",pie="UX_NOT_ALLOWED";/*! @azure/msal-browser v4.19.0 2025-08-05 */const mie=-2147186943,gie={[GU]:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."};class Ns extends _n{constructor(e,n,r){super(e,n),Object.setPrototypeOf(this,Ns.prototype),this.name="NativeAuthError",this.ext=r}}function qu(t){if(t.ext&&t.ext.status&&(t.ext.status===die||t.ext.status===fie)||t.ext&&t.ext.error&&t.ext.error===mie)return!0;switch(t.errorCode){case aie:return!0;default:return!1}}function hx(t,e,n){if(n&&n.status)switch(n.status){case hie:return cx(GB);case cie:return new ls(t,e);case lie:return Ge(Zp);case uie:return Ge(lx);case pie:return cx(wT)}return new Ns(t,gie[t]||e,n)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class VU extends Vf{async acquireToken(e){this.performanceClient.addQueueMeasurement(K.SilentCacheClientAcquireToken,e.correlationId);const n=this.initializeServerTelemetryManager(Cn.acquireTokenSilent_silentFlow),r=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),i=new Wne(r,this.performanceClient);this.logger.verbose("Silent auth client created");try{const s=(await fe(i.acquireCachedToken.bind(i),K.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),s}catch(o){throw o instanceof yg&&o.errorCode===NT&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),o}}logout(e){this.logger.verbose("logoutRedirect called");const n=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(n.correlationId,n==null?void 0:n.account)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class ry extends UU{constructor(e,n,r,i,o,s,c,l,u,d,f,h){super(e,n,r,i,o,s,l,u,h),this.apiId=c,this.accountId=d,this.platformAuthProvider=u,this.nativeStorageManager=f,this.silentCacheClient=new VU(e,this.nativeStorageManager,r,i,o,s,l,u,h);const p=this.platformAuthProvider.getExtensionName();this.skus=Jp.makeExtraSkuString({libraryName:Ti.MSAL_SKU,libraryVersion:pu,extensionName:p,extensionVersion:this.platformAuthProvider.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[cne]:this.skus}}async acquireToken(e,n){this.performanceClient.addQueueMeasurement(K.NativeInteractionClientAcquireToken,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const r=this.performanceClient.startMeasurement(K.NativeInteractionClientAcquireToken,e.correlationId),i=$i(),o=this.initializeServerTelemetryManager(this.apiId);try{const s=await this.initializeNativeRequest(e);try{const l=await this.acquireTokensFromCache(this.accountId,s);return r.end({success:!0,isNativeBroker:!1,fromCache:!0}),l}catch(l){if(n===ci.AccessToken)throw this.logger.info("MSAL internal Cache does not contain tokens, return error as per cache policy"),l;this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const c=await this.platformAuthProvider.sendMessage(s);return await this.handleNativeResponse(c,s,i).then(l=>(r.end({success:!0,isNativeBroker:!0,requestId:l.requestId}),o.clearNativeBrokerErrorCode(),l)).catch(l=>{throw r.end({success:!1,errorCode:l.errorCode,subErrorCode:l.subError,isNativeBroker:!0}),l})}catch(s){throw s instanceof Ns&&o.setNativeBrokerErrorCode(s.errorCode),s}}createSilentCacheRequest(e,n){return{authority:e.authority,correlationId:this.correlationId,scopes:Ar.fromString(e.scope).asArray(),account:n,forceRefresh:!1}}async acquireTokensFromCache(e,n){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),we(tA);const r=this.browserStorage.getBaseAccountInfo({nativeAccountId:e},this.correlationId);if(!r)throw we(tA);try{const i=this.createSilentCacheRequest(n,r),o=await this.silentCacheClient.acquireToken(i),s={...r,idTokenClaims:o==null?void 0:o.idTokenClaims,idToken:o==null?void 0:o.idToken};return{...o,account:s}}catch(i){throw i}}async acquireTokenRedirect(e,n){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...r}=e;delete r.onRedirectNavigate;const i=await this.initializeNativeRequest(r);try{await this.platformAuthProvider.sendMessage(i)}catch(c){if(c instanceof Ns&&(this.initializeServerTelemetryManager(this.apiId).setNativeBrokerErrorCode(c.errorCode),qu(c)))throw c}this.browserStorage.setTemporaryCache(dr.NATIVE_REQUEST,JSON.stringify(i),!0);const o={apiId:Cn.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},s=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);n.end({success:!0}),await this.navigationClient.navigateExternal(s,o)}async handleRedirectPromise(e,n){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const r=this.browserStorage.getCachedNativeRequest();if(!r)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),e&&n&&(e==null||e.addFields({errorCode:"no_cached_request"},n)),null;const{prompt:i,...o}=r;i&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(dr.NATIVE_REQUEST));const s=$i();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const c=await this.platformAuthProvider.sendMessage(o),l=await this.handleNativeResponse(c,o,s);return this.initializeServerTelemetryManager(this.apiId).clearNativeBrokerErrorCode(),l}catch(c){throw c}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,n,r){var d,f;this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const i=Hf(e.id_token,Zo),o=this.createHomeAccountIdentifier(e,i),s=(d=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:n.accountId},this.correlationId))==null?void 0:d.homeAccountId;if((f=n.extraParameters)!=null&&f.child_client_id&&e.account.id!==n.accountId)this.logger.info("handleNativeServerResponse: Double broker flow detected, ignoring accountId mismatch");else if(o!==s&&e.account.id!==n.accountId)throw hx(GU);const c=await this.getDiscoveredAuthority({requestAuthority:n.authority}),l=ST(this.browserStorage,c,o,Zo,this.correlationId,i,e.client_info,void 0,i.tid,void 0,e.account.id,this.logger);e.expires_in=Number(e.expires_in);const u=await this.generateAuthenticationResult(e,n,i,l,c.canonicalAuthority,r);return await this.cacheAccount(l,this.correlationId),await this.cacheNativeTokens(e,n,o,i,e.access_token,u.tenantId,r),u}createHomeAccountIdentifier(e,n){return cs.generateHomeAccountId(e.client_info||pe.EMPTY_STRING,Uo.Default,this.logger,this.browserCrypto,n)}generateScopes(e,n){return n?Ar.fromString(n):Ar.fromString(e)}async generatePopAccessToken(e,n){if(n.tokenType===yn.POP&&n.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const r=new Jd(this.browserCrypto),i={resourceRequestMethod:n.resourceRequestMethod,resourceRequestUri:n.resourceRequestUri,shrClaims:n.shrClaims,shrNonce:n.shrNonce};if(!n.keyId)throw we(QE);return r.signPopToken(e.access_token,n.keyId,i)}else return e.access_token}async generateAuthenticationResult(e,n,r,i,o,s){const c=this.addTelemetryFromNativeResponse(e.properties.MATS),l=this.generateScopes(n.scope,e.scope),u=e.account.properties||{},d=u.UID||r.oid||r.sub||pe.EMPTY_STRING,f=u.TenantId||r.tid||pe.EMPTY_STRING,h=oT(i.getAccountInfo(),void 0,r,e.id_token);h.nativeAccountId!==e.account.id&&(h.nativeAccountId=e.account.id);const p=await this.generatePopAccessToken(e,n),g=n.tokenType===yn.POP?yn.POP:yn.BEARER;return{authority:o,uniqueId:d,tenantId:f,scopes:l.asArray(),account:h,idToken:e.id_token,idTokenClaims:r,accessToken:p,fromCache:c?this.isResponseFromCache(c):!1,expiresOn:_d(s+e.expires_in),tokenType:g,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}async cacheAccount(e,n){await this.browserStorage.setAccount(e,this.correlationId),this.browserStorage.removeAccountContext(e.getAccountInfo(),n)}cacheNativeTokens(e,n,r,i,o,s,c){const l=N0(r,n.authority,e.id_token||"",n.clientId,i.tid||""),u=n.tokenType===yn.POP?pe.SHR_NONCE_VALIDITY:(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,d=c+u,f=this.generateScopes(e.scope,n.scope),h=P0(r,n.authority,o,n.clientId,i.tid||s,f.printScopes(),d,0,Zo,void 0,n.tokenType,void 0,n.keyId),p={idToken:l,accessToken:h};return this.nativeStorageManager.saveCacheRecord(p,this.correlationId,n.storeInCache)}getExpiresInValue(e,n){return e===yn.POP?pe.SHR_NONCE_VALIDITY:(typeof n=="string"?parseInt(n,10):n)||0}addTelemetryFromNativeResponse(e){const n=this.getMATSFromResponse(e);return n?(this.performanceClient.addFields({extensionId:this.platformAuthProvider.getExtensionId(),extensionVersion:this.platformAuthProvider.getExtensionVersion(),matsBrokerVersion:n.broker_version,matsAccountJoinOnStart:n.account_join_on_start,matsAccountJoinOnEnd:n.account_join_on_end,matsDeviceJoin:n.device_join,matsPromptBehavior:n.prompt_behavior,matsApiErrorCode:n.api_error_code,matsUiVisible:n.ui_visible,matsSilentCode:n.silent_code,matsSilentBiSubCode:n.silent_bi_sub_code,matsSilentMessage:n.silent_message,matsSilentStatus:n.silent_status,matsHttpStatus:n.http_status,matsHttpEventCount:n.http_event_count},this.correlationId),n):null}getMATSFromResponse(e){if(e)try{return JSON.parse(e)}catch{this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return typeof e.is_cached>"u"?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(e){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const n=await this.getCanonicalAuthority(e),{scopes:r,...i}=e,o=new Ar(r||[]);o.appendScopes(vg);const s={...i,accountId:this.accountId,clientId:this.config.auth.clientId,authority:n.urlString,scope:o.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:this.getPrompt(e.prompt),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(s.signPopToken&&e.popKid)throw Ge(_U);if(this.handleExtraBrokerParams(s),s.extraParameters=s.extraParameters||{},s.extraParameters.telemetry=yo.MATS_TELEMETRY,e.authenticationScheme===yn.POP){const c={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},l=new Jd(this.browserCrypto);let u;if(s.keyId)u=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:s.keyId})),s.signPopToken=!1;else{const d=await fe(l.generateCnf.bind(l),K.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(c,this.logger);u=d.reqCnfString,s.keyId=d.kid,s.signPopToken=!0}s.reqCnf=u}return this.addRequestSKUs(s),s}async getCanonicalAuthority(e){const n=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:n,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const r=new tn(n);return r.validateAsUri(),r}getPrompt(e){switch(this.apiId){case Cn.ssoSilent:case Cn.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),pi.NONE}if(!e){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e){case pi.NONE:case pi.CONSENT:case pi.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e} is not compatible with native flow`),Ge(SU)}}handleExtraBrokerParams(e){var o;const n=e.extraParameters&&e.extraParameters.hasOwnProperty(rx)&&e.extraParameters.hasOwnProperty(ix)&&e.extraParameters.hasOwnProperty(fu);if(!e.embeddedClientId&&!n)return;let r="";const i=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,r=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[ix],r=e.extraParameters[fu]),e.extraParameters={child_client_id:r,child_redirect_uri:i},(o=this.performanceClient)==null||o.addFields({embeddedClientId:r,embeddedRedirectUri:i},e.correlationId)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function zT(t,e,n,r,i){const o=Yne({...t.auth,authority:e},n,r,i);if(pT(o,{sku:Ti.MSAL_SKU,version:pu,os:"",cpu:""}),t.auth.protocolMode!==Di.OIDC&&mT(o,t.telemetry.application),n.platformBroker&&(fne(o),n.authenticationScheme===yn.POP)){const s=new $a(r,i),c=new Jd(s);let l;n.popKid?l=s.encodeKid(n.popKid):l=(await fe(c.generateCnf.bind(c),K.PopTokenGenerateCnf,r,i,n.correlationId)(n,r)).reqCnfString,vT(o,l)}return j0(o,n.correlationId,i),o}async function GT(t,e,n,r,i){if(!n.codeChallenge)throw jn(tT);const o=await fe(zT,K.GetStandardParams,r,i,n.correlationId)(t,e,n,r,i);return cT(o,zE.CODE),kB(o,n.codeChallenge,pe.S256_CODE_CHALLENGE_METHOD),Mc(o,n.extraQueryParameters||{}),CT(e,o,t.auth.encodeExtraQueryParams,n.extraQueryParameters)}async function VT(t,e,n,r,i,o){if(!r.earJwk)throw Ge(ET);const s=await zT(e,n,r,i,o);cT(s,zE.IDTOKEN_TOKEN_REFRESHTOKEN),Cne(s,r.earJwk);const c=new Map;Mc(c,r.extraQueryParameters||{});const l=CT(n,c,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return KU(t,l,s)}async function KT(t,e,n,r,i,o){const s=await zT(e,n,r,i,o);cT(s,zE.CODE),kB(s,r.codeChallenge,r.codeChallengeMethod||pe.S256_CODE_CHALLENGE_METHOD),_ne(s,r.authorizePostBodyParameters||{});const c=new Map;Mc(c,r.extraQueryParameters||{});const l=CT(n,c,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return KU(t,l,s)}function KU(t,e,n){const r=t.createElement("form");return r.method="post",r.action=e,n.forEach((i,o)=>{const s=t.createElement("input");s.hidden=!0,s.name=o,s.value=i,r.appendChild(s)}),t.body.appendChild(r),r}async function WU(t,e,n,r,i,o,s,c,l,u){if(c.verbose("Account id found, calling WAM for token"),!u)throw Ge(kT);const d=new $a(c,l),f=new ry(r,i,d,c,s,r.system.navigationClient,n,l,u,e,o,t.correlationId),{userRequestState:h}=zf.parseRequestState(d,t.state);return fe(f.acquireToken.bind(f),K.NativeInteractionClientAcquireToken,c,l,t.correlationId)({...t,state:h,prompt:void 0})}async function px(t,e,n,r,i,o,s,c,l,u,d,f){if(Ts.removeThrottle(s,i.auth.clientId,t),e.accountId)return fe(WU,K.HandleResponsePlatformBroker,u,d,t.correlationId)(t,e.accountId,r,i,s,c,l,u,d,f);const h={...t,code:e.code||"",codeVerifier:n},p=new zU(o,s,h,u,d);return await fe(p.handleCodeResponse.bind(p),K.HandleCodeResponse,u,d,t.correlationId)(e,t)}async function WT(t,e,n,r,i,o,s,c,l,u,d){if(Ts.removeThrottle(o,r.auth.clientId,t),qB(e,t.state),!e.ear_jwe)throw Ge(JB);if(!t.earJwk)throw Ge(ET);const f=JSON.parse(await fe(_re,K.DecryptEarResponse,l,u,t.correlationId)(t.earJwk,e.ear_jwe));if(f.accountId)return fe(WU,K.HandleResponsePlatformBroker,l,u,t.correlationId)(t,f.accountId,n,r,o,s,c,l,u,d);const h=new hu(r.auth.clientId,o,new $a(l,u),l,null,null,u);h.validateTokenResponse(f);const p={code:"",state:t.state,nonce:t.nonce,client_info:f.client_info,cloud_graph_host_name:f.cloud_graph_host_name,cloud_instance_host_name:f.cloud_instance_host_name,cloud_instance_name:f.cloud_instance_name,msgraph_host:f.msgraph_host};return await fe(h.handleServerTokenResponse.bind(h),K.HandleServerTokenResponse,l,u,t.correlationId)(f,i,$i(),t,p,void 0,void 0,void 0,void 0)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const vie=32;async function L0(t,e,n){t.addQueueMeasurement(K.GeneratePkceCodes,n);const r=Zi(yie,K.GenerateCodeVerifier,e,t,n)(t,e,n),i=await fe(xie,K.GenerateCodeChallengeFromVerifier,e,t,n)(r,t,e,n);return{verifier:r,challenge:i}}function yie(t,e,n){try{const r=new Uint8Array(vie);return Zi(xre,K.GetRandomValues,e,t,n)(r),Xc(r)}catch{throw Ge(jT)}}async function xie(t,e,n,r){e.addQueueMeasurement(K.GenerateCodeChallengeFromVerifier,r);try{const i=await fe(kU,K.Sha256Digest,n,e,r)(t,e,r);return Xc(new Uint8Array(i))}catch{throw Ge(jT)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class mx{constructor(e,n,r,i){this.logger=e,this.handshakeTimeoutMs=n,this.extensionId=i,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=r,this.handshakeEvent=r.startMeasurement(K.NativeMessageHandlerHandshake),this.platformAuthType=yo.PLATFORM_EXTENSION_PROVIDER}async sendMessage(e){this.logger.trace(this.platformAuthType+" - sendMessage called.");const n={method:Ah.GetToken,request:e},r={channel:yo.CHANNEL_ID,extensionId:this.extensionId,responseId:us(),body:n};this.logger.trace(this.platformAuthType+" - Sending request to browser extension"),this.logger.tracePii(this.platformAuthType+` - Sending request to browser extension: ${JSON.stringify(r)}`),this.messageChannel.port1.postMessage(r);const i=await new Promise((s,c)=>{this.resolvers.set(r.responseId,{resolve:s,reject:c})});return this.validatePlatformBrokerResponse(i)}static async createProvider(e,n,r){e.trace("PlatformAuthExtensionHandler - createProvider called.");try{const i=new mx(e,n,r,yo.PREFERRED_EXTENSION_ID);return await i.sendHandshakeRequest(),i}catch{const o=new mx(e,n,r);return await o.sendHandshakeRequest(),o}}async sendHandshakeRequest(){this.logger.trace(this.platformAuthType+" - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:yo.CHANNEL_ID,extensionId:this.extensionId,responseId:us(),body:{method:Ah.HandshakeRequest}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=n=>{this.onChannelMessage(n)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((n,r)=>{this.handshakeResolvers.set(e.responseId,{resolve:n,reject:r}),this.timeoutId=window.setTimeout(()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.end({extensionHandshakeTimedOut:!0,success:!1}),r(Ge(bU)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace(this.platformAuthType+" - onWindowMessage called"),e.source!==window)return;const n=e.data;if(!(!n.channel||n.channel!==yo.CHANNEL_ID)&&!(n.extensionId&&n.extensionId!==this.extensionId)&&n.body.method===Ah.HandshakeRequest){const r=this.handshakeResolvers.get(n.responseId);if(!r){this.logger.trace(this.platformAuthType+`.onWindowMessage - resolver can't be found for request ${n.responseId}`);return}this.logger.verbose(n.extensionId?`Extension with id: ${n.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.end({success:!1,extensionInstalled:!1}),r.reject(Ge(wU))}}onChannelMessage(e){this.logger.trace(this.platformAuthType+" - onChannelMessage called.");const n=e.data,r=this.resolvers.get(n.responseId),i=this.handshakeResolvers.get(n.responseId);try{const o=n.body.method;if(o===Ah.Response){if(!r)return;const s=n.body.response;if(this.logger.trace(this.platformAuthType+" - Received response from browser extension"),this.logger.tracePii(this.platformAuthType+` - Received response from browser extension: ${JSON.stringify(s)}`),s.status!=="Success")r.reject(hx(s.code,s.description,s.ext));else if(s.result)s.result.code&&s.result.description?r.reject(hx(s.result.code,s.result.description,s.result.ext)):r.resolve(s.result);else throw J_(Xy,"Event does not contain result.");this.resolvers.delete(n.responseId)}else if(o===Ah.HandshakeResponse){if(!i){this.logger.trace(this.platformAuthType+`.onChannelMessage - resolver can't be found for request ${n.responseId}`);return}clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=n.extensionId,this.extensionVersion=n.body.version,this.logger.verbose(this.platformAuthType+` - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),i.resolve(),this.handshakeResolvers.delete(n.responseId)}}catch(o){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${o}`),this.logger.errorPii(`Unable to parse ${e}`),r?r.reject(o):i&&i.reject(o)}}validatePlatformBrokerResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw J_(Xy,"Response missing expected properties.")}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}getExtensionName(){var e;return this.getExtensionId()===yo.PREFERRED_EXTENSION_ID?"chrome":(e=this.getExtensionId())!=null&&e.length?"unknown":void 0}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class qT{constructor(e,n,r){this.logger=e,this.performanceClient=n,this.correlationId=r,this.platformAuthType=yo.PLATFORM_DOM_PROVIDER}static async createProvider(e,n,r){var i;if(e.trace("PlatformAuthDOMHandler: createProvider called"),(i=window.navigator)!=null&&i.platformAuthentication){const o=await window.navigator.platformAuthentication.getSupportedContracts(yo.MICROSOFT_ENTRA_BROKERID);if(o!=null&&o.includes(yo.PLATFORM_DOM_APIS))return e.trace("Platform auth api available in DOM"),new qT(e,n,r)}}getExtensionId(){return yo.MICROSOFT_ENTRA_BROKERID}getExtensionVersion(){return""}getExtensionName(){return yo.DOM_API_NAME}async sendMessage(e){this.logger.trace(this.platformAuthType+" - Sending request to browser DOM API");try{const n=this.initializePlatformDOMRequest(e),r=await window.navigator.platformAuthentication.executeGetToken(n);return this.validatePlatformBrokerResponse(r)}catch(n){throw this.logger.error(this.platformAuthType+" - executeGetToken DOM API error"),n}}initializePlatformDOMRequest(e){this.logger.trace(this.platformAuthType+" - initializeNativeDOMRequest called");const{accountId:n,clientId:r,authority:i,scope:o,redirectUri:s,correlationId:c,state:l,storeInCache:u,embeddedClientId:d,extraParameters:f,...h}=e,p=this.getDOMExtraParams(h);return{accountId:n,brokerId:this.getExtensionId(),authority:i,clientId:r,correlationId:c||this.correlationId,extraParameters:{...f,...p},isSecurityTokenService:!1,redirectUri:s,scope:o,state:l,storeInCache:u,embeddedClientId:d}}validatePlatformBrokerResponse(e){if(e.hasOwnProperty("isSuccess")){if(e.hasOwnProperty("accessToken")&&e.hasOwnProperty("idToken")&&e.hasOwnProperty("clientInfo")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scopes")&&e.hasOwnProperty("expiresIn"))return this.logger.trace(this.platformAuthType+" - platform broker returned successful and valid response"),this.convertToPlatformBrokerResponse(e);if(e.hasOwnProperty("error")){const n=e;if(n.isSuccess===!1&&n.error&&n.error.code)throw this.logger.trace(this.platformAuthType+" - platform broker returned error response"),hx(n.error.code,n.error.description,{error:parseInt(n.error.errorCode),protocol_error:n.error.protocolError,status:n.error.status,properties:n.error.properties})}}throw J_(Xy,"Response missing expected properties.")}convertToPlatformBrokerResponse(e){return this.logger.trace(this.platformAuthType+" - convertToNativeResponse called"),{access_token:e.accessToken,id_token:e.idToken,client_info:e.clientInfo,account:e.account,expires_in:e.expiresIn,scope:e.scopes,state:e.state||"",properties:e.properties||{},extendedLifetimeToken:e.extendedLifetimeToken??!1,shr:e.proofOfPossessionPayload}}getDOMExtraParams(e){return{...Object.entries(e).reduce((i,[o,s])=>(i[o]=String(s),i),{})}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function bie(t,e,n,r){t.trace("getPlatformAuthProvider called",n);const i=wie();t.trace("Has client allowed platform auth via DOM API: "+i);let o;try{i&&(o=await qT.createProvider(t,e,n)),o||(t.trace("Platform auth via DOM API not available, checking for extension"),o=await mx.createProvider(t,r||FU,e))}catch(s){t.trace("Platform auth not available",s)}return o}function wie(){let t;try{return t=window[jr.SessionStorage],(t==null?void 0:t.getItem(Bre))==="true"}catch{return!1}}function nm(t,e,n,r){if(e.trace("isPlatformAuthAllowed called"),!t.system.allowPlatformBroker)return e.trace("isPlatformAuthAllowed: allowPlatformBroker is not enabled, returning false"),!1;if(!n)return e.trace("isPlatformAuthAllowed: Platform auth provider is not initialized, returning false"),!1;if(r)switch(r){case yn.BEARER:case yn.POP:return e.trace("isPlatformAuthAllowed: authenticationScheme is supported, returning true"),!0;default:return e.trace("isPlatformAuthAllowed: authenticationScheme is not supported, returning false"),!1}return!0}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Sie extends Vf{constructor(e,n,r,i,o,s,c,l,u,d){super(e,n,r,i,o,s,c,u,d),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=l,this.eventHandler=o}acquireToken(e,n){let r;try{if(r={popupName:this.generatePopupName(e.scopes||vg,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window},this.performanceClient.addFields({isAsyncPopup:this.config.system.asyncPopups},this.correlationId),this.config.system.asyncPopups)return this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,r,n);{const o={...e,httpMethod:HU(e,this.config.auth.protocolMode)};return this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),r.popup=this.openSizedPopup("about:blank",r),this.acquireTokenPopupAsync(o,r,n)}}catch(i){return Promise.reject(i)}}logout(e){try{this.logger.verbose("logoutPopup called");const n=this.initializeLogoutRequest(e),r={popupName:this.generateLogoutPopupName(n),popupWindowAttributes:(e==null?void 0:e.popupWindowAttributes)||{},popupWindowParent:(e==null?void 0:e.popupWindowParent)??window},i=e&&e.authority,o=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(n,r,i,o)):(this.logger.verbose("asyncPopup set to false, opening popup"),r.popup=this.openSizedPopup("about:blank",r),this.logoutPopupAsync(n,r,i,o))}catch(n){return Promise.reject(n)}}async acquireTokenPopupAsync(e,n,r){this.logger.verbose("acquireTokenPopupAsync called");const i=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,xt.Popup);n.popup&&LU(i.authority);const o=nm(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme);return i.platformBroker=o,this.config.auth.protocolMode===Di.EAR?this.executeEarFlow(i,n):this.executeCodeFlow(i,n,r)}async executeCodeFlow(e,n,r){var l;const i=e.correlationId,o=this.initializeServerTelemetryManager(Cn.acquireTokenPopup),s=r||await fe(L0,K.GeneratePkceCodes,this.logger,this.performanceClient,i)(this.performanceClient,this.logger,i),c={...e,codeChallenge:s.challenge};try{const u=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,i)({serverTelemetryManager:o,requestAuthority:c.authority,requestAzureCloudOptions:c.azureCloudOptions,requestExtraQueryParameters:c.extraQueryParameters,account:c.account});if(c.httpMethod===Ol.POST)return await this.executeCodeFlowWithPost(c,n,u,s.verifier);{const d=await fe(GT,K.GetAuthCodeUrl,this.logger,this.performanceClient,i)(this.config,u.authority,c,this.logger,this.performanceClient),f=this.initiateAuthRequest(d,n);this.eventHandler.emitEvent(Qe.POPUP_OPENED,xt.Popup,{popupWindow:f},null);const h=await this.monitorPopupForHash(f,n.popupWindowParent),p=Zi(hp,K.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(h,this.config.auth.OIDCOptions.serverResponseType,this.logger);return await fe(px,K.HandleResponseCode,this.logger,this.performanceClient,i)(e,p,s.verifier,Cn.acquireTokenPopup,this.config,u,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}}catch(u){throw(l=n.popup)==null||l.close(),u instanceof _n&&(u.setCorrelationId(this.correlationId),o.cacheFailedRequest(u)),u}}async executeEarFlow(e,n){const r=e.correlationId,i=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,r)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),o=await fe(DT,K.GenerateEarKey,this.logger,this.performanceClient,r)(),s={...e,earJwk:o},c=n.popup||this.openPopup("about:blank",n);(await VT(c.document,this.config,i,s,this.logger,this.performanceClient)).submit();const u=await fe(this.monitorPopupForHash.bind(this),K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(c,n.popupWindowParent),d=Zi(hp,K.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);return fe(WT,K.HandleResponseEar,this.logger,this.performanceClient,r)(s,d,Cn.acquireTokenPopup,this.config,i,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async executeCodeFlowWithPost(e,n,r,i){const o=e.correlationId,s=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,o)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),c=n.popup||this.openPopup("about:blank",n);(await KT(c.document,this.config,s,e,this.logger,this.performanceClient)).submit();const u=await fe(this.monitorPopupForHash.bind(this),K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,o)(c,n.popupWindowParent),d=Zi(hp,K.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);return fe(px,K.HandleResponseCode,this.logger,this.performanceClient,o)(e,d,i,Cn.acquireTokenPopup,this.config,r,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async logoutPopupAsync(e,n,r,i){var s,c,l;this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(Qe.LOGOUT_START,xt.Popup,e);const o=this.initializeServerTelemetryManager(Cn.logoutPopup);try{await this.clearCacheOnLogout(this.correlationId,e.account);const u=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:o,requestAuthority:r,account:e.account||void 0});try{u.authority.endSessionEndpoint}catch{if((s=e.account)!=null&&s.homeAccountId&&e.postLogoutRedirectUri&&u.authority.protocolMode===Di.OIDC){if(this.eventHandler.emitEvent(Qe.LOGOUT_SUCCESS,xt.Popup,e),i){const h={apiId:Cn.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},p=tn.getAbsoluteUrl(i,xa());await this.navigationClient.navigateInternal(p,h)}(c=n.popup)==null||c.close();return}}const d=u.getLogoutUri(e);this.eventHandler.emitEvent(Qe.LOGOUT_SUCCESS,xt.Popup,e);const f=this.openPopup(d,n);if(this.eventHandler.emitEvent(Qe.POPUP_OPENED,xt.Popup,{popupWindow:f},null),await this.monitorPopupForHash(f,n.popupWindowParent).catch(()=>{}),i){const h={apiId:Cn.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},p=tn.getAbsoluteUrl(i,xa());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${p}`),await this.navigationClient.navigateInternal(p,h)}else this.logger.verbose("No main window navigation requested")}catch(u){throw(l=n.popup)==null||l.close(),u instanceof _n&&(u.setCorrelationId(this.correlationId),o.cacheFailedRequest(u)),this.eventHandler.emitEvent(Qe.LOGOUT_FAILURE,xt.Popup,null,u),this.eventHandler.emitEvent(Qe.LOGOUT_END,xt.Popup),u}this.eventHandler.emitEvent(Qe.LOGOUT_END,xt.Popup)}initiateAuthRequest(e,n){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,n);throw this.logger.error("Navigate url is empty"),Ge(R0)}monitorPopupForHash(e,n){return new Promise((r,i)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const o=setInterval(()=>{if(e.closed){this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(o),i(Ge(Zp));return}let s="";try{s=e.location.href}catch{}if(!s||s==="about:blank")return;clearInterval(o);let c="";const l=this.config.auth.OIDCOptions.serverResponseType;e&&(l===_0.QUERY?c=e.location.search:c=e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),r(c)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,n)})}openPopup(e,n){try{let r;if(n.popup?(r=n.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),r.location.assign(e)):typeof n.popup>"u"&&(this.logger.verbosePii(`Opening popup window to: ${e}`),r=this.openSizedPopup(e,n)),!r)throw Ge(oU);return r.focus&&r.focus(),this.currentWindow=r,n.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),r}catch(r){throw this.logger.error("error opening popup "+r.message),Ge(iU)}}openSizedPopup(e,{popupName:n,popupWindowAttributes:r,popupWindowParent:i}){var p,g,m,y;const o=i.screenLeft?i.screenLeft:i.screenX,s=i.screenTop?i.screenTop:i.screenY,c=i.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,l=i.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let u=(p=r.popupSize)==null?void 0:p.width,d=(g=r.popupSize)==null?void 0:g.height,f=(m=r.popupPosition)==null?void 0:m.top,h=(y=r.popupPosition)==null?void 0:y.left;return(!u||u<0||u>c)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),u=Ti.POPUP_WIDTH),(!d||d<0||d>l)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),d=Ti.POPUP_HEIGHT),(!f||f<0||f>l)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),f=Math.max(0,l/2-Ti.POPUP_HEIGHT/2+s)),(!h||h<0||h>c)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),h=Math.max(0,c/2-Ti.POPUP_WIDTH/2+o)),i.open(e,n,`width=${u}, height=${d}, top=${f}, left=${h}, scrollbars=yes`)}unloadWindow(e){this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,n){e.close(),n.removeEventListener("beforeunload",this.unloadWindow)}generatePopupName(e,n){return`${Ti.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${n}.${this.correlationId}`}generateLogoutPopupName(e){const n=e.account&&e.account.homeAccountId;return`${Ti.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${n}.${this.correlationId}`}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Cie(){if(typeof window>"u"||typeof window.performance>"u"||typeof window.performance.getEntriesByType!="function")return;const t=window.performance.getEntriesByType("navigation"),e=t.length?t[0]:void 0;return e==null?void 0:e.type}class _ie extends Vf{constructor(e,n,r,i,o,s,c,l,u,d){super(e,n,r,i,o,s,c,u,d),this.nativeStorage=l}async acquireToken(e){const n=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,xt.Redirect);n.platformBroker=nm(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme);const r=o=>{o.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.resetRequestCache(),this.eventHandler.emitEvent(Qe.RESTORE_FROM_BFCACHE,xt.Redirect))},i=this.getRedirectStartPage(e.redirectStartPage);this.logger.verbosePii(`Redirect start page: ${i}`),this.browserStorage.setTemporaryCache(dr.ORIGIN_URI,i,!0),window.addEventListener("pageshow",r);try{this.config.auth.protocolMode===Di.EAR?await this.executeEarFlow(n):await this.executeCodeFlow(n,e.onRedirectNavigate)}catch(o){throw o instanceof _n&&o.setCorrelationId(this.correlationId),window.removeEventListener("pageshow",r),o}}async executeCodeFlow(e,n){const r=e.correlationId,i=this.initializeServerTelemetryManager(Cn.acquireTokenRedirect),o=await fe(L0,K.GeneratePkceCodes,this.logger,this.performanceClient,r)(this.performanceClient,this.logger,r),s={...e,codeChallenge:o.challenge};this.browserStorage.cacheAuthorizeRequest(s,o.verifier);try{if(s.httpMethod===Ol.POST)return await this.executeCodeFlowWithPost(s);{const c=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:s.authority,requestAzureCloudOptions:s.azureCloudOptions,requestExtraQueryParameters:s.extraQueryParameters,account:s.account}),l=await fe(GT,K.GetAuthCodeUrl,this.logger,this.performanceClient,e.correlationId)(this.config,c.authority,s,this.logger,this.performanceClient);return await this.initiateAuthRequest(l,n)}}catch(c){throw c instanceof _n&&(c.setCorrelationId(this.correlationId),i.cacheFailedRequest(c)),c}}async executeEarFlow(e){const n=e.correlationId,r=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await fe(DT,K.GenerateEarKey,this.logger,this.performanceClient,n)(),o={...e,earJwk:i};return this.browserStorage.cacheAuthorizeRequest(o),(await VT(document,this.config,r,o,this.logger,this.performanceClient)).submit(),new Promise((c,l)=>{setTimeout(()=>{l(Ge(ux,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async executeCodeFlowWithPost(e){const n=e.correlationId,r=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return this.browserStorage.cacheAuthorizeRequest(e),(await KT(document,this.config,r,e,this.logger,this.performanceClient)).submit(),new Promise((o,s)=>{setTimeout(()=>{s(Ge(ux,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async handleRedirectPromise(e="",n,r,i){const o=this.initializeServerTelemetryManager(Cn.handleRedirectPromise);try{const[s,c]=this.getRedirectResponse(e||"");if(!s)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.resetRequestCache(),Cie()!=="back_forward"?i.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const l=this.browserStorage.getTemporaryCache(dr.ORIGIN_URI,!0)||pe.EMPTY_STRING,u=tn.removeHashFromUrl(l),d=tn.removeHashFromUrl(window.location.href);if(u===d&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),l.indexOf("#")>-1&&jre(l),await this.handleResponse(s,n,r,o);if(this.config.auth.navigateToLoginRequestUrl){if(!LT()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(dr.URL_HASH,c,!0);const f={apiId:Cn.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let h=!0;if(!l||l==="null"){const p=Tre();this.browserStorage.setTemporaryCache(dr.ORIGIN_URI,p,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),h=await this.navigationClient.navigateInternal(p,f)}else this.logger.verbose(`Navigating to loginRequestUrl: ${l}`),h=await this.navigationClient.navigateInternal(l,f);if(!h)return await this.handleResponse(s,n,r,o)}}else return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(s,n,r,o);return null}catch(s){throw s instanceof _n&&(s.setCorrelationId(this.correlationId),o.cacheFailedRequest(s)),s}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let n=e;n||(this.config.auth.OIDCOptions.serverResponseType===_0.QUERY?n=window.location.search:n=window.location.hash);let r=Zy(n);if(r){try{sie(r,this.browserCrypto,xt.Redirect)}catch(o){return o instanceof _n&&this.logger.error(`Interaction type validation failed due to ${o.errorCode}: ${o.errorMessage}`),[null,""]}return MU(window),this.logger.verbose("Hash contains known properties, returning response hash"),[r,n]}const i=this.browserStorage.getTemporaryCache(dr.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(dr.URL_HASH)),i&&(r=Zy(i),r)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[r,i]):[null,""]}async handleResponse(e,n,r,i){if(!e.state)throw Ge(TT);if(e.ear_jwe){const c=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n.correlationId)({requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account});return fe(WT,K.HandleResponseEar,this.logger,this.performanceClient,n.correlationId)(n,e,Cn.acquireTokenRedirect,this.config,c,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}const s=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:n.authority});return fe(px,K.HandleResponseCode,this.logger,this.performanceClient,n.correlationId)(n,e,r,Cn.acquireTokenRedirect,this.config,s,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async initiateAuthRequest(e,n){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const r={apiId:Cn.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},i=n||this.config.auth.onRedirectNavigate;if(typeof i=="function")if(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),i(e)!==!1){this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),await this.navigationClient.navigateExternal(e,r);return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation");return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),await this.navigationClient.navigateExternal(e,r);return}}else throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),Ge(R0)}async logout(e){var i;this.logger.verbose("logoutRedirect called");const n=this.initializeLogoutRequest(e),r=this.initializeServerTelemetryManager(Cn.logout);try{this.eventHandler.emitEvent(Qe.LOGOUT_START,xt.Redirect,e),await this.clearCacheOnLogout(this.correlationId,n.account);const o={apiId:Cn.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},s=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:e&&e.authority,requestExtraQueryParameters:e==null?void 0:e.extraQueryParameters,account:e&&e.account||void 0});if(s.authority.protocolMode===Di.OIDC)try{s.authority.endSessionEndpoint}catch{if((i=n.account)!=null&&i.homeAccountId){this.eventHandler.emitEvent(Qe.LOGOUT_SUCCESS,xt.Redirect,n);return}}const c=s.getLogoutUri(n);if(this.eventHandler.emitEvent(Qe.LOGOUT_SUCCESS,xt.Redirect,n),e&&typeof e.onRedirectNavigate=="function")if(e.onRedirectNavigate(c)!==!1){this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0,lc.SIGNOUT),await this.navigationClient.navigateExternal(c,o);return}else this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");else{this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0,lc.SIGNOUT),await this.navigationClient.navigateExternal(c,o);return}}catch(o){throw o instanceof _n&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),this.eventHandler.emitEvent(Qe.LOGOUT_FAILURE,xt.Redirect,null,o),this.eventHandler.emitEvent(Qe.LOGOUT_END,xt.Redirect),o}this.eventHandler.emitEvent(Qe.LOGOUT_END,xt.Redirect)}getRedirectStartPage(e){const n=e||window.location.href;return tn.getAbsoluteUrl(n,xa())}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function Aie(t,e,n,r,i){if(e.addQueueMeasurement(K.SilentHandlerInitiateAuthRequest,r),!t)throw n.info("Navigate url is empty"),Ge(R0);return i?fe(Tie,K.SilentHandlerLoadFrame,n,e,r)(t,i,e,r):Zi(Nie,K.SilentHandlerLoadFrameSync,n,e,r)(t)}async function jie(t,e,n,r,i){const o=F0();if(!o.contentDocument)throw"No document associated with iframe!";return(await KT(o.contentDocument,t,e,n,r,i)).submit(),o}async function Eie(t,e,n,r,i){const o=F0();if(!o.contentDocument)throw"No document associated with iframe!";return(await VT(o.contentDocument,t,e,n,r,i)).submit(),o}async function YI(t,e,n,r,i,o,s){return r.addQueueMeasurement(K.SilentHandlerMonitorIframeForHash,o),new Promise((c,l)=>{e{window.clearInterval(d),l(Ge(sU))},e),d=window.setInterval(()=>{let f="";const h=t.contentWindow;try{f=h?h.location.href:""}catch{}if(!f||f==="about:blank")return;let p="";h&&(s===_0.QUERY?p=h.location.search:p=h.location.hash),window.clearTimeout(u),window.clearInterval(d),c(p)},n)}).finally(()=>{Zi(Pie,K.RemoveHiddenIframe,i,r,o)(t)})}function Tie(t,e,n,r){return n.addQueueMeasurement(K.SilentHandlerLoadFrame,r),new Promise((i,o)=>{const s=F0();window.setTimeout(()=>{if(!s){o("Unable to load iframe");return}s.src=t,i(s)},e)})}function Nie(t){const e=F0();return e.src=t,e}function F0(){const t=document.createElement("iframe");return t.className="msalSilentIframe",t.style.visibility="hidden",t.style.position="absolute",t.style.width=t.style.height="0",t.style.border="0",t.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(t),t}function Pie(t){document.body===t.parentNode&&document.body.removeChild(t)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class kie extends Vf{constructor(e,n,r,i,o,s,c,l,u,d,f){super(e,n,r,i,o,s,l,d,f),this.apiId=c,this.nativeStorage=u}async acquireToken(e){this.performanceClient.addQueueMeasurement(K.SilentIframeClientAcquireToken,e.correlationId),!e.loginHint&&!e.sid&&(!e.account||!e.account.username)&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");const n={...e};n.prompt?n.prompt!==pi.NONE&&n.prompt!==pi.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${n.prompt} with ${pi.NONE}`),n.prompt=pi.NONE):n.prompt=pi.NONE;const r=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(n,xt.Silent);return r.platformBroker=nm(this.config,this.logger,this.platformAuthProvider,r.authenticationScheme),LU(r.authority),this.config.auth.protocolMode===Di.EAR?this.executeEarFlow(r):this.executeCodeFlow(r)}async executeCodeFlow(e){let n;const r=this.initializeServerTelemetryManager(this.apiId);try{return n=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),await fe(this.silentTokenHelper.bind(this),K.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(n,e)}catch(i){if(i instanceof _n&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),!n||!(i instanceof _n)||i.errorCode!==Ti.INVALID_GRANT_ERROR)throw i;return this.performanceClient.addFields({retryError:i.errorCode},this.correlationId),await fe(this.silentTokenHelper.bind(this),K.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(n,e)}}async executeEarFlow(e){const n=e.correlationId,r=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await fe(DT,K.GenerateEarKey,this.logger,this.performanceClient,n)(),o={...e,earJwk:i},s=await fe(Eie,K.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,n)(this.config,r,o,this.logger,this.performanceClient),c=this.config.auth.OIDCOptions.serverResponseType,l=await fe(YI,K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,n)(s,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,n,c),u=Zi(hp,K.DeserializeResponse,this.logger,this.performanceClient,n)(l,c,this.logger);return fe(WT,K.HandleResponseEar,this.logger,this.performanceClient,n)(o,u,this.apiId,this.config,r,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}logout(){return Promise.reject(Ge(M0))}async silentTokenHelper(e,n){const r=n.correlationId;this.performanceClient.addQueueMeasurement(K.SilentIframeClientTokenHelper,r);const i=await fe(L0,K.GeneratePkceCodes,this.logger,this.performanceClient,r)(this.performanceClient,this.logger,r),o={...n,codeChallenge:i.challenge};let s;if(n.httpMethod===Ol.POST)s=await fe(jie,K.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(this.config,e.authority,o,this.logger,this.performanceClient);else{const d=await fe(GT,K.GetAuthCodeUrl,this.logger,this.performanceClient,r)(this.config,e.authority,o,this.logger,this.performanceClient);s=await fe(Aie,K.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(d,this.performanceClient,this.logger,r,this.config.system.navigateFrameWait)}const c=this.config.auth.OIDCOptions.serverResponseType,l=await fe(YI,K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(s,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,r,c),u=Zi(hp,K.DeserializeResponse,this.logger,this.performanceClient,r)(l,c,this.logger);return fe(px,K.HandleResponseCode,this.logger,this.performanceClient,r)(n,u,i.verifier,this.apiId,this.config,e,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Oie extends Vf{async acquireToken(e){this.performanceClient.addQueueMeasurement(K.SilentRefreshClientAcquireToken,e.correlationId);const n=await fe(HT,K.InitializeBaseRequest,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),r={...e,...n};e.redirectUri&&(r.redirectUri=this.getRedirectUri(e.redirectUri));const i=this.initializeServerTelemetryManager(Cn.acquireTokenSilent_silentFlow),o=await this.createRefreshTokenClient({serverTelemetryManager:i,authorityUrl:r.authority,azureCloudOptions:r.azureCloudOptions,account:r.account});return fe(o.acquireTokenByRefreshToken.bind(o),K.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(r).catch(s=>{throw s.setCorrelationId(this.correlationId),i.cacheFailedRequest(s),s})}logout(){return Promise.reject(Ge(M0))}async createRefreshTokenClient(e){const n=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new Kne(n,this.performanceClient)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Iie{constructor(e,n,r,i){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=n,this.logger=r,this.cryptoObj=i}async loadExternalTokens(e,n,r){if(!this.isBrowserEnvironment)throw Ge(D0);const i=e.correlationId||us(),o=n.id_token?Hf(n.id_token,Zo):void 0,s={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},c=e.authority?new Zr(Zr.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,s,this.logger,e.correlationId||us()):void 0,l=await this.loadAccount(e,r.clientInfo||n.client_info||"",i,o,c),u=await this.loadIdToken(n,l.homeAccountId,l.environment,l.realm,i),d=await this.loadAccessToken(e,n,l.homeAccountId,l.environment,l.realm,r,i),f=await this.loadRefreshToken(n,l.homeAccountId,l.environment,i);return this.generateAuthenticationResult(e,{account:l,idToken:u,accessToken:d,refreshToken:f},o,c)}async loadAccount(e,n,r,i,o){if(this.logger.verbose("TokenCache - loading account"),e.account){const u=cs.createFromAccountInfo(e.account);return await this.storage.setAccount(u,r),u}else if(!o||!n&&!i)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),Ge(mU);const s=cs.generateHomeAccountId(n,o.authorityType,this.logger,this.cryptoObj,i),c=i==null?void 0:i.tid,l=ST(this.storage,o,s,Zo,r,i,n,o.hostnameAndPort,c,void 0,void 0,this.logger);return await this.storage.setAccount(l,r),l}async loadIdToken(e,n,r,i,o){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const s=N0(n,r,e.id_token,this.config.auth.clientId,i);return await this.storage.setIdTokenCredential(s,o),s}async loadAccessToken(e,n,r,i,o,s,c){if(n.access_token)if(n.expires_in){if(!n.scope&&(!e.scopes||!e.scopes.length))return this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache."),null}else return this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache."),null;else return this.logger.verbose("TokenCache - no access token found in response"),null;this.logger.verbose("TokenCache - loading access token");const l=n.scope?Ar.fromString(n.scope):new Ar(e.scopes),u=s.expiresOn||n.expires_in+$i(),d=s.extendedExpiresOn||(n.ext_expires_in||n.expires_in)+$i(),f=P0(r,i,n.access_token,this.config.auth.clientId,o,l.printScopes(),u,d,Zo);return await this.storage.setAccessTokenCredential(f,c),f}async loadRefreshToken(e,n,r,i){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const o=BB(n,r,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return await this.storage.setRefreshTokenCredential(o,i),o}generateAuthenticationResult(e,n,r,i){var d,f,h;let o="",s=[],c=null,l;n!=null&&n.accessToken&&(o=n.accessToken.secret,s=Ar.fromString(n.accessToken.target).asArray(),c=_d(n.accessToken.expiresOn),l=_d(n.accessToken.extendedExpiresOn));const u=n.account;return{authority:i?i.canonicalAuthority:"",uniqueId:n.account.localAccountId,tenantId:n.account.realm,scopes:s,account:u.getAccountInfo(),idToken:((d=n.idToken)==null?void 0:d.secret)||"",idTokenClaims:r||{},accessToken:o,fromCache:!0,expiresOn:c,correlationId:e.correlationId||"",requestId:"",extExpiresOn:l,familyId:((f=n.refreshToken)==null?void 0:f.familyId)||"",tokenType:((h=n==null?void 0:n.accessToken)==null?void 0:h.tokenType)||"",state:e.state||"",cloudGraphHostName:u.cloudGraphHostName||"",msGraphHost:u.msGraphHost||"",fromNativeBroker:!1}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Rie extends WB{constructor(e){super(e),this.includeRedirectUri=!1}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Mie extends Vf{constructor(e,n,r,i,o,s,c,l,u,d){super(e,n,r,i,o,s,l,u,d),this.apiId=c}async acquireToken(e){if(!e.code)throw Ge(gU);const n=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,xt.Silent),r=this.initializeServerTelemetryManager(this.apiId);try{const i={...n,code:e.code},o=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account}),s=new Rie(o);this.logger.verbose("Auth code client created");const c=new zU(s,this.browserStorage,i,this.logger,this.performanceClient);return await fe(c.handleCodeResponseFromServer.bind(c),K.HandleCodeResponseFromServer,this.logger,this.performanceClient,e.correlationId)({code:e.code,msgraph_host:e.msGraphHost,cloud_graph_host_name:e.cloudGraphHostName,cloud_instance_host_name:e.cloudInstanceHostName},n,!1)}catch(i){throw i instanceof _n&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),i}}logout(){return Promise.reject(Ge(M0))}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Die(t,e,n){var s;const r=((s=window.msal)==null?void 0:s.clientIds)||[],i=r.length,o=r.filter(c=>c===t).length;o>1&&n.warning("There is already an instance of MSAL.js in the window with the same client id."),e.add({msalInstanceCount:i,sameClientIdInstanceCount:o})}/*! @azure/msal-browser v4.19.0 2025-08-05 */function xs(t){const e=t==null?void 0:t.idTokenClaims;if(e!=null&&e.tfp||e!=null&&e.acr)return"B2C";if(e!=null&&e.tid){if((e==null?void 0:e.tid)==="9188040d-6c67-4c5b-b112-36a304b66dad")return"MSA"}else return;return"AAD"}function mv(t,e){try{FT(t)}catch(n){throw e.end({success:!1},n),n}}class B0{constructor(e){this.operatingContext=e,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=e.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.config.telemetry.client,this.browserCrypto=this.isBrowserEnvironment?new $a(this.logger,this.performanceClient):Jy,this.eventHandler=new rie(this.logger),this.browserStorage=this.isBrowserEnvironment?new hA(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler,$ne(this.config.auth)):qre(this.config.auth.clientId,this.logger,this.performanceClient,this.eventHandler);const n={cacheLocation:jr.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:jr.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new hA(this.config.auth.clientId,n,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler),this.tokenCache=new Iie(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this)}static async createController(e,n){const r=new B0(e);return await r.initialize(n),r}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e,n){if(this.logger.trace("initialize called"),this.initialized){this.logger.info("initialize has already been called, exiting early.");return}if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, exiting early."),this.initialized=!0,this.eventHandler.emitEvent(Qe.INITIALIZE_END);return}const r=(e==null?void 0:e.correlationId)||this.getRequestCorrelationId(),i=this.config.system.allowPlatformBroker,o=this.performanceClient.startMeasurement(K.InitializeClientApplication,r);if(this.eventHandler.emitEvent(Qe.INITIALIZE_START),!n)try{this.logMultipleInstances(o)}catch{}if(await fe(this.browserStorage.initialize.bind(this.browserStorage),K.InitializeCache,this.logger,this.performanceClient,r)(r),i)try{this.platformAuthProvider=await bie(this.logger,this.performanceClient,r,this.config.system.nativeBrokerHandshakeTimeout)}catch(s){this.logger.verbose(s)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),Zi(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),K.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,r)(r)),this.config.system.asyncPopups&&await this.preGeneratePkceCodes(r),this.initialized=!0,this.eventHandler.emitEvent(Qe.INITIALIZE_END),o.end({allowPlatformBroker:i,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),$U(this.initialized),this.isBrowserEnvironment){const n=e||"";let r=this.redirectResponse.get(n);return typeof r>"u"?(r=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(n,r),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise")):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),r}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async handleRedirectPromiseInternal(e){var l;if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;if(((l=this.browserStorage.getInteractionInProgress())==null?void 0:l.type)===lc.SIGNOUT)return this.logger.verbose("handleRedirectPromise removing interaction_in_progress flag and returning null after sign-out"),this.browserStorage.setInteractionInProgress(!1),Promise.resolve(null);const r=this.getAllAccounts(),i=this.browserStorage.getCachedNativeRequest(),o=i&&this.platformAuthProvider&&!e;let s;this.eventHandler.emitEvent(Qe.HANDLE_REDIRECT_START,xt.Redirect);let c;try{if(o&&this.platformAuthProvider){s=this.performanceClient.startMeasurement(K.AcquireTokenRedirect,(i==null?void 0:i.correlationId)||""),this.logger.trace("handleRedirectPromise - acquiring token from native platform");const u=new ry(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Cn.handleRedirectPromise,this.performanceClient,this.platformAuthProvider,i.accountId,this.nativeInternalStorage,i.correlationId);c=fe(u.handleRedirectPromise.bind(u),K.HandleNativeRedirectPromiseMeasurement,this.logger,this.performanceClient,s.event.correlationId)(this.performanceClient,s.event.correlationId)}else{const[u,d]=this.browserStorage.getCachedRequest(),f=u.correlationId;s=this.performanceClient.startMeasurement(K.AcquireTokenRedirect,f),this.logger.trace("handleRedirectPromise - acquiring token from web flow");const h=this.createRedirectClient(f);c=fe(h.handleRedirectPromise.bind(h),K.HandleRedirectPromiseMeasurement,this.logger,this.performanceClient,s.event.correlationId)(e,u,d,s)}}catch(u){throw this.browserStorage.resetRequestCache(),u}return c.then(u=>(u?(this.browserStorage.resetRequestCache(),r.length{this.browserStorage.resetRequestCache();const d=u;throw r.length>0?this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_FAILURE,xt.Redirect,null,d):this.eventHandler.emitEvent(Qe.LOGIN_FAILURE,xt.Redirect,null,d),this.eventHandler.emitEvent(Qe.HANDLE_REDIRECT_END,xt.Redirect),s.end({success:!1},d),u})}async acquireTokenRedirect(e){const n=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",n);const r=this.performanceClient.startMeasurement(K.AcquireTokenPreRedirect,n);r.add({accountType:xs(e.account),scenarioId:e.scenarioId});const i=e.onRedirectNavigate;if(i)e.onRedirectNavigate=s=>{const c=typeof i=="function"?i(s):void 0;return c!==!1?r.end({success:!0}):r.discard(),c};else{const s=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=c=>{const l=typeof s=="function"?s(c):void 0;return l!==!1?r.end({success:!0}):r.discard(),l}}const o=this.getAllAccounts().length>0;try{FI(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,lc.SIGNIN),o?this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_START,xt.Redirect,e):this.eventHandler.emitEvent(Qe.LOGIN_START,xt.Redirect,e);let s;return this.platformAuthProvider&&this.canUsePlatformBroker(e)?s=new ry(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Cn.acquireTokenRedirect,this.performanceClient,this.platformAuthProvider,this.getNativeAccountId(e),this.nativeInternalStorage,n).acquireTokenRedirect(e,r).catch(l=>{if(l instanceof Ns&&qu(l))return this.platformAuthProvider=void 0,this.createRedirectClient(n).acquireToken(e);if(l instanceof ls)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(n).acquireToken(e);throw l}):s=this.createRedirectClient(n).acquireToken(e),await s}catch(s){throw this.browserStorage.resetRequestCache(),r.end({success:!1},s),o?this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_FAILURE,xt.Redirect,null,s):this.eventHandler.emitEvent(Qe.LOGIN_FAILURE,xt.Redirect,null,s),s}}acquireTokenPopup(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(K.AcquireTokenPopup,n);r.add({scenarioId:e.scenarioId,accountType:xs(e.account)});try{this.logger.verbose("acquireTokenPopup called",n),mv(this.initialized,r),this.browserStorage.setInteractionInProgress(!0,lc.SIGNIN)}catch(c){return Promise.reject(c)}const i=this.getAllAccounts();i.length>0?this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_START,xt.Popup,e):this.eventHandler.emitEvent(Qe.LOGIN_START,xt.Popup,e);let o;const s=this.getPreGeneratedPkceCodes(n);return this.canUsePlatformBroker(e)?o=this.acquireTokenNative({...e,correlationId:n},Cn.acquireTokenPopup).then(c=>(r.end({success:!0,isNativeBroker:!0,accountType:xs(c.account)}),c)).catch(c=>{if(c instanceof Ns&&qu(c))return this.platformAuthProvider=void 0,this.createPopupClient(n).acquireToken(e,s);if(c instanceof ls)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(n).acquireToken(e,s);throw c}):o=this.createPopupClient(n).acquireToken(e,s),o.then(c=>(i.length(i.length>0?this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_FAILURE,xt.Popup,null,c):this.eventHandler.emitEvent(Qe.LOGIN_FAILURE,xt.Popup,null,c),r.end({success:!1},c),Promise.reject(c))).finally(async()=>{this.browserStorage.setInteractionInProgress(!1),this.config.system.asyncPopups&&await this.preGeneratePkceCodes(n)})}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(e){var o,s;const n=this.getRequestCorrelationId(e),r={...e,prompt:e.prompt,correlationId:n};this.ssoSilentMeasurement=this.performanceClient.startMeasurement(K.SsoSilent,n),(o=this.ssoSilentMeasurement)==null||o.add({scenarioId:e.scenarioId,accountType:xs(e.account)}),mv(this.initialized,this.ssoSilentMeasurement),(s=this.ssoSilentMeasurement)==null||s.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",n),this.eventHandler.emitEvent(Qe.SSO_SILENT_START,xt.Silent,r);let i;return this.canUsePlatformBroker(r)?i=this.acquireTokenNative(r,Cn.ssoSilent).catch(c=>{if(c instanceof Ns&&qu(c))return this.platformAuthProvider=void 0,this.createSilentIframeClient(r.correlationId).acquireToken(r);throw c}):i=this.createSilentIframeClient(r.correlationId).acquireToken(r),i.then(c=>{var l;return this.eventHandler.emitEvent(Qe.SSO_SILENT_SUCCESS,xt.Silent,c),(l=this.ssoSilentMeasurement)==null||l.end({success:!0,isNativeBroker:c.fromNativeBroker,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:xs(c.account)}),c}).catch(c=>{var l;throw this.eventHandler.emitEvent(Qe.SSO_SILENT_FAILURE,xt.Silent,null,c),(l=this.ssoSilentMeasurement)==null||l.end({success:!1},c),c}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const n=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",n);const r=this.performanceClient.startMeasurement(K.AcquireTokenByCode,n);mv(this.initialized,r),this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_BY_CODE_START,xt.Silent,e),r.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw Ge(yU);if(e.code){const i=e.code;let o=this.hybridAuthCodeResponses.get(i);return o?(this.logger.verbose("Existing acquireTokenByCode request found",n),r.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",n),o=this.acquireTokenByCodeAsync({...e,correlationId:n}).then(s=>(this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_BY_CODE_SUCCESS,xt.Silent,s),this.hybridAuthCodeResponses.delete(i),r.end({success:!0,isNativeBroker:s.fromNativeBroker,accessTokenSize:s.accessToken.length,idTokenSize:s.idToken.length,accountType:xs(s.account)}),s)).catch(s=>{throw this.hybridAuthCodeResponses.delete(i),this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_BY_CODE_FAILURE,xt.Silent,null,s),r.end({success:!1},s),s}),this.hybridAuthCodeResponses.set(i,o)),await o}else if(e.nativeAccountId)if(this.canUsePlatformBroker(e,e.nativeAccountId)){const i=await this.acquireTokenNative({...e,correlationId:n},Cn.acquireTokenByCode,e.nativeAccountId).catch(o=>{throw o instanceof Ns&&qu(o)&&(this.platformAuthProvider=void 0),o});return r.end({accountType:xs(i.account),success:!0}),i}else throw Ge(xU);else throw Ge(vU)}catch(i){throw this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_BY_CODE_FAILURE,xt.Silent,null,i),r.end({success:!1},i),i}}async acquireTokenByCodeAsync(e){var i;return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(K.AcquireTokenByCodeAsync,e.correlationId),(i=this.acquireTokenByCodeAsyncMeasurement)==null||i.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),await this.createSilentAuthCodeClient(e.correlationId).acquireToken(e).then(o=>{var s;return(s=this.acquireTokenByCodeAsyncMeasurement)==null||s.end({success:!0,fromCache:o.fromCache,isNativeBroker:o.fromNativeBroker}),o}).catch(o=>{var s;throw(s=this.acquireTokenByCodeAsyncMeasurement)==null||s.end({success:!1},o),o}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,n){switch(this.performanceClient.addQueueMeasurement(K.AcquireTokenFromCache,e.correlationId),n){case ci.Default:case ci.AccessToken:case ci.AccessTokenAndRefreshToken:const r=this.createSilentCacheClient(e.correlationId);return fe(r.acquireToken.bind(r),K.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw we(Rc)}}async acquireTokenByRefreshToken(e,n){switch(this.performanceClient.addQueueMeasurement(K.AcquireTokenByRefreshToken,e.correlationId),n){case ci.Default:case ci.AccessTokenAndRefreshToken:case ci.RefreshToken:case ci.RefreshTokenAndNetwork:const r=this.createSilentRefreshClient(e.correlationId);return fe(r.acquireToken.bind(r),K.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw we(Rc)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(K.AcquireTokenBySilentIframe,e.correlationId);const n=this.createSilentIframeClient(e.correlationId);return fe(n.acquireToken.bind(n),K.SilentIframeClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const n=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",n),this.logoutRedirect({correlationId:n,...e})}async logoutRedirect(e){const n=this.getRequestCorrelationId(e);return FI(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,lc.SIGNOUT),this.createRedirectClient(n).logout(e)}logoutPopup(e){try{const n=this.getRequestCorrelationId(e);return FT(this.initialized),this.browserStorage.setInteractionInProgress(!0,lc.SIGNOUT),this.createPopupClient(n).logout(e).finally(()=>{this.browserStorage.setInteractionInProgress(!1)})}catch(n){return Promise.reject(n)}}async clearCache(e){if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, returning early.");return}const n=this.getRequestCorrelationId(e);return this.createSilentCacheClient(n).logout(e)}getAllAccounts(e){const n=this.getRequestCorrelationId();return Yre(this.logger,this.browserStorage,this.isBrowserEnvironment,n,e)}getAccount(e){const n=this.getRequestCorrelationId();return Qre(e,this.logger,this.browserStorage,n)}getAccountByUsername(e){const n=this.getRequestCorrelationId();return Xre(e,this.logger,this.browserStorage,n)}getAccountByHomeId(e){const n=this.getRequestCorrelationId();return Jre(e,this.logger,this.browserStorage,n)}getAccountByLocalId(e){const n=this.getRequestCorrelationId();return Zre(e,this.logger,this.browserStorage,n)}setActiveAccount(e){const n=this.getRequestCorrelationId();eie(e,this.browserStorage,n)}getActiveAccount(){const e=this.getRequestCorrelationId();return tie(this.browserStorage,e)}async hydrateCache(e,n){this.logger.verbose("hydrateCache called");const r=cs.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return await this.browserStorage.setAccount(r,e.correlationId),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,n)):this.browserStorage.hydrateCache(e,n)}async acquireTokenNative(e,n,r,i){if(this.logger.trace("acquireTokenNative called"),!this.platformAuthProvider)throw Ge(kT);return new ry(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,n,this.performanceClient,this.platformAuthProvider,r||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e,i)}canUsePlatformBroker(e,n){if(this.logger.trace("canUsePlatformBroker called"),!this.platformAuthProvider)return this.logger.trace("canUsePlatformBroker: platform broker unavilable, returning false"),!1;if(!nm(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme))return this.logger.trace("canUsePlatformBroker: isBrokerAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case pi.NONE:case pi.CONSENT:case pi.LOGIN:this.logger.trace("canUsePlatformBroker: prompt is compatible with platform broker flow");break;default:return this.logger.trace(`canUsePlatformBroker: prompt = ${e.prompt} is not compatible with platform broker flow, returning false`),!1}return!n&&!this.getNativeAccountId(e)?(this.logger.trace("canUsePlatformBroker: nativeAccountId is not available, returning false"),!1):!0}getNativeAccountId(e){const n=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return n&&n.nativeAccountId||""}createPopupClient(e){return new Sie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createRedirectClient(e){return new _ie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentIframeClient(e){return new kie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Cn.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentCacheClient(e){return new VU(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentRefreshClient(e){return new Oie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentAuthCodeClient(e){return new Mie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Cn.acquireTokenByCode,this.performanceClient,this.platformAuthProvider,e)}addEventCallback(e,n){return this.eventHandler.addEventCallback(e,n)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return DU(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){if(this.config.cache.cacheLocation!==jr.LocalStorage){this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");return}this.eventHandler.subscribeCrossTab()}disableAccountStorageEvents(){if(this.config.cache.cacheLocation!==jr.LocalStorage){this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");return}this.eventHandler.unsubscribeCrossTab()}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,n){this.browserStorage.setWrapperMetadata(e,n)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?us():pe.EMPTY_STRING}async loginRedirect(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",n),this.acquireTokenRedirect({correlationId:n,...e||RI})}loginPopup(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",n),this.acquireTokenPopup({correlationId:n,...e||RI})}async acquireTokenSilent(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(K.AcquireTokenSilent,n);r.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),mv(this.initialized,r),this.logger.verbose("acquireTokenSilent called",n);const i=e.account||this.getActiveAccount();if(!i)throw Ge(uU);return r.add({accountType:xs(i)}),this.acquireTokenSilentDeduped(e,i,n).then(o=>(r.end({success:!0,fromCache:o.fromCache,isNativeBroker:o.fromNativeBroker,accessTokenSize:o.accessToken.length,idTokenSize:o.idToken.length}),{...o,state:e.state,correlationId:n})).catch(o=>{throw o instanceof _n&&o.setCorrelationId(n),r.end({success:!1},o),o})}async acquireTokenSilentDeduped(e,n,r){const i=k0(this.config.auth.clientId,{...e,authority:e.authority||this.config.auth.authority,correlationId:r},n.homeAccountId),o=JSON.stringify(i),s=this.activeSilentTokenRequests.get(o);if(typeof s>"u"){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",r),this.performanceClient.addFields({deduped:!1},r);const c=fe(this.acquireTokenSilentAsync.bind(this),K.AcquireTokenSilentAsync,this.logger,this.performanceClient,r)({...e,correlationId:r},n);return this.activeSilentTokenRequests.set(o,c),c.finally(()=>{this.activeSilentTokenRequests.delete(o)})}else return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",r),this.performanceClient.addFields({deduped:!0},r),s}async acquireTokenSilentAsync(e,n){const r=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(K.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_START,xt.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",r);const i=await fe(iie,K.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,n,this.config,this.performanceClient,this.logger),o=e.cacheLookupPolicy||ci.Default;return this.acquireTokenSilentNoIframe(i,o).catch(async c=>{if($ie(c,o))if(this.activeIframeRequest)if(o!==ci.Skip){const[u,d]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${d}`,i.correlationId);const f=this.performanceClient.startMeasurement(K.AwaitConcurrentIframe,i.correlationId);f.add({awaitIframeCorrelationId:d});const h=await u;if(f.end({success:h}),h)return this.logger.verbose(`Parallel iframe request with correlationId: ${d} succeeded. Retrying cache and/or RT redemption`,i.correlationId),this.acquireTokenSilentNoIframe(i,o);throw this.logger.info(`Iframe request with correlationId: ${d} failed. Interaction is required.`),c}else return this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",i.correlationId),fe(this.acquireTokenBySilentIframe.bind(this),K.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i);else{let u;return this.activeIframeRequest=[new Promise(d=>{u=d}),i.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",i.correlationId),fe(this.acquireTokenBySilentIframe.bind(this),K.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i).then(d=>(u(!0),d)).catch(d=>{throw u(!1),d}).finally(()=>{this.activeIframeRequest=void 0})}else throw c}).then(c=>(this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_SUCCESS,xt.Silent,c),e.correlationId&&this.performanceClient.addFields({fromCache:c.fromCache,isNativeBroker:c.fromNativeBroker},e.correlationId),c)).catch(c=>{throw this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_FAILURE,xt.Silent,null,c),c}).finally(()=>{document.removeEventListener("visibilitychange",r)})}async acquireTokenSilentNoIframe(e,n){return nm(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,Cn.acquireTokenSilent_silentFlow,e.account.nativeAccountId,n).catch(async r=>{throw r instanceof Ns&&qu(r)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.platformAuthProvider=void 0,we(Rc)):r})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),n===ci.AccessToken&&this.logger.verbose("acquireTokenSilent - cache lookup policy set to AccessToken, attempting to acquire token from local cache"),fe(this.acquireTokenFromCache.bind(this),K.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,n).catch(r=>{if(n===ci.AccessToken)throw r;return this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_NETWORK_START,xt.Silent,e),fe(this.acquireTokenByRefreshToken.bind(this),K.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,n)}))}async preGeneratePkceCodes(e){return this.logger.verbose("Generating new PKCE codes"),this.pkceCode=await fe(L0,K.GeneratePkceCodes,this.logger,this.performanceClient,e)(this.performanceClient,this.logger,e),Promise.resolve()}getPreGeneratedPkceCodes(e){this.logger.verbose("Attempting to pick up pre-generated PKCE codes");const n=this.pkceCode?{...this.pkceCode}:void 0;return this.pkceCode=void 0,this.logger.verbose(`${n?"Found":"Did not find"} pre-generated PKCE codes`),this.performanceClient.addFields({usePreGeneratedPkce:!!n},e),n}logMultipleInstances(e){const n=this.config.auth.clientId;if(!window)return;window.msal=window.msal||{},window.msal.clientIds=window.msal.clientIds||[],window.msal.clientIds.length>0&&this.logger.verbose("There is already an instance of MSAL.js in the window."),window.msal.clientIds.push(n),Die(n,e,this.logger)}}function $ie(t,e){const n=!(t instanceof ls&&t.subError!==I0),r=t.errorCode===Ti.INVALID_GRANT_ERROR||t.errorCode===Rc,i=n&&r||t.errorCode===ax||t.errorCode===bT,o=fre.includes(e);return i&&o}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function Lie(t,e){const n=new mu(t);return await n.initialize(),B0.createController(n,e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class YT{static async createPublicClientApplication(e){const n=await Lie(e);return new YT(e,n)}constructor(e,n){this.isBroker=!1,this.controller=n||new B0(new mu(e))}async initialize(e){return this.controller.initialize(e,this.isBroker)}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e,n){return this.controller.addEventCallback(e,n)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccount(e){return this.controller.getAccount(e)}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(e){return this.controller.getAllAccounts(e)}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,n){return this.controller.initializeWrapperLibrary(e,n)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,n){return this.controller.hydrateCache(e,n)}clearCache(e){return this.controller.clearCache(e)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Fie={initialize:()=>Promise.reject(lr(cr)),acquireTokenPopup:()=>Promise.reject(lr(cr)),acquireTokenRedirect:()=>Promise.reject(lr(cr)),acquireTokenSilent:()=>Promise.reject(lr(cr)),acquireTokenByCode:()=>Promise.reject(lr(cr)),getAllAccounts:()=>[],getAccount:()=>null,getAccountByHomeId:()=>null,getAccountByUsername:()=>null,getAccountByLocalId:()=>null,handleRedirectPromise:()=>Promise.reject(lr(cr)),loginPopup:()=>Promise.reject(lr(cr)),loginRedirect:()=>Promise.reject(lr(cr)),logout:()=>Promise.reject(lr(cr)),logoutRedirect:()=>Promise.reject(lr(cr)),logoutPopup:()=>Promise.reject(lr(cr)),ssoSilent:()=>Promise.reject(lr(cr)),addEventCallback:()=>null,removeEventCallback:()=>{},addPerformanceCallback:()=>"",removePerformanceCallback:()=>!1,enableAccountStorageEvents:()=>{},disableAccountStorageEvents:()=>{},getTokenCache:()=>{throw lr(cr)},getLogger:()=>{throw lr(cr)},setLogger:()=>{},setActiveAccount:()=>{},getActiveAccount:()=>null,initializeWrapperLibrary:()=>{},setNavigationClient:()=>{},getConfiguration:()=>{throw lr(cr)},hydrateCache:()=>Promise.reject(lr(cr)),clearCache:()=>Promise.reject(lr(cr))};/*! @azure/msal-browser v4.19.0 2025-08-05 */class Bie{static getInteractionStatusFromEvent(e,n){switch(e.eventType){case Qe.LOGIN_START:return xr.Login;case Qe.SSO_SILENT_START:return xr.SsoSilent;case Qe.ACQUIRE_TOKEN_START:if(e.interactionType===xt.Redirect||e.interactionType===xt.Popup)return xr.AcquireToken;break;case Qe.HANDLE_REDIRECT_START:return xr.HandleRedirect;case Qe.LOGOUT_START:return xr.Logout;case Qe.SSO_SILENT_SUCCESS:case Qe.SSO_SILENT_FAILURE:if(n&&n!==xr.SsoSilent)break;return xr.None;case Qe.LOGOUT_END:if(n&&n!==xr.Logout)break;return xr.None;case Qe.HANDLE_REDIRECT_END:if(n&&n!==xr.HandleRedirect)break;return xr.None;case Qe.LOGIN_SUCCESS:case Qe.LOGIN_FAILURE:case Qe.ACQUIRE_TOKEN_SUCCESS:case Qe.ACQUIRE_TOKEN_FAILURE:case Qe.RESTORE_FROM_BFCACHE:if(e.interactionType===xt.Redirect||e.interactionType===xt.Popup){if(n&&n!==xr.Login&&n!==xr.AcquireToken)break;return xr.None}break}return null}}const Uie="modulepreload",Hie=function(t){return"/semblance/"+t},QI={},zie=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),c=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=Hie(l),l in QI)return;QI[l]=!0;const u=l.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":Uie,u||(f.as="script"),f.crossOrigin="",f.href=l,c&&f.setAttribute("nonce",c),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(s){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=s,window.dispatchEvent(c),!c.defaultPrevented)throw s}return i.then(s=>{for(const c of s||[])c.status==="rejected"&&o(c.reason);return e().catch(o)})};/*! @azure/msal-react v3.0.17 2025-08-05 */const Gie={instance:Fie,inProgress:xr.None,accounts:[],logger:new Da({})},QT=v.createContext(Gie);QT.Consumer;/*! @azure/msal-react v3.0.17 2025-08-05 */function XI(t,e){if(t.length!==e.length)return!1;const n=[...e];return t.every(r=>{const i=n.shift();return!r||!i?!1:r.homeAccountId===i.homeAccountId&&r.localAccountId===i.localAccountId&&r.username===i.username})}/*! @azure/msal-react v3.0.17 2025-08-05 */const Vie="@azure/msal-react",JI="3.0.17";/*! @azure/msal-react v3.0.17 2025-08-05 */const gx={UNBLOCK_INPROGRESS:"UNBLOCK_INPROGRESS",EVENT:"EVENT"},Kie=(t,e)=>{const{type:n,payload:r}=e;let i=t.inProgress;switch(n){case gx.UNBLOCK_INPROGRESS:t.inProgress===xr.Startup&&(i=xr.None,r.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case gx.EVENT:const s=r.message,c=Bie.getInteractionStatusFromEvent(s,t.inProgress);c&&(r.logger.info(`MsalProvider - ${s.eventType} results in setting inProgress from ${t.inProgress} to ${c}`),i=c);break;default:throw new Error(`Unknown action type: ${n}`)}if(i===xr.Startup)return t;const o=r.instance.getAllAccounts();return i!==t.inProgress&&!XI(o,t.accounts)?{...t,inProgress:i,accounts:o}:i!==t.inProgress?{...t,inProgress:i}:XI(o,t.accounts)?t:{...t,accounts:o}};function Wie({instance:t,children:e}){v.useEffect(()=>{t.initializeWrapperLibrary(lre.React,JI)},[t]);const n=v.useMemo(()=>t.getLogger().clone(Vie,JI),[t]),[r,i]=v.useReducer(Kie,void 0,()=>({inProgress:xr.Startup,accounts:[]}));v.useEffect(()=>{const s=t.addEventCallback(c=>{i({payload:{instance:t,logger:n,message:c},type:gx.EVENT})});return n.verbose(`MsalProvider - Registered event callback with id: ${s}`),t.initialize().then(()=>{t.handleRedirectPromise().catch(()=>{}).finally(()=>{i({payload:{instance:t,logger:n},type:gx.UNBLOCK_INPROGRESS})})}).catch(()=>{}),()=>{s&&(n.verbose(`MsalProvider - Removing event callback ${s}`),t.removeEventCallback(s))}},[t,n]);const o={instance:t,inProgress:r.inProgress,accounts:r.accounts,logger:n};return N.createElement(QT.Provider,{value:o},e)}/*! @azure/msal-react v3.0.17 2025-08-05 */const qie=()=>v.useContext(QT),Yie={auth:{clientId:"7e9b250a-d984-4fba-8e1c-a0622242a595",authority:"https://login.microsoftonline.com/e519c2e6-bc6d-4fdf-8d9c-923c2f002385",redirectUri:"https://ai-sandbox.oliver.solutions/semblance",postLogoutRedirectUri:"https://ai-sandbox.oliver.solutions/semblance"},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:(t,e,n)=>{n||console.log(e)},logLevel:Dn.Verbose,piiLoggingEnabled:!1},allowNativeBroker:!1}},Qie={scopes:["openid","profile","email"],prompt:"select_account",extraQueryParameters:{code_challenge_method:"S256"}},qU=v.createContext(void 0);function Xie({children:t}){const[e,n]=v.useState(null),[r,i]=v.useState(null),[o,s]=v.useState(!0),[c,l]=v.useState(!1),u=ar(),{instance:d,accounts:f,inProgress:h}=qie();v.useEffect(()=>{const w=S=>{const _=S.detail||{};if(_.isPersonaCreation){console.log("Ignoring auth error from persona creation",_);return}i(null),n(null),re.error("Session expired",{description:"Please log in again"}),u("/login")};return window.addEventListener(X_,w),()=>{window.removeEventListener(X_,w)}},[u]),v.useEffect(()=>{const w=localStorage.getItem("auth_token"),S=localStorage.getItem("user");if(console.log("AuthContext initializing - stored data check:",{hasToken:!!w,hasUser:!!S}),w&&S)try{i(w),n(JSON.parse(S)),console.log("User session restored from localStorage")}catch(C){console.error("Failed to parse stored user data:",C),localStorage.removeItem("auth_token"),localStorage.removeItem("user")}else console.log("No stored authentication data found");s(!1)},[]),v.useEffect(()=>{if(r){console.log("Verifying token...");const w=`token_validated_${r.substring(0,10)}`;if(sessionStorage.getItem(w)==="true"&&e){console.log("Token already validated this session, skipping validation");return}ey.getProfile().then(C=>{C&&"data"in C&&(console.log("Profile verified successfully"),n(C.data),sessionStorage.setItem(w,"true"))}).catch(C=>{C.response&&C.response.status===401?(console.error("Token invalid (401):",C),localStorage.removeItem("auth_token"),localStorage.removeItem("user"),i(null),n(null)):(console.warn("Profile validation error (not clearing token):",C),sessionStorage.setItem(w,"true"))})}else console.log("No token available, not validating profile")},[r,e]);const p=async(w,S)=>{var C,_;s(!0),console.log("Attempting login for user:",w);try{const A=await ey.login(w,S);if(console.log("Login API response received"),!A.data.access_token)throw new Error("No access token received from server");return localStorage.setItem("auth_token",A.data.access_token),localStorage.setItem("user",JSON.stringify(A.data.user)),i(A.data.access_token),n(A.data.user),console.log("Authentication state updated"),re.success("Login successful!"),A.data.access_token}catch(A){throw console.error("Login failed:",A),re.error("Login failed",{description:((_=(C=A.response)==null?void 0:C.data)==null?void 0:_.message)||"Invalid username or password"}),A}finally{s(!1)}},g=async()=>{l(!0);try{console.log("Starting Microsoft authentication...");const w=await d.loginPopup(Qie);if(w&&w.account&&w.idToken){console.log("Microsoft authentication successful",w.account);const S=await ey.loginWithMicrosoft(w.idToken);S.data.access_token&&(localStorage.setItem("auth_token",S.data.access_token),localStorage.setItem("user",JSON.stringify(S.data.user)),localStorage.setItem("auth_type","microsoft"),i(S.data.access_token),n(S.data.user),console.log("Microsoft user authenticated and stored"),re.success("Successfully signed in with Microsoft!"))}}catch(w){throw console.error("Microsoft login failed:",w),w.name==="BrowserAuthError"&&w.errorCode==="popup_window_error"?re.error("Sign-in cancelled",{description:"The sign-in popup was closed before completing authentication."}):w.name==="InteractionRequiredAuthError"?re.error("Authentication required",{description:"Please complete the authentication process."}):re.error("Microsoft sign-in failed",{description:w.message||"An error occurred during authentication"}),w}finally{l(!1)}},m=async()=>{const w=localStorage.getItem("auth_type");if(localStorage.removeItem("auth_token"),localStorage.removeItem("user"),localStorage.removeItem("auth_type"),i(null),n(null),w==="microsoft"&&f.length>0)try{await d.logoutPopup({account:f[0],postLogoutRedirectUri:window.location.origin+"/semblance/"})}catch(S){console.error("Microsoft logout error:",S)}re.info("You have been logged out")},y=!!localStorage.getItem("auth_token"),x={user:e,token:r,isLoading:o,login:p,loginWithMicrosoft:g,logout:m,isAuthenticated:!!r||y,isMsalLoading:c};return a.jsx(qU.Provider,{value:x,children:t})}function Xs(){const t=v.useContext(qU);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}function Aa(){const[t,e]=v.useState(!1),n=Fi(),r=ar(),{isAuthenticated:i,logout:o}=Xs(),s=[{name:"Home",href:"/",icon:Vy},{name:"Synthetic Personas",href:"/synthetic-users",icon:Dr},{name:"Focus Groups",href:"/focus-groups",icon:Vs},{name:"Dashboard",href:"/dashboard",icon:G_}],c=()=>{e(!t)},l=d=>n.pathname===d,u=d=>{if(d==="/synthetic-users"){const f=new CustomEvent("syntheticUsersNavigation");window.dispatchEvent(f)}r(d)};return a.jsxs("header",{className:"fixed top-0 left-0 right-0 z-50 bg-white/80 backdrop-blur-md border-b border-slate-200/80",children:[a.jsx("div",{className:"px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex h-16 items-center justify-between",children:[a.jsx("div",{className:"flex items-center",children:a.jsx(bo,{to:"/",className:"flex items-center",children:a.jsx("span",{className:"font-sf text-2xl font-semibold text-gradient",children:"Semblance"})})}),a.jsx("nav",{className:"hidden md:block",children:a.jsxs("ul",{className:"flex items-center space-x-8",children:[s.map(d=>a.jsx("li",{children:d.href==="/"?a.jsxs(bo,{to:d.href,className:Ne("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",l(d.href)?"border-primary text-primary":"border-transparent text-slate-600 hover:text-slate-900 hover:border-slate-300"),children:[a.jsx(d.icon,{className:"mr-1 h-4 w-4"}),d.name]}):a.jsxs("button",{onClick:()=>u(d.href),className:Ne("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",l(d.href)?"border-primary text-primary":"border-transparent text-slate-600 hover:text-slate-900 hover:border-slate-300"),children:[a.jsx(d.icon,{className:"mr-1 h-4 w-4"}),d.name]})},d.name)),a.jsx("li",{children:i?a.jsxs("button",{onClick:()=>{o(),r("/login")},className:"flex items-center px-3 py-2 text-sm font-medium text-slate-600 hover:text-slate-900 button-transition rounded-md hover:bg-slate-50",children:[a.jsx(JO,{className:"mr-1 h-4 w-4"}),"Logout"]}):a.jsxs(bo,{to:"/login",className:"flex items-center px-3 py-2 text-sm font-medium text-slate-600 hover:text-slate-900 button-transition rounded-md hover:bg-slate-50",children:[a.jsx(XO,{className:"mr-1 h-4 w-4"}),"Login"]})})]})}),a.jsx("div",{className:"flex md:hidden",children:a.jsxs("button",{type:"button",className:"inline-flex items-center justify-center rounded-md p-2 text-slate-700 hover:bg-slate-100 hover:text-slate-900 button-transition",onClick:c,children:[a.jsx("span",{className:"sr-only",children:"Open main menu"}),t?a.jsx(Jo,{className:"block h-6 w-6","aria-hidden":"true"}):a.jsx(rZ,{className:"block h-6 w-6","aria-hidden":"true"})]})})]})}),t&&a.jsx("div",{className:"md:hidden glass-panel animate-fade-in",children:a.jsxs("div",{className:"space-y-1 px-4 pb-3 pt-2",children:[s.map(d=>a.jsx("div",{children:d.href==="/"?a.jsxs(bo,{to:d.href,className:Ne("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition",l(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>e(!1),children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]}):a.jsxs("button",{className:Ne("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition w-full text-left",l(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>{e(!1),u(d.href)},children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]})},d.name)),i?a.jsxs("button",{onClick:()=>{o(),e(!1),r("/login")},className:"flex items-center rounded-md px-3 py-2 text-base font-medium button-transition text-slate-600 hover:bg-slate-50 hover:text-slate-900 w-full",children:[a.jsx(JO,{className:"mr-3 h-5 w-5"}),"Logout"]}):a.jsxs(bo,{to:"/login",className:"flex items-center rounded-md px-3 py-2 text-base font-medium button-transition text-slate-600 hover:bg-slate-50 hover:text-slate-900",onClick:()=>e(!1),children:[a.jsx(XO,{className:"mr-3 h-5 w-5"}),"Login"]})]})})]})}const ZI=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,eR=Mt,XT=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return eR(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=e,s=Object.keys(i).map(u=>{const d=n==null?void 0:n[u],f=o==null?void 0:o[u];if(d===null)return null;const h=ZI(d)||ZI(f);return i[u][h]}),c=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(g=>{let[m,y]=g;return Array.isArray(y)?y.includes({...o,...c}[m]):{...o,...c}[m]===y})?[...u,f,h]:u},[]);return eR(t,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},JT=XT("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),J=v.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...i},o)=>{const s=r?Hs:"button";return a.jsx(s,{className:Ne(JT({variant:e,size:n,className:t})),ref:o,...i})});J.displayName="Button";function Jie(){return a.jsxs("div",{className:"relative isolate overflow-hidden",children:[a.jsx("div",{className:"absolute inset-x-0 top-[-10rem] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[-20rem]","aria-hidden":"true",children:a.jsx("div",{className:"relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-primary to-blue-400 opacity-20 sm:left-[calc(50%-30rem)] sm:w-[72.1875rem]",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})}),a.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-24 sm:py-32 lg:flex lg:items-center lg:gap-x-10 lg:px-8 lg:py-40",children:[a.jsxs("div",{className:"mx-auto max-w-2xl lg:mx-0 lg:flex-auto",children:[a.jsx("div",{className:"flex",children:a.jsxs("div",{className:"relative flex items-center gap-x-4 rounded-full px-4 py-1 text-sm leading-6 text-gray-600 ring-1 ring-gray-900/10 hover:ring-gray-900/20",children:[a.jsx("span",{className:"font-semibold text-primary",children:"New"}),a.jsx("span",{className:"h-4 w-px bg-gray-900/10","aria-hidden":"true"}),a.jsx("span",{children:"Introducing AI-driven focus groups"})]})}),a.jsxs("h1",{className:"mt-10 max-w-lg text-4xl font-sf font-bold tracking-tight text-gray-900 sm:text-6xl",children:["Research with ",a.jsx("span",{className:"text-gradient",children:"synthetic personas"})]}),a.jsx("p",{className:"mt-6 text-lg leading-8 text-gray-600",children:"Conduct research using AI-powered synthetic personas and autonomous focus groups. Gain valuable insights without the limitations of traditional research methods."}),a.jsxs("div",{className:"mt-10 flex items-center gap-x-6",children:[a.jsx(bo,{to:"/synthetic-users",children:a.jsxs(J,{className:"px-6 py-6 text-base hover:shadow-lg hover:translate-y-[-2px] button-transition",children:["Create synthetic personas",a.jsx(fo,{className:"ml-2 h-4 w-4"})]})}),a.jsxs(bo,{to:"/focus-groups",className:"text-sm font-semibold leading-6 text-gray-900 hover:text-primary button-transition",children:["Set up focus groups ",a.jsx("span",{"aria-hidden":"true",children:"→"})]})]})]}),a.jsx("div",{className:"mt-16 sm:mt-24 lg:mt-0 lg:flex-shrink-0 lg:flex-grow",children:a.jsxs("div",{className:"relative glass-card mx-auto w-[350px] h-[450px] rounded-2xl shadow-xl overflow-hidden animate-float",children:[a.jsxs("div",{className:"absolute top-4 left-4 right-4 h-12 bg-white/70 backdrop-blur-sm rounded-lg flex items-center px-4",children:[a.jsx("div",{className:"h-3 w-3 rounded-full bg-red-400 mr-2"}),a.jsx("div",{className:"h-3 w-3 rounded-full bg-yellow-400 mr-2"}),a.jsx("div",{className:"h-3 w-3 rounded-full bg-green-400 mr-2"}),a.jsx("div",{className:"text-xs text-gray-500 ml-2",children:"Shampoo Brand Perception"})]}),a.jsx("div",{className:"absolute top-20 left-4 right-4 bottom-4 bg-gray-50 rounded-lg overflow-hidden",children:[1,2,3,4].map(t=>a.jsx("div",{className:`flex ${t%2===0?"justify-end":"justify-start"} px-3 py-2`,children:a.jsxs("div",{className:`max-w-[70%] rounded-lg px-3 py-2 text-xs ${t%2===0?"bg-primary text-white":"bg-gray-200 text-gray-800"}`,children:[t===1&&"What qualities do you look for in a premium shampoo brand?",t===2&&"I value natural ingredients and a brand that feels luxurious but still eco-friendly.",t===3&&"How important is fragrance in your shampoo selection?",t===4&&"Very important - it affects my mood and how I feel about the product throughout the day."]})},t))})]})})]}),a.jsx("div",{className:"absolute inset-x-0 bottom-[-10rem] -z-10 transform-gpu overflow-hidden blur-3xl sm:bottom-[-20rem]","aria-hidden":"true",children:a.jsx("div",{className:"relative left-[calc(50%+11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-blue-400 to-primary opacity-20 sm:left-[calc(50%+30rem)] sm:w-[72.1875rem]",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})})]})}function Lu({title:t,description:e,icon:n,className:r}){return a.jsxs("div",{className:Ne("relative group glass-card rounded-xl overflow-hidden p-6 hover:shadow-lg hover:translate-y-[-4px] button-transition",r),children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary/5 to-blue-400/5 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-12 h-12 flex items-center justify-center mb-4",children:a.jsx(n,{className:"h-6 w-6 text-primary"})}),a.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:t}),a.jsx("p",{className:"text-gray-600 text-sm",children:e})]})]})}const Zie=()=>(Xs(),ar(),a.jsxs("div",{className:"min-h-screen overflow-hidden bg-background",children:[a.jsx(Aa,{}),a.jsx("main",{children:a.jsxs("div",{className:"pt-16",children:[a.jsx(Jie,{}),a.jsx("section",{className:"py-20 px-6 bg-white",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl font-sf font-bold sm:text-4xl",children:"Why Synthetic Personas?"}),a.jsx("p",{className:"mt-4 text-lg text-gray-600 max-w-3xl mx-auto",children:"Our platform combines advanced AI with intuitive design to help researchers gain deeper insights faster than traditional methods."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:[a.jsx(Lu,{title:"Scalable Research",description:"Create and test with thousands of synthetic personas, each with unique demographic profiles and behaviors.",icon:Dr}),a.jsx(Lu,{title:"AI-Driven Focus Groups",description:"Run autonomous focus groups moderated by AI that adapts to participant responses in real-time.",icon:Vs}),a.jsx(Lu,{title:"Instant Analysis",description:"Generate comprehensive reports and visualizations that highlight key insights and patterns.",icon:G_}),a.jsx(Lu,{title:"Diverse Perspectives",description:"Access synthetic personas from various backgrounds, ensuring representation across age, gender, and location.",icon:Dr}),a.jsx(Lu,{title:"Dynamic Discussions",description:"AI moderators guide conversations naturally, following up on interesting points without bias.",icon:uZ}),a.jsx(Lu,{title:"Comprehensive Reporting",description:"Export detailed reports with sentiment analysis, key themes, and actionable recommendations.",icon:G_})]})]})}),a.jsx("section",{className:"py-20 px-6 bg-gradient-to-b from-white to-slate-50",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl font-sf font-bold sm:text-4xl",children:"How It Works"}),a.jsx("p",{className:"mt-4 text-lg text-gray-600 max-w-3xl mx-auto",children:"Just three simple steps to gather valuable insights from synthetic personas."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:[a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"1"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Create Synthetic Personas"}),a.jsx("p",{className:"text-gray-600",children:"Define your target audience with customizable demographic profiles and personality traits."})]}),a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"2"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Set Up Focus Groups"}),a.jsx("p",{className:"text-gray-600",children:"Configure your research objectives, topics, and parameters for the AI moderator."})]}),a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"3"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Analyze Results"}),a.jsx("p",{className:"text-gray-600",children:"Review comprehensive visual reports and actionable insights from your synthetic research."})]})]}),a.jsx("div",{className:"text-center mt-12",children:a.jsx(bo,{to:"synthetic-users",className:"inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-primary hover:bg-primary/90 button-transition",children:"Get Started"})})]})}),a.jsxs("footer",{className:"bg-white py-12 px-6",children:[a.jsxs("div",{className:"max-w-7xl mx-auto flex flex-col md:flex-row justify-between items-center",children:[a.jsxs("div",{className:"mb-6 md:mb-0",children:[a.jsx("span",{className:"text-xl font-sf font-semibold text-gradient",children:"Semblance"}),a.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"AI-powered synthetic persona research"})]}),a.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Platform"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx(bo,{to:"/",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Home"})}),a.jsx("li",{children:a.jsx(bo,{to:"/synthetic-users",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Synthetic Personas"})}),a.jsx("li",{children:a.jsx(bo,{to:"/focus-groups",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Focus Groups"})}),a.jsx("li",{children:a.jsx(bo,{to:"/dashboard",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Dashboard"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Company"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"About"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Blog"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Careers"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Contact"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Legal"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Privacy"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Terms"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Security"})})]})]})]})]}),a.jsx("div",{className:"max-w-7xl mx-auto mt-8 pt-8 border-t border-gray-200",children:a.jsxs("p",{className:"text-sm text-gray-500 text-center",children:["Ā© ",new Date().getFullYear()," Semblance. All rights reserved."]})})]})]})})]})),eoe=()=>{const t=Fi(),e=ar();v.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]);const n=t.pathname.startsWith("/synthetic-users/"),i=new URLSearchParams(t.search).get("fromReview")==="true";return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:a.jsxs("div",{className:"text-center p-8 max-w-md bg-white rounded-lg shadow-md",children:[a.jsx("h1",{className:"text-4xl font-bold mb-4",children:"404"}),n?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Persona Not Found"}),a.jsx("p",{className:"text-gray-500 mb-6",children:"The persona you're looking for may have been removed or doesn't exist."}),i?a.jsx(J,{onClick:()=>e("/synthetic-users?mode=create&tab=ai&step=review"),className:"mb-2 w-full",children:"Return to Review Page"}):a.jsx(J,{onClick:()=>e("/synthetic-users"),className:"mb-2 w-full",children:"View All Personas"})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Oops! Page not found"}),a.jsx("p",{className:"text-gray-500 mb-6",children:"The page you're looking for doesn't exist or has been moved."})]}),a.jsx(J,{variant:"outline",onClick:()=>e("/"),className:"w-full",children:"Return to Home"})]})})};function toe(t,e=[]){let n=[];function r(o,s){const c=v.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,y=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=v.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,noe(i,...e)]}function noe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var ZT="Progress",eN=100,[roe,aFe]=toe(ZT),[ioe,ooe]=roe(ZT),YU=v.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:i,getValueLabel:o=soe,...s}=t;(i||i===0)&&!tR(i)&&console.error(aoe(`${i}`,"Progress"));const c=tR(i)?i:eN;r!==null&&!nR(r,c)&&console.error(coe(`${r}`,"Progress"));const l=nR(r,c)?r:null,u=vx(l)?o(l,c):void 0;return a.jsx(ioe,{scope:n,value:l,max:c,children:a.jsx(it.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":vx(l)?l:void 0,"aria-valuetext":u,role:"progressbar","data-state":JU(l,c),"data-value":l??void 0,"data-max":c,...s,ref:e})})});YU.displayName=ZT;var QU="ProgressIndicator",XU=v.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,i=ooe(QU,n);return a.jsx(it.div,{"data-state":JU(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:e})});XU.displayName=QU;function soe(t,e){return`${Math.round(t/e*100)}%`}function JU(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function vx(t){return typeof t=="number"}function tR(t){return vx(t)&&!isNaN(t)&&t>0}function nR(t,e){return vx(t)&&!isNaN(t)&&t<=e&&t>=0}function aoe(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${eN}\`.`}function coe(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: - - a positive number - - less than the value passed to \`max\` (or ${eN} if no \`max\` prop is set) - - \`null\` or \`undefined\` if the progress is indeterminate. - -Defaulting to \`null\`.`}var ZU=YU,loe=XU;const Rl=v.forwardRef(({className:t,value:e,...n},r)=>a.jsx(ZU,{ref:r,className:Ne("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:a.jsx(loe,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Rl.displayName=ZU.displayName;var xg=t=>t.type==="checkbox",Ml=t=>t instanceof Date,fi=t=>t==null;const e3=t=>typeof t=="object";var sr=t=>!fi(t)&&!Array.isArray(t)&&e3(t)&&!Ml(t),t3=t=>sr(t)&&t.target?xg(t.target)?t.target.checked:t.target.value:t,uoe=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,n3=(t,e)=>t.has(uoe(e)),doe=t=>{const e=t.constructor&&t.constructor.prototype;return sr(e)&&e.hasOwnProperty("isPrototypeOf")},tN=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function _i(t){let e;const n=Array.isArray(t);if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(tN&&(t instanceof Blob||t instanceof FileList))&&(n||sr(t)))if(e=n?[]:{},!n&&!doe(t))e=t;else for(const r in t)t.hasOwnProperty(r)&&(e[r]=_i(t[r]));else return t;return e}var U0=t=>Array.isArray(t)?t.filter(Boolean):[],Jn=t=>t===void 0,Ie=(t,e,n)=>{if(!e||!sr(t))return n;const r=U0(e.split(/[,[\].]+?/)).reduce((i,o)=>fi(i)?i:i[o],t);return Jn(r)||r===t?Jn(t[e])?n:t[e]:r},po=t=>typeof t=="boolean",nN=t=>/^\w*$/.test(t),r3=t=>U0(t.replace(/["|']|\]/g,"").split(/\.|\[/)),mn=(t,e,n)=>{let r=-1;const i=nN(e)?[e]:r3(e),o=i.length,s=o-1;for(;++rN.useContext(i3),foe=t=>{const{children:e,...n}=t;return N.createElement(i3.Provider,{value:n},e)};var o3=(t,e,n,r=!0)=>{const i={defaultValues:e._defaultValues};for(const o in t)Object.defineProperty(i,o,{get:()=>{const s=o;return e._proxyFormState[s]!==Vo.all&&(e._proxyFormState[s]=!r||Vo.all),n&&(n[s]=!0),t[s]}});return i},Ai=t=>sr(t)&&!Object.keys(t).length,s3=(t,e,n,r)=>{n(t);const{name:i,...o}=t;return Ai(o)||Object.keys(o).length>=Object.keys(e).length||Object.keys(o).find(s=>e[s]===(!r||Vo.all))},pp=t=>Array.isArray(t)?t:[t],a3=(t,e,n)=>!t||!e||t===e||pp(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r)));function rN(t){const e=N.useRef(t);e.current=t,N.useEffect(()=>{const n=!t.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{n&&n.unsubscribe()}},[t.disabled])}function hoe(t){const e=H0(),{control:n=e.control,disabled:r,name:i,exact:o}=t||{},[s,c]=N.useState(n._formState),l=N.useRef(!0),u=N.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=N.useRef(i);return d.current=i,rN({disabled:r,next:f=>l.current&&a3(d.current,f.name,o)&&s3(f,u.current,n._updateFormState)&&c({...n._formState,...f}),subject:n._subjects.state}),N.useEffect(()=>(l.current=!0,u.current.isValid&&n._updateValid(!0),()=>{l.current=!1}),[n]),o3(s,n,u.current,!1)}var ks=t=>typeof t=="string",c3=(t,e,n,r,i)=>ks(t)?(r&&e.watch.add(t),Ie(n,t,i)):Array.isArray(t)?t.map(o=>(r&&e.watch.add(o),Ie(n,o))):(r&&(e.watchAll=!0),n);function poe(t){const e=H0(),{control:n=e.control,name:r,defaultValue:i,disabled:o,exact:s}=t||{},c=N.useRef(r);c.current=r,rN({disabled:o,subject:n._subjects.values,next:d=>{a3(c.current,d.name,s)&&u(_i(c3(c.current,n._names,d.values||n._formValues,!1,i)))}});const[l,u]=N.useState(n._getWatch(r,i));return N.useEffect(()=>n._removeUnmounted()),l}function moe(t){const e=H0(),{name:n,disabled:r,control:i=e.control,shouldUnregister:o}=t,s=n3(i._names.array,n),c=poe({control:i,name:n,defaultValue:Ie(i._formValues,n,Ie(i._defaultValues,n,t.defaultValue)),exact:!0}),l=hoe({control:i,name:n,exact:!0}),u=N.useRef(i.register(n,{...t.rules,value:c,...po(t.disabled)?{disabled:t.disabled}:{}}));return N.useEffect(()=>{const d=i._options.shouldUnregister||o,f=(h,p)=>{const g=Ie(i._fields,h);g&&g._f&&(g._f.mount=p)};if(f(n,!0),d){const h=_i(Ie(i._options.defaultValues,n));mn(i._defaultValues,n,h),Jn(Ie(i._formValues,n))&&mn(i._formValues,n,h)}return()=>{(s?d&&!i._state.action:d)?i.unregister(n):f(n,!1)}},[n,i,s,o]),N.useEffect(()=>{Ie(i._fields,n)&&i._updateDisabledField({disabled:r,fields:i._fields,name:n,value:Ie(i._fields,n)._f.value})},[r,n,i]),{field:{name:n,value:c,...po(r)||l.disabled?{disabled:l.disabled||r}:{},onChange:N.useCallback(d=>u.current.onChange({target:{value:t3(d),name:n},type:yx.CHANGE}),[n]),onBlur:N.useCallback(()=>u.current.onBlur({target:{value:Ie(i._formValues,n),name:n},type:yx.BLUR}),[n,i]),ref:N.useCallback(d=>{const f=Ie(i._fields,n);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:h=>d.setCustomValidity(h),reportValidity:()=>d.reportValidity()})},[i._fields,n])},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Ie(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!Ie(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Ie(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Ie(l.validatingFields,n)},error:{enumerable:!0,get:()=>Ie(l.errors,n)}})}}const goe=t=>t.render(moe(t));var l3=(t,e,n,r,i)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:i||!0}}:{},rR=t=>({isOnSubmit:!t||t===Vo.onSubmit,isOnBlur:t===Vo.onBlur,isOnChange:t===Vo.onChange,isOnAll:t===Vo.all,isOnTouch:t===Vo.onTouched}),iR=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const mp=(t,e,n,r)=>{for(const i of n||Object.keys(t)){const o=Ie(t,i);if(o){const{_f:s,...c}=o;if(s){if(s.refs&&s.refs[0]&&e(s.refs[0],i)&&!r)return!0;if(s.ref&&e(s.ref,s.name)&&!r)return!0;if(mp(c,e))break}else if(sr(c)&&mp(c,e))break}}};var voe=(t,e,n)=>{const r=pp(Ie(t,n));return mn(r,"root",e[n]),mn(t,n,r),t},iN=t=>t.type==="file",ba=t=>typeof t=="function",xx=t=>{if(!tN)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},iy=t=>ks(t),oN=t=>t.type==="radio",bx=t=>t instanceof RegExp;const oR={value:!1,isValid:!1},sR={value:!0,isValid:!0};var u3=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!Jn(t[0].attributes.value)?Jn(t[0].value)||t[0].value===""?sR:{value:t[0].value,isValid:!0}:sR:oR}return oR};const aR={isValid:!1,value:null};var d3=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,aR):aR;function cR(t,e,n="validate"){if(iy(t)||Array.isArray(t)&&t.every(iy)||po(t)&&!t)return{type:n,message:iy(t)?t:"",ref:e}}var Fu=t=>sr(t)&&!bx(t)?t:{value:t,message:""},lR=async(t,e,n,r,i)=>{const{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:m,mount:y,disabled:b}=t._f,x=Ie(e,g);if(!y||b)return{};const w=s?s[0]:o,S=E=>{r&&w.reportValidity&&(w.setCustomValidity(po(E)?"":E||""),w.reportValidity())},C={},_=oN(o),A=xg(o),j=_||A,P=(m||iN(o))&&Jn(o.value)&&Jn(x)||xx(o)&&o.value===""||x===""||Array.isArray(x)&&!x.length,k=l3.bind(null,g,n,C),O=(E,I,D,z=oa.maxLength,$=oa.minLength)=>{const G=E?I:D;C[g]={type:E?z:$,message:G,ref:o,...k(E?z:$,G)}};if(i?!Array.isArray(x)||!x.length:c&&(!j&&(P||fi(x))||po(x)&&!x||A&&!u3(s).isValid||_&&!d3(s).isValid)){const{value:E,message:I}=iy(c)?{value:!!c,message:c}:Fu(c);if(E&&(C[g]={type:oa.required,message:I,ref:w,...k(oa.required,I)},!n))return S(I),C}if(!P&&(!fi(d)||!fi(f))){let E,I;const D=Fu(f),z=Fu(d);if(!fi(x)&&!isNaN(x)){const $=o.valueAsNumber||x&&+x;fi(D.value)||(E=$>D.value),fi(z.value)||(I=$new Date(new Date().toDateString()+" "+W),R=o.type=="time",L=o.type=="week";ks(D.value)&&x&&(E=R?G(x)>G(D.value):L?x>D.value:$>new Date(D.value)),ks(z.value)&&x&&(I=R?G(x)+E.value,z=!fi(I.value)&&x.length<+I.value;if((D||z)&&(O(D,E.message,I.message),!n))return S(C[g].message),C}if(h&&!P&&ks(x)){const{value:E,message:I}=Fu(h);if(bx(E)&&!x.match(E)&&(C[g]={type:oa.pattern,message:I,ref:o,...k(oa.pattern,I)},!n))return S(I),C}if(p){if(ba(p)){const E=await p(x,e),I=cR(E,w);if(I&&(C[g]={...I,...k(oa.validate,I.message)},!n))return S(I.message),C}else if(sr(p)){let E={};for(const I in p){if(!Ai(E)&&!n)break;const D=cR(await p[I](x,e),w,I);D&&(E={...D,...k(I,D.message)},S(D.message),n&&(C[g]=E))}if(!Ai(E)&&(C[g]={ref:w,...E},!n))return C}}return S(!0),C};function yoe(t,e){const n=e.slice(0,-1).length;let r=0;for(;r{let t=[];return{get observers(){return t},next:i=>{for(const o of t)o.next&&o.next(i)},subscribe:i=>(t.push(i),{unsubscribe:()=>{t=t.filter(o=>o!==i)}}),unsubscribe:()=>{t=[]}}},pA=t=>fi(t)||!e3(t);function uc(t,e){if(pA(t)||pA(e))return t===e;if(Ml(t)&&Ml(e))return t.getTime()===e.getTime();const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const i of n){const o=t[i];if(!r.includes(i))return!1;if(i!=="ref"){const s=e[i];if(Ml(o)&&Ml(s)||sr(o)&&sr(s)||Array.isArray(o)&&Array.isArray(s)?!uc(o,s):o!==s)return!1}}return!0}var f3=t=>t.type==="select-multiple",boe=t=>oN(t)||xg(t),GS=t=>xx(t)&&t.isConnected,h3=t=>{for(const e in t)if(ba(t[e]))return!0;return!1};function wx(t,e={}){const n=Array.isArray(t);if(sr(t)||n)for(const r in t)Array.isArray(t[r])||sr(t[r])&&!h3(t[r])?(e[r]=Array.isArray(t[r])?[]:{},wx(t[r],e[r])):fi(t[r])||(e[r]=!0);return e}function p3(t,e,n){const r=Array.isArray(t);if(sr(t)||r)for(const i in t)Array.isArray(t[i])||sr(t[i])&&!h3(t[i])?Jn(e)||pA(n[i])?n[i]=Array.isArray(t[i])?wx(t[i],[]):{...wx(t[i])}:p3(t[i],fi(e)?{}:e[i],n[i]):n[i]=!uc(t[i],e[i]);return n}var jh=(t,e)=>p3(t,e,wx(e)),m3=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>Jn(t)?t:e?t===""?NaN:t&&+t:n&&ks(t)?new Date(t):r?r(t):t;function VS(t){const e=t.ref;if(!(t.refs?t.refs.every(n=>n.disabled):e.disabled))return iN(e)?e.files:oN(e)?d3(t.refs).value:f3(e)?[...e.selectedOptions].map(({value:n})=>n):xg(e)?u3(t.refs).value:m3(Jn(e.value)?t.ref.value:e.value,t)}var woe=(t,e,n,r)=>{const i={};for(const o of t){const s=Ie(e,o);s&&mn(i,o,s._f)}return{criteriaMode:n,names:[...t],fields:i,shouldUseNativeValidation:r}},Eh=t=>Jn(t)?t:bx(t)?t.source:sr(t)?bx(t.value)?t.value.source:t.value:t;const uR="AsyncFunction";var Soe=t=>(!t||!t.validate)&&!!(ba(t.validate)&&t.validate.constructor.name===uR||sr(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===uR)),Coe=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function dR(t,e,n){const r=Ie(t,n);if(r||nN(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const o=i.join("."),s=Ie(e,o),c=Ie(t,o);if(s&&!Array.isArray(s)&&n!==o)return{name:n};if(c&&c.type)return{name:o,error:c};i.pop()}return{name:n}}var _oe=(t,e,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(e||t):(n?r.isOnBlur:i.isOnBlur)?!t:(n?r.isOnChange:i.isOnChange)?t:!0,Aoe=(t,e)=>!U0(Ie(t,e)).length&&yr(t,e);const joe={mode:Vo.onSubmit,reValidateMode:Vo.onChange,shouldFocusError:!0};function Eoe(t={}){let e={...joe,...t},n={submitCount:0,isDirty:!1,isLoading:ba(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},i=sr(e.defaultValues)||sr(e.values)?_i(e.defaultValues||e.values)||{}:{},o=e.shouldUnregister?{}:_i(i),s={action:!1,mount:!1,watch:!1},c={mount:new Set,unMount:new Set,array:new Set,watch:new Set},l,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:zS(),array:zS(),state:zS()},h=rR(e.mode),p=rR(e.reValidateMode),g=e.criteriaMode===Vo.all,m=T=>M=>{clearTimeout(u),u=setTimeout(T,M)},y=async T=>{if(!t.disabled&&(d.isValid||T)){const M=e.resolver?Ai((await j()).errors):await k(r,!0);M!==n.isValid&&f.state.next({isValid:M})}},b=(T,M)=>{!t.disabled&&(d.isValidating||d.validatingFields)&&((T||Array.from(c.mount)).forEach(U=>{U&&(M?mn(n.validatingFields,U,M):yr(n.validatingFields,U))}),f.state.next({validatingFields:n.validatingFields,isValidating:!Ai(n.validatingFields)}))},x=(T,M=[],U,V,Q=!0,B=!0)=>{if(V&&U&&!t.disabled){if(s.action=!0,B&&Array.isArray(Ie(r,T))){const X=U(Ie(r,T),V.argA,V.argB);Q&&mn(r,T,X)}if(B&&Array.isArray(Ie(n.errors,T))){const X=U(Ie(n.errors,T),V.argA,V.argB);Q&&mn(n.errors,T,X),Aoe(n.errors,T)}if(d.touchedFields&&B&&Array.isArray(Ie(n.touchedFields,T))){const X=U(Ie(n.touchedFields,T),V.argA,V.argB);Q&&mn(n.touchedFields,T,X)}d.dirtyFields&&(n.dirtyFields=jh(i,o)),f.state.next({name:T,isDirty:E(T,M),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else mn(o,T,M)},w=(T,M)=>{mn(n.errors,T,M),f.state.next({errors:n.errors})},S=T=>{n.errors=T,f.state.next({errors:n.errors,isValid:!1})},C=(T,M,U,V)=>{const Q=Ie(r,T);if(Q){const B=Ie(o,T,Jn(U)?Ie(i,T):U);Jn(B)||V&&V.defaultChecked||M?mn(o,T,M?B:VS(Q._f)):z(T,B),s.mount&&y()}},_=(T,M,U,V,Q)=>{let B=!1,X=!1;const ge={name:T};if(!t.disabled){const xe=!!(Ie(r,T)&&Ie(r,T)._f&&Ie(r,T)._f.disabled);if(!U||V){d.isDirty&&(X=n.isDirty,n.isDirty=ge.isDirty=E(),B=X!==ge.isDirty);const Re=xe||uc(Ie(i,T),M);X=!!(!xe&&Ie(n.dirtyFields,T)),Re||xe?yr(n.dirtyFields,T):mn(n.dirtyFields,T,!0),ge.dirtyFields=n.dirtyFields,B=B||d.dirtyFields&&X!==!Re}if(U){const Re=Ie(n.touchedFields,T);Re||(mn(n.touchedFields,T,U),ge.touchedFields=n.touchedFields,B=B||d.touchedFields&&Re!==U)}B&&Q&&f.state.next(ge)}return B?ge:{}},A=(T,M,U,V)=>{const Q=Ie(n.errors,T),B=d.isValid&&po(M)&&n.isValid!==M;if(t.delayError&&U?(l=m(()=>w(T,U)),l(t.delayError)):(clearTimeout(u),l=null,U?mn(n.errors,T,U):yr(n.errors,T)),(U?!uc(Q,U):Q)||!Ai(V)||B){const X={...V,...B&&po(M)?{isValid:M}:{},errors:n.errors,name:T};n={...n,...X},f.state.next(X)}},j=async T=>{b(T,!0);const M=await e.resolver(o,e.context,woe(T||c.mount,r,e.criteriaMode,e.shouldUseNativeValidation));return b(T),M},P=async T=>{const{errors:M}=await j(T);if(T)for(const U of T){const V=Ie(M,U);V?mn(n.errors,U,V):yr(n.errors,U)}else n.errors=M;return M},k=async(T,M,U={valid:!0})=>{for(const V in T){const Q=T[V];if(Q){const{_f:B,...X}=Q;if(B){const ge=c.array.has(B.name),xe=Q._f&&Soe(Q._f);xe&&d.validatingFields&&b([V],!0);const Re=await lR(Q,o,g,e.shouldUseNativeValidation&&!M,ge);if(xe&&d.validatingFields&&b([V]),Re[B.name]&&(U.valid=!1,M))break;!M&&(Ie(Re,B.name)?ge?voe(n.errors,Re,B.name):mn(n.errors,B.name,Re[B.name]):yr(n.errors,B.name))}!Ai(X)&&await k(X,M,U)}}return U.valid},O=()=>{for(const T of c.unMount){const M=Ie(r,T);M&&(M._f.refs?M._f.refs.every(U=>!GS(U)):!GS(M._f.ref))&&ne(T)}c.unMount=new Set},E=(T,M)=>!t.disabled&&(T&&M&&mn(o,T,M),!uc(Y(),i)),I=(T,M,U)=>c3(T,c,{...s.mount?o:Jn(M)?i:ks(T)?{[T]:M}:M},U,M),D=T=>U0(Ie(s.mount?o:i,T,t.shouldUnregister?Ie(i,T,[]):[])),z=(T,M,U={})=>{const V=Ie(r,T);let Q=M;if(V){const B=V._f;B&&(!B.disabled&&mn(o,T,m3(M,B)),Q=xx(B.ref)&&fi(M)?"":M,f3(B.ref)?[...B.ref.options].forEach(X=>X.selected=Q.includes(X.value)):B.refs?xg(B.ref)?B.refs.length>1?B.refs.forEach(X=>(!X.defaultChecked||!X.disabled)&&(X.checked=Array.isArray(Q)?!!Q.find(ge=>ge===X.value):Q===X.value)):B.refs[0]&&(B.refs[0].checked=!!Q):B.refs.forEach(X=>X.checked=X.value===Q):iN(B.ref)?B.ref.value="":(B.ref.value=Q,B.ref.type||f.values.next({name:T,values:{...o}})))}(U.shouldDirty||U.shouldTouch)&&_(T,Q,U.shouldTouch,U.shouldDirty,!0),U.shouldValidate&&W(T)},$=(T,M,U)=>{for(const V in M){const Q=M[V],B=`${T}.${V}`,X=Ie(r,B);(c.array.has(T)||sr(Q)||X&&!X._f)&&!Ml(Q)?$(B,Q,U):z(B,Q,U)}},G=(T,M,U={})=>{const V=Ie(r,T),Q=c.array.has(T),B=_i(M);mn(o,T,B),Q?(f.array.next({name:T,values:{...o}}),(d.isDirty||d.dirtyFields)&&U.shouldDirty&&f.state.next({name:T,dirtyFields:jh(i,o),isDirty:E(T,B)})):V&&!V._f&&!fi(B)?$(T,B,U):z(T,B,U),iR(T,c)&&f.state.next({...n}),f.values.next({name:s.mount?T:void 0,values:{...o}})},R=async T=>{s.mount=!0;const M=T.target;let U=M.name,V=!0;const Q=Ie(r,U),B=()=>M.type?VS(Q._f):t3(T),X=ge=>{V=Number.isNaN(ge)||Ml(ge)&&isNaN(ge.getTime())||uc(ge,Ie(o,U,ge))};if(Q){let ge,xe;const Re=B(),be=T.type===yx.BLUR||T.type===yx.FOCUS_OUT,Ve=!Coe(Q._f)&&!e.resolver&&!Ie(n.errors,U)&&!Q._f.deps||_oe(be,Ie(n.touchedFields,U),n.isSubmitted,p,h),st=iR(U,c,be);mn(o,U,Re),be?(Q._f.onBlur&&Q._f.onBlur(T),l&&l(0)):Q._f.onChange&&Q._f.onChange(T);const kt=_(U,Re,be,!1),Ke=!Ai(kt)||st;if(!be&&f.values.next({name:U,type:T.type,values:{...o}}),Ve)return d.isValid&&(t.mode==="onBlur"?be&&y():y()),Ke&&f.state.next({name:U,...st?{}:kt});if(!be&&st&&f.state.next({...n}),e.resolver){const{errors:tt}=await j([U]);if(X(Re),V){const Nt=dR(n.errors,r,U),sn=dR(tt,r,Nt.name||U);ge=sn.error,U=sn.name,xe=Ai(tt)}}else b([U],!0),ge=(await lR(Q,o,g,e.shouldUseNativeValidation))[U],b([U]),X(Re),V&&(ge?xe=!1:d.isValid&&(xe=await k(r,!0)));V&&(Q._f.deps&&W(Q._f.deps),A(U,xe,ge,kt))}},L=(T,M)=>{if(Ie(n.errors,M)&&T.focus)return T.focus(),1},W=async(T,M={})=>{let U,V;const Q=pp(T);if(e.resolver){const B=await P(Jn(T)?T:Q);U=Ai(B),V=T?!Q.some(X=>Ie(B,X)):U}else T?(V=(await Promise.all(Q.map(async B=>{const X=Ie(r,B);return await k(X&&X._f?{[B]:X}:X)}))).every(Boolean),!(!V&&!n.isValid)&&y()):V=U=await k(r);return f.state.next({...!ks(T)||d.isValid&&U!==n.isValid?{}:{name:T},...e.resolver||!T?{isValid:U}:{},errors:n.errors}),M.shouldFocus&&!V&&mp(r,L,T?Q:c.mount),V},Y=T=>{const M={...s.mount?o:i};return Jn(T)?M:ks(T)?Ie(M,T):T.map(U=>Ie(M,U))},te=(T,M)=>({invalid:!!Ie((M||n).errors,T),isDirty:!!Ie((M||n).dirtyFields,T),error:Ie((M||n).errors,T),isValidating:!!Ie(n.validatingFields,T),isTouched:!!Ie((M||n).touchedFields,T)}),me=T=>{T&&pp(T).forEach(M=>yr(n.errors,M)),f.state.next({errors:T?n.errors:{}})},F=(T,M,U)=>{const V=(Ie(r,T,{_f:{}})._f||{}).ref,Q=Ie(n.errors,T)||{},{ref:B,message:X,type:ge,...xe}=Q;mn(n.errors,T,{...xe,...M,ref:V}),f.state.next({name:T,errors:n.errors,isValid:!1}),U&&U.shouldFocus&&V&&V.focus&&V.focus()},se=(T,M)=>ba(T)?f.values.subscribe({next:U=>T(I(void 0,M),U)}):I(T,M,!0),ne=(T,M={})=>{for(const U of T?pp(T):c.mount)c.mount.delete(U),c.array.delete(U),M.keepValue||(yr(r,U),yr(o,U)),!M.keepError&&yr(n.errors,U),!M.keepDirty&&yr(n.dirtyFields,U),!M.keepTouched&&yr(n.touchedFields,U),!M.keepIsValidating&&yr(n.validatingFields,U),!e.shouldUnregister&&!M.keepDefaultValue&&yr(i,U);f.values.next({values:{...o}}),f.state.next({...n,...M.keepDirty?{isDirty:E()}:{}}),!M.keepIsValid&&y()},ae=({disabled:T,name:M,field:U,fields:V,value:Q})=>{if(po(T)&&s.mount||T){const B=T?void 0:Jn(Q)?VS(U?U._f:Ie(V,M)._f):Q;mn(o,M,B),_(M,B,!1,!1,!0)}},De=(T,M={})=>{let U=Ie(r,T);const V=po(M.disabled)||po(t.disabled);return mn(r,T,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:T}},name:T,mount:!0,...M}}),c.mount.add(T),U?ae({field:U,disabled:po(M.disabled)?M.disabled:t.disabled,name:T,value:M.value}):C(T,!0,M.value),{...V?{disabled:M.disabled||t.disabled}:{},...e.progressive?{required:!!M.required,min:Eh(M.min),max:Eh(M.max),minLength:Eh(M.minLength),maxLength:Eh(M.maxLength),pattern:Eh(M.pattern)}:{},name:T,onChange:R,onBlur:R,ref:Q=>{if(Q){De(T,M),U=Ie(r,T);const B=Jn(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,X=boe(B),ge=U._f.refs||[];if(X?ge.find(xe=>xe===B):B===U._f.ref)return;mn(r,T,{_f:{...U._f,...X?{refs:[...ge.filter(GS),B,...Array.isArray(Ie(i,T))?[{}]:[]],ref:{type:B.type,name:T}}:{ref:B}}}),C(T,!1,void 0,B)}else U=Ie(r,T,{}),U._f&&(U._f.mount=!1),(e.shouldUnregister||M.shouldUnregister)&&!(n3(c.array,T)&&s.action)&&c.unMount.add(T)}}},de=()=>e.shouldFocusError&&mp(r,L,c.mount),ye=T=>{po(T)&&(f.state.next({disabled:T}),mp(r,(M,U)=>{const V=Ie(r,U);V&&(M.disabled=V._f.disabled||T,Array.isArray(V._f.refs)&&V._f.refs.forEach(Q=>{Q.disabled=V._f.disabled||T}))},0,!1))},Ee=(T,M)=>async U=>{let V;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let Q=_i(o);if(f.state.next({isSubmitting:!0}),e.resolver){const{errors:B,values:X}=await j();n.errors=B,Q=X}else await k(r);if(yr(n.errors,"root"),Ai(n.errors)){f.state.next({errors:{}});try{await T(Q,U)}catch(B){V=B}}else M&&await M({...n.errors},U),de(),setTimeout(de);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ai(n.errors)&&!V,submitCount:n.submitCount+1,errors:n.errors}),V)throw V},Z=(T,M={})=>{Ie(r,T)&&(Jn(M.defaultValue)?G(T,_i(Ie(i,T))):(G(T,M.defaultValue),mn(i,T,_i(M.defaultValue))),M.keepTouched||yr(n.touchedFields,T),M.keepDirty||(yr(n.dirtyFields,T),n.isDirty=M.defaultValue?E(T,_i(Ie(i,T))):E()),M.keepError||(yr(n.errors,T),d.isValid&&y()),f.state.next({...n}))},ct=(T,M={})=>{const U=T?_i(T):i,V=_i(U),Q=Ai(T),B=Q?i:V;if(M.keepDefaultValues||(i=U),!M.keepValues){if(M.keepDirtyValues){const X=new Set([...c.mount,...Object.keys(jh(i,o))]);for(const ge of Array.from(X))Ie(n.dirtyFields,ge)?mn(B,ge,Ie(o,ge)):G(ge,Ie(B,ge))}else{if(tN&&Jn(T))for(const X of c.mount){const ge=Ie(r,X);if(ge&&ge._f){const xe=Array.isArray(ge._f.refs)?ge._f.refs[0]:ge._f.ref;if(xx(xe)){const Re=xe.closest("form");if(Re){Re.reset();break}}}}r={}}o=t.shouldUnregister?M.keepDefaultValues?_i(i):{}:_i(B),f.array.next({values:{...B}}),f.values.next({values:{...B}})}c={mount:M.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!M.keepIsValid||!!M.keepDirtyValues,s.watch=!!t.shouldUnregister,f.state.next({submitCount:M.keepSubmitCount?n.submitCount:0,isDirty:Q?!1:M.keepDirty?n.isDirty:!!(M.keepDefaultValues&&!uc(T,i)),isSubmitted:M.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Q?{}:M.keepDirtyValues?M.keepDefaultValues&&o?jh(i,o):n.dirtyFields:M.keepDefaultValues&&T?jh(i,T):M.keepDirty?n.dirtyFields:{},touchedFields:M.keepTouched?n.touchedFields:{},errors:M.keepErrors?n.errors:{},isSubmitSuccessful:M.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Le=(T,M)=>ct(ba(T)?T(o):T,M);return{control:{register:De,unregister:ne,getFieldState:te,handleSubmit:Ee,setError:F,_executeSchema:j,_getWatch:I,_getDirty:E,_updateValid:y,_removeUnmounted:O,_updateFieldArray:x,_updateDisabledField:ae,_getFieldArray:D,_reset:ct,_resetDefaultValues:()=>ba(e.defaultValues)&&e.defaultValues().then(T=>{Le(T,e.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:T=>{n={...n,...T}},_disableForm:ye,_subjects:f,_proxyFormState:d,_setErrors:S,get _fields(){return r},get _formValues(){return o},get _state(){return s},set _state(T){s=T},get _defaultValues(){return i},get _names(){return c},set _names(T){c=T},get _formState(){return n},set _formState(T){n=T},get _options(){return e},set _options(T){e={...e,...T}}},trigger:W,register:De,handleSubmit:Ee,watch:se,setValue:G,getValues:Y,reset:Le,resetField:Z,clearErrors:me,unregister:ne,setError:F,setFocus:(T,M={})=>{const U=Ie(r,T),V=U&&U._f;if(V){const Q=V.refs?V.refs[0]:V.ref;Q.focus&&(Q.focus(),M.shouldSelect&&Q.select())}},getFieldState:te}}function z0(t={}){const e=N.useRef(),n=N.useRef(),[r,i]=N.useState({isDirty:!1,isValidating:!1,isLoading:ba(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:ba(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...Eoe(t),formState:r});const o=e.current.control;return o._options=t,rN({subject:o._subjects.state,next:s=>{s3(s,o._proxyFormState,o._updateFormState,!0)&&i({...o._formState})}}),N.useEffect(()=>o._disableForm(t.disabled),[o,t.disabled]),N.useEffect(()=>{if(o._proxyFormState.isDirty){const s=o._getDirty();s!==r.isDirty&&o._subjects.state.next({isDirty:s})}},[o,r.isDirty]),N.useEffect(()=>{t.values&&!uc(t.values,n.current)?(o._reset(t.values,o._options.resetOptions),n.current=t.values,i(s=>({...s}))):o._resetDefaultValues()},[t.values,o]),N.useEffect(()=>{t.errors&&o._setErrors(t.errors)},[t.errors,o]),N.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),N.useEffect(()=>{t.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[t.shouldUnregister,o]),N.useEffect(()=>{e.current&&(e.current.watch=e.current.watch.bind({}))},[r]),e.current.formState=o3(r,o),e.current}const fR=(t,e,n)=>{if(t&&"reportValidity"in t){const r=Ie(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},g3=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?fR(r.ref,n,t):r.refs&&r.refs.forEach(i=>fR(i,n,t))}},Toe=(t,e)=>{e.shouldUseNativeValidation&&g3(t,e);const n={};for(const r in t){const i=Ie(e.fields,r),o=Object.assign(t[r]||{},{ref:i&&i.ref});if(Noe(e.names||Object.keys(t),r)){const s=Object.assign({},Ie(n,r));mn(s,"root",o),mn(n,r,s)}else mn(n,r,o)}return n},Noe=(t,e)=>t.some(n=>n.startsWith(e+"."));var Poe=function(t,e){for(var n={};t.length;){var r=t[0],i=r.code,o=r.message,s=r.path.join(".");if(!n[s])if("unionErrors"in r){var c=r.unionErrors[0].errors[0];n[s]={message:c.message,type:c.code}}else n[s]={message:o,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return t.push(f)})}),e){var l=n[s].types,u=l&&l[r.code];n[s]=l3(s,e,n,i,u?[].concat(u,r.message):r.message)}t.shift()}return n},G0=function(t,e,n){return n===void 0&&(n={}),function(r,i,o){try{return Promise.resolve(function(s,c){try{var l=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(u){return o.shouldUseNativeValidation&&g3({},o),{errors:{},values:n.raw?r:u}})}catch(u){return c(u)}return l&&l.then?l.then(void 0,c):l}(0,function(s){if(function(c){return Array.isArray(c==null?void 0:c.errors)}(s))return{values:{},errors:Toe(Poe(s.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw s}))}catch(s){return Promise.reject(s)}}},nn;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const o={};for(const s of i)o[s]=s;return o},t.getValidEnumValues=i=>{const o=t.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),s={};for(const c of o)s[c]=i[c];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(const s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=r,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(nn||(nn={}));var mA;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(mA||(mA={}));const Ye=nn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),dc=t=>{switch(typeof t){case"undefined":return Ye.undefined;case"string":return Ye.string;case"number":return isNaN(t)?Ye.nan:Ye.number;case"boolean":return Ye.boolean;case"function":return Ye.function;case"bigint":return Ye.bigint;case"symbol":return Ye.symbol;case"object":return Array.isArray(t)?Ye.array:t===null?Ye.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ye.promise:typeof Map<"u"&&t instanceof Map?Ye.map:typeof Set<"u"&&t instanceof Set?Ye.set:typeof Date<"u"&&t instanceof Date?Ye.date:Ye.object;default:return Ye.unknown}},_e=nn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),koe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class eo extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const n=e||function(o){return o.message},r={_errors:[]},i=o=>{for(const s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let c=r,l=0;for(;ln.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}eo.create=t=>new eo(t);const Zd=(t,e)=>{let n;switch(t.code){case _e.invalid_type:t.received===Ye.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case _e.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,nn.jsonStringifyReplacer)}`;break;case _e.unrecognized_keys:n=`Unrecognized key(s) in object: ${nn.joinValues(t.keys,", ")}`;break;case _e.invalid_union:n="Invalid input";break;case _e.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${nn.joinValues(t.options)}`;break;case _e.invalid_enum_value:n=`Invalid enum value. Expected ${nn.joinValues(t.options)}, received '${t.received}'`;break;case _e.invalid_arguments:n="Invalid function arguments";break;case _e.invalid_return_type:n="Invalid function return type";break;case _e.invalid_date:n="Invalid date";break;case _e.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:nn.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case _e.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case _e.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case _e.custom:n="Invalid input";break;case _e.invalid_intersection_types:n="Intersection results could not be merged";break;case _e.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case _e.not_finite:n="Number must be finite";break;default:n=e.defaultError,nn.assertNever(t)}return{message:n}};let v3=Zd;function Ooe(t){v3=t}function Sx(){return v3}const Cx=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,o=[...n,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let c="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)c=u(s,{data:e,defaultError:c}).message;return{...i,path:o,message:c}},Ioe=[];function ze(t,e){const n=Sx(),r=Cx({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Zd?void 0:Zd].filter(i=>!!i)});t.common.issues.push(r)}class oi{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return Tt;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const o=await i.key,s=await i.value;r.push({key:o,value:s})}return oi.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return Tt;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(r[o.value]=s.value)}return{status:e.value,value:r}}}const Tt=Object.freeze({status:"aborted"}),cd=t=>({status:"dirty",value:t}),xi=t=>({status:"valid",value:t}),gA=t=>t.status==="aborted",vA=t=>t.status==="dirty",rm=t=>t.status==="valid",im=t=>typeof Promise<"u"&&t instanceof Promise;function _x(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function y3(t,e,n,r,i){if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var at;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(at||(at={}));var Kh,Wh;class Ks{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const hR=(t,e)=>{if(rm(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new eo(t.common.issues);return this._error=n,this._error}}};function Lt(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,c)=>{var l,u;const{message:d}=t;return s.code==="invalid_enum_value"?{message:d??c.defaultError}:typeof c.data>"u"?{message:(l=d??r)!==null&&l!==void 0?l:c.defaultError}:s.code!=="invalid_type"?{message:c.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:c.defaultError}},description:i}}class Wt{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return dc(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:dc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new oi,ctx:{common:e.parent.common,data:e.data,parsedType:dc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(im(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dc(e)},o=this._parseSync({data:e,path:i.path,parent:i});return hR(i,o)}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dc(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(im(i)?i:Promise.resolve(i));return hR(r,o)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const s=e(i),c=()=>o.addIssue({code:_e.custom,...r(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(c(),!1)):s?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new ds({schema:this,typeName:jt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ls.create(this,this._def)}nullable(){return tl.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return es.create(this,this._def)}promise(){return tf.create(this,this._def)}or(e){return cm.create([this,e],this._def)}and(e){return lm.create(this,e,this._def)}transform(e){return new ds({...Lt(this._def),schema:this,typeName:jt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new pm({...Lt(this._def),innerType:this,defaultValue:n,typeName:jt.ZodDefault})}brand(){return new sN({typeName:jt.ZodBranded,type:this,...Lt(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new mm({...Lt(this._def),innerType:this,catchValue:n,typeName:jt.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return bg.create(this,e)}readonly(){return gm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Roe=/^c[^\s-]{8,}$/i,Moe=/^[0-9a-z]+$/,Doe=/^[0-9A-HJKMNP-TV-Z]{26}$/,$oe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Loe=/^[a-z0-9_-]{21}$/i,Foe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Boe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Uoe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let KS;const Hoe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,zoe=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Goe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,x3="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Voe=new RegExp(`^${x3}$`);function b3(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Koe(t){return new RegExp(`^${b3(t)}$`)}function w3(t){let e=`${x3}T${b3(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Woe(t,e){return!!((e==="v4"||!e)&&Hoe.test(t)||(e==="v6"||!e)&&zoe.test(t))}class qo extends Wt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ye.string){const o=this._getOrReturnCtx(e);return ze(o,{code:_e.invalid_type,expected:Ye.string,received:o.parsedType}),Tt}const r=new oi;let i;for(const o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(i=this._getOrReturnCtx(e,i),ze(i,{code:_e.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const s=e.data.length>o.value,c=e.data.lengthe.test(i),{validation:n,code:_e.invalid_string,...at.errToObj(r)})}_addCheck(e){return new qo({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...at.errToObj(e)})}url(e){return this._addCheck({kind:"url",...at.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...at.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...at.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...at.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...at.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...at.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...at.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...at.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...at.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...at.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...at.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...at.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...at.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...at.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...at.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...at.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...at.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...at.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...at.errToObj(n)})}nonempty(e){return this.min(1,at.errToObj(e))}trim(){return new qo({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new qo({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new qo({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value{var e;return new qo({checks:[],typeName:jt.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Lt(t)})};function qoe(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(t.toFixed(i).replace(".","")),s=parseInt(e.toFixed(i).replace(".",""));return o%s/Math.pow(10,i)}class Jc extends Wt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ye.number){const o=this._getOrReturnCtx(e);return ze(o,{code:_e.invalid_type,expected:Ye.number,received:o.parsedType}),Tt}let r;const i=new oi;for(const o of this._def.checks)o.kind==="int"?nn.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?qoe(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.not_finite,message:o.message}),i.dirty()):nn.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,at.toString(n))}gt(e,n){return this.setLimit("min",e,!1,at.toString(n))}lte(e,n){return this.setLimit("max",e,!0,at.toString(n))}lt(e,n){return this.setLimit("max",e,!1,at.toString(n))}setLimit(e,n,r,i){return new Jc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:at.toString(i)}]})}_addCheck(e){return new Jc({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:at.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:at.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:at.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:at.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:at.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:at.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:at.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:at.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:at.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuee.kind==="int"||e.kind==="multipleOf"&&nn.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.valuenew Jc({checks:[],typeName:jt.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Lt(t)});class Zc extends Wt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Ye.bigint){const o=this._getOrReturnCtx(e);return ze(o,{code:_e.invalid_type,expected:Ye.bigint,received:o.parsedType}),Tt}let r;const i=new oi;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):nn.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,at.toString(n))}gt(e,n){return this.setLimit("min",e,!1,at.toString(n))}lte(e,n){return this.setLimit("max",e,!0,at.toString(n))}lt(e,n){return this.setLimit("max",e,!1,at.toString(n))}setLimit(e,n,r,i){return new Zc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:at.toString(i)}]})}_addCheck(e){return new Zc({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:at.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:at.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:at.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:at.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:at.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value{var e;return new Zc({checks:[],typeName:jt.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Lt(t)})};class om extends Wt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ye.boolean){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:Ye.boolean,received:r.parsedType}),Tt}return xi(e.data)}}om.create=t=>new om({typeName:jt.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Lt(t)});class gu extends Wt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ye.date){const o=this._getOrReturnCtx(e);return ze(o,{code:_e.invalid_type,expected:Ye.date,received:o.parsedType}),Tt}if(isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return ze(o,{code:_e.invalid_date}),Tt}const r=new oi;let i;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(i=this._getOrReturnCtx(e,i),ze(i,{code:_e.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):nn.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new gu({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:at.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:at.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew gu({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:jt.ZodDate,...Lt(t)});class Ax extends Wt{_parse(e){if(this._getType(e)!==Ye.symbol){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:Ye.symbol,received:r.parsedType}),Tt}return xi(e.data)}}Ax.create=t=>new Ax({typeName:jt.ZodSymbol,...Lt(t)});class sm extends Wt{_parse(e){if(this._getType(e)!==Ye.undefined){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:Ye.undefined,received:r.parsedType}),Tt}return xi(e.data)}}sm.create=t=>new sm({typeName:jt.ZodUndefined,...Lt(t)});class am extends Wt{_parse(e){if(this._getType(e)!==Ye.null){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:Ye.null,received:r.parsedType}),Tt}return xi(e.data)}}am.create=t=>new am({typeName:jt.ZodNull,...Lt(t)});class ef extends Wt{constructor(){super(...arguments),this._any=!0}_parse(e){return xi(e.data)}}ef.create=t=>new ef({typeName:jt.ZodAny,...Lt(t)});class Yl extends Wt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return xi(e.data)}}Yl.create=t=>new Yl({typeName:jt.ZodUnknown,...Lt(t)});class La extends Wt{_parse(e){const n=this._getOrReturnCtx(e);return ze(n,{code:_e.invalid_type,expected:Ye.never,received:n.parsedType}),Tt}}La.create=t=>new La({typeName:jt.ZodNever,...Lt(t)});class jx extends Wt{_parse(e){if(this._getType(e)!==Ye.undefined){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:Ye.void,received:r.parsedType}),Tt}return xi(e.data)}}jx.create=t=>new jx({typeName:jt.ZodVoid,...Lt(t)});class es extends Wt{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==Ye.array)return ze(n,{code:_e.invalid_type,expected:Ye.array,received:n.parsedType}),Tt;if(i.exactLength!==null){const s=n.data.length>i.exactLength.value,c=n.data.lengthi.maxLength.value&&(ze(n,{code:_e.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,c)=>i.type._parseAsync(new Ks(n,s,n.path,c)))).then(s=>oi.mergeArray(r,s));const o=[...n.data].map((s,c)=>i.type._parseSync(new Ks(n,s,n.path,c)));return oi.mergeArray(r,o)}get element(){return this._def.type}min(e,n){return new es({...this._def,minLength:{value:e,message:at.toString(n)}})}max(e,n){return new es({...this._def,maxLength:{value:e,message:at.toString(n)}})}length(e,n){return new es({...this._def,exactLength:{value:e,message:at.toString(n)}})}nonempty(e){return this.min(1,e)}}es.create=(t,e)=>new es({type:t,minLength:null,maxLength:null,exactLength:null,typeName:jt.ZodArray,...Lt(e)});function Yu(t){if(t instanceof Vn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Ls.create(Yu(r))}return new Vn({...t._def,shape:()=>e})}else return t instanceof es?new es({...t._def,type:Yu(t.element)}):t instanceof Ls?Ls.create(Yu(t.unwrap())):t instanceof tl?tl.create(Yu(t.unwrap())):t instanceof Ws?Ws.create(t.items.map(e=>Yu(e))):t}class Vn extends Wt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=nn.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==Ye.object){const u=this._getOrReturnCtx(e);return ze(u,{code:_e.invalid_type,expected:Ye.object,received:u.parsedType}),Tt}const{status:r,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),c=[];if(!(this._def.catchall instanceof La&&this._def.unknownKeys==="strip"))for(const u in i.data)s.includes(u)||c.push(u);const l=[];for(const u of s){const d=o[u],f=i.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new Ks(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof La){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of c)l.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")c.length>0&&(ze(i,{code:_e.unrecognized_keys,keys:c}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of c){const f=i.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new Ks(i,f,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of l){const f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>oi.mergeObjectSync(r,u)):oi.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return at.errToObj,new Vn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o,s,c;const l=(s=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(c=at.errToObj(e).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new Vn({...this._def,unknownKeys:"strip"})}passthrough(){return new Vn({...this._def,unknownKeys:"passthrough"})}extend(e){return new Vn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Vn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:jt.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Vn({...this._def,catchall:e})}pick(e){const n={};return nn.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Vn({...this._def,shape:()=>n})}omit(e){const n={};return nn.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new Vn({...this._def,shape:()=>n})}deepPartial(){return Yu(this)}partial(e){const n={};return nn.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}),new Vn({...this._def,shape:()=>n})}required(e){const n={};return nn.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Ls;)o=o._def.innerType;n[r]=o}}),new Vn({...this._def,shape:()=>n})}keyof(){return S3(nn.objectKeys(this.shape))}}Vn.create=(t,e)=>new Vn({shape:()=>t,unknownKeys:"strip",catchall:La.create(),typeName:jt.ZodObject,...Lt(e)});Vn.strictCreate=(t,e)=>new Vn({shape:()=>t,unknownKeys:"strict",catchall:La.create(),typeName:jt.ZodObject,...Lt(e)});Vn.lazycreate=(t,e)=>new Vn({shape:t,unknownKeys:"strip",catchall:La.create(),typeName:jt.ZodObject,...Lt(e)});class cm extends Wt{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(o){for(const c of o)if(c.result.status==="valid")return c.result;for(const c of o)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const s=o.map(c=>new eo(c.ctx.common.issues));return ze(n,{code:_e.invalid_union,unionErrors:s}),Tt}if(n.common.async)return Promise.all(r.map(async o=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let o;const s=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=l._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const c=s.map(l=>new eo(l));return ze(n,{code:_e.invalid_union,unionErrors:c}),Tt}}get options(){return this._def.options}}cm.create=(t,e)=>new cm({options:t,typeName:jt.ZodUnion,...Lt(e)});const ca=t=>t instanceof dm?ca(t.schema):t instanceof ds?ca(t.innerType()):t instanceof fm?[t.value]:t instanceof el?t.options:t instanceof hm?nn.objectValues(t.enum):t instanceof pm?ca(t._def.innerType):t instanceof sm?[void 0]:t instanceof am?[null]:t instanceof Ls?[void 0,...ca(t.unwrap())]:t instanceof tl?[null,...ca(t.unwrap())]:t instanceof sN||t instanceof gm?ca(t.unwrap()):t instanceof mm?ca(t._def.innerType):[];class V0 extends Wt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ye.object)return ze(n,{code:_e.invalid_type,expected:Ye.object,received:n.parsedType}),Tt;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(ze(n,{code:_e.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Tt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const i=new Map;for(const o of n){const s=ca(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const c of s){if(i.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);i.set(c,o)}}return new V0({typeName:jt.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...Lt(r)})}}function yA(t,e){const n=dc(t),r=dc(e);if(t===e)return{valid:!0,data:t};if(n===Ye.object&&r===Ye.object){const i=nn.objectKeys(e),o=nn.objectKeys(t).filter(c=>i.indexOf(c)!==-1),s={...t,...e};for(const c of o){const l=yA(t[c],e[c]);if(!l.valid)return{valid:!1};s[c]=l.data}return{valid:!0,data:s}}else if(n===Ye.array&&r===Ye.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let o=0;o{if(gA(o)||gA(s))return Tt;const c=yA(o.value,s.value);return c.valid?((vA(o)||vA(s))&&n.dirty(),{status:n.value,value:c.data}):(ze(r,{code:_e.invalid_intersection_types}),Tt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}lm.create=(t,e,n)=>new lm({left:t,right:e,typeName:jt.ZodIntersection,...Lt(n)});class Ws extends Wt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ye.array)return ze(r,{code:_e.invalid_type,expected:Ye.array,received:r.parsedType}),Tt;if(r.data.lengththis._def.items.length&&(ze(r,{code:_e.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((s,c)=>{const l=this._def.items[c]||this._def.rest;return l?l._parse(new Ks(r,s,r.path,c)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>oi.mergeArray(n,s)):oi.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new Ws({...this._def,rest:e})}}Ws.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ws({items:t,typeName:jt.ZodTuple,rest:null,...Lt(e)})};class um extends Wt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ye.object)return ze(r,{code:_e.invalid_type,expected:Ye.object,received:r.parsedType}),Tt;const i=[],o=this._def.keyType,s=this._def.valueType;for(const c in r.data)i.push({key:o._parse(new Ks(r,c,r.path,c)),value:s._parse(new Ks(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?oi.mergeObjectAsync(n,i):oi.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Wt?new um({keyType:e,valueType:n,typeName:jt.ZodRecord,...Lt(r)}):new um({keyType:qo.create(),valueType:e,typeName:jt.ZodRecord,...Lt(n)})}}class Ex extends Wt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ye.map)return ze(r,{code:_e.invalid_type,expected:Ye.map,received:r.parsedType}),Tt;const i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([c,l],u)=>({key:i._parse(new Ks(r,c,r.path,[u,"key"])),value:o._parse(new Ks(r,l,r.path,[u,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const l of s){const u=await l.key,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return Tt;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),c.set(u.value,d.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const l of s){const u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return Tt;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),c.set(u.value,d.value)}return{status:n.value,value:c}}}}Ex.create=(t,e,n)=>new Ex({valueType:e,keyType:t,typeName:jt.ZodMap,...Lt(n)});class vu extends Wt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ye.set)return ze(r,{code:_e.invalid_type,expected:Ye.set,received:r.parsedType}),Tt;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(ze(r,{code:_e.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function s(l){const u=new Set;for(const d of l){if(d.status==="aborted")return Tt;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const c=[...r.data.values()].map((l,u)=>o._parse(new Ks(r,l,r.path,u)));return r.common.async?Promise.all(c).then(l=>s(l)):s(c)}min(e,n){return new vu({...this._def,minSize:{value:e,message:at.toString(n)}})}max(e,n){return new vu({...this._def,maxSize:{value:e,message:at.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}vu.create=(t,e)=>new vu({valueType:t,minSize:null,maxSize:null,typeName:jt.ZodSet,...Lt(e)});class Ad extends Wt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ye.function)return ze(n,{code:_e.invalid_type,expected:Ye.function,received:n.parsedType}),Tt;function r(c,l){return Cx({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Sx(),Zd].filter(u=>!!u),issueData:{code:_e.invalid_arguments,argumentsError:l}})}function i(c,l){return Cx({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Sx(),Zd].filter(u=>!!u),issueData:{code:_e.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof tf){const c=this;return xi(async function(...l){const u=new eo([]),d=await c._def.args.parseAsync(l,o).catch(p=>{throw u.addIssue(r(l,p)),u}),f=await Reflect.apply(s,this,d);return await c._def.returns._def.type.parseAsync(f,o).catch(p=>{throw u.addIssue(i(f,p)),u})})}else{const c=this;return xi(function(...l){const u=c._def.args.safeParse(l,o);if(!u.success)throw new eo([r(l,u.error)]);const d=Reflect.apply(s,this,u.data),f=c._def.returns.safeParse(d,o);if(!f.success)throw new eo([i(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ad({...this._def,args:Ws.create(e).rest(Yl.create())})}returns(e){return new Ad({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new Ad({args:e||Ws.create([]).rest(Yl.create()),returns:n||Yl.create(),typeName:jt.ZodFunction,...Lt(r)})}}class dm extends Wt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}dm.create=(t,e)=>new dm({getter:t,typeName:jt.ZodLazy,...Lt(e)});class fm extends Wt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ze(n,{received:n.data,code:_e.invalid_literal,expected:this._def.value}),Tt}return{status:"valid",value:e.data}}get value(){return this._def.value}}fm.create=(t,e)=>new fm({value:t,typeName:jt.ZodLiteral,...Lt(e)});function S3(t,e){return new el({values:t,typeName:jt.ZodEnum,...Lt(e)})}class el extends Wt{constructor(){super(...arguments),Kh.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return ze(n,{expected:nn.joinValues(r),received:n.parsedType,code:_e.invalid_type}),Tt}if(_x(this,Kh)||y3(this,Kh,new Set(this._def.values)),!_x(this,Kh).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return ze(n,{received:n.data,code:_e.invalid_enum_value,options:r}),Tt}return xi(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return el.create(e,{...this._def,...n})}exclude(e,n=this._def){return el.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Kh=new WeakMap;el.create=S3;class hm extends Wt{constructor(){super(...arguments),Wh.set(this,void 0)}_parse(e){const n=nn.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ye.string&&r.parsedType!==Ye.number){const i=nn.objectValues(n);return ze(r,{expected:nn.joinValues(i),received:r.parsedType,code:_e.invalid_type}),Tt}if(_x(this,Wh)||y3(this,Wh,new Set(nn.getValidEnumValues(this._def.values))),!_x(this,Wh).has(e.data)){const i=nn.objectValues(n);return ze(r,{received:r.data,code:_e.invalid_enum_value,options:i}),Tt}return xi(e.data)}get enum(){return this._def.values}}Wh=new WeakMap;hm.create=(t,e)=>new hm({values:t,typeName:jt.ZodNativeEnum,...Lt(e)});class tf extends Wt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ye.promise&&n.common.async===!1)return ze(n,{code:_e.invalid_type,expected:Ye.promise,received:n.parsedType}),Tt;const r=n.parsedType===Ye.promise?n.data:Promise.resolve(n.data);return xi(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}tf.create=(t,e)=>new tf({type:t,typeName:jt.ZodPromise,...Lt(e)});class ds extends Wt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===jt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{ze(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const s=i.transform(r.data,o);if(r.common.async)return Promise.resolve(s).then(async c=>{if(n.value==="aborted")return Tt;const l=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return l.status==="aborted"?Tt:l.status==="dirty"||n.value==="dirty"?cd(l.value):l});{if(n.value==="aborted")return Tt;const c=this._def.schema._parseSync({data:s,path:r.path,parent:r});return c.status==="aborted"?Tt:c.status==="dirty"||n.value==="dirty"?cd(c.value):c}}if(i.type==="refinement"){const s=c=>{const l=i.refinement(c,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Tt:(c.status==="dirty"&&n.dirty(),s(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Tt:(c.status==="dirty"&&n.dirty(),s(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!rm(s))return s;const c=i.transform(s.value,o);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>rm(s)?Promise.resolve(i.transform(s.value,o)).then(c=>({status:n.value,value:c})):s);nn.assertNever(i)}}ds.create=(t,e,n)=>new ds({schema:t,typeName:jt.ZodEffects,effect:e,...Lt(n)});ds.createWithPreprocess=(t,e,n)=>new ds({schema:e,effect:{type:"preprocess",transform:t},typeName:jt.ZodEffects,...Lt(n)});class Ls extends Wt{_parse(e){return this._getType(e)===Ye.undefined?xi(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ls.create=(t,e)=>new Ls({innerType:t,typeName:jt.ZodOptional,...Lt(e)});class tl extends Wt{_parse(e){return this._getType(e)===Ye.null?xi(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}tl.create=(t,e)=>new tl({innerType:t,typeName:jt.ZodNullable,...Lt(e)});class pm extends Wt{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Ye.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}pm.create=(t,e)=>new pm({innerType:t,typeName:jt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Lt(e)});class mm extends Wt{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return im(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new eo(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new eo(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}mm.create=(t,e)=>new mm({innerType:t,typeName:jt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Lt(e)});class Tx extends Wt{_parse(e){if(this._getType(e)!==Ye.nan){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:Ye.nan,received:r.parsedType}),Tt}return{status:"valid",value:e.data}}}Tx.create=t=>new Tx({typeName:jt.ZodNaN,...Lt(t)});const Yoe=Symbol("zod_brand");class sN extends Wt{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class bg extends Wt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Tt:o.status==="dirty"?(n.dirty(),cd(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Tt:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new bg({in:e,out:n,typeName:jt.ZodPipeline})}}class gm extends Wt{_parse(e){const n=this._def.innerType._parse(e),r=i=>(rm(i)&&(i.value=Object.freeze(i.value)),i);return im(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}gm.create=(t,e)=>new gm({innerType:t,typeName:jt.ZodReadonly,...Lt(e)});function C3(t,e={},n){return t?ef.create().superRefine((r,i)=>{var o,s;if(!t(r)){const c=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,l=(s=(o=c.fatal)!==null&&o!==void 0?o:n)!==null&&s!==void 0?s:!0,u=typeof c=="string"?{message:c}:c;i.addIssue({code:"custom",...u,fatal:l})}}):ef.create()}const Qoe={object:Vn.lazycreate};var jt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(jt||(jt={}));const Xoe=(t,e={message:`Input not instance of ${t.name}`})=>C3(n=>n instanceof t,e),_3=qo.create,A3=Jc.create,Joe=Tx.create,Zoe=Zc.create,j3=om.create,ese=gu.create,tse=Ax.create,nse=sm.create,rse=am.create,ise=ef.create,ose=Yl.create,sse=La.create,ase=jx.create,cse=es.create,lse=Vn.create,use=Vn.strictCreate,dse=cm.create,fse=V0.create,hse=lm.create,pse=Ws.create,mse=um.create,gse=Ex.create,vse=vu.create,yse=Ad.create,xse=dm.create,bse=fm.create,wse=el.create,Sse=hm.create,Cse=tf.create,pR=ds.create,_se=Ls.create,Ase=tl.create,jse=ds.createWithPreprocess,Ese=bg.create,Tse=()=>_3().optional(),Nse=()=>A3().optional(),Pse=()=>j3().optional(),kse={string:t=>qo.create({...t,coerce:!0}),number:t=>Jc.create({...t,coerce:!0}),boolean:t=>om.create({...t,coerce:!0}),bigint:t=>Zc.create({...t,coerce:!0}),date:t=>gu.create({...t,coerce:!0})},Ose=Tt;var Oe=Object.freeze({__proto__:null,defaultErrorMap:Zd,setErrorMap:Ooe,getErrorMap:Sx,makeIssue:Cx,EMPTY_PATH:Ioe,addIssueToContext:ze,ParseStatus:oi,INVALID:Tt,DIRTY:cd,OK:xi,isAborted:gA,isDirty:vA,isValid:rm,isAsync:im,get util(){return nn},get objectUtil(){return mA},ZodParsedType:Ye,getParsedType:dc,ZodType:Wt,datetimeRegex:w3,ZodString:qo,ZodNumber:Jc,ZodBigInt:Zc,ZodBoolean:om,ZodDate:gu,ZodSymbol:Ax,ZodUndefined:sm,ZodNull:am,ZodAny:ef,ZodUnknown:Yl,ZodNever:La,ZodVoid:jx,ZodArray:es,ZodObject:Vn,ZodUnion:cm,ZodDiscriminatedUnion:V0,ZodIntersection:lm,ZodTuple:Ws,ZodRecord:um,ZodMap:Ex,ZodSet:vu,ZodFunction:Ad,ZodLazy:dm,ZodLiteral:fm,ZodEnum:el,ZodNativeEnum:hm,ZodPromise:tf,ZodEffects:ds,ZodTransformer:ds,ZodOptional:Ls,ZodNullable:tl,ZodDefault:pm,ZodCatch:mm,ZodNaN:Tx,BRAND:Yoe,ZodBranded:sN,ZodPipeline:bg,ZodReadonly:gm,custom:C3,Schema:Wt,ZodSchema:Wt,late:Qoe,get ZodFirstPartyTypeKind(){return jt},coerce:kse,any:ise,array:cse,bigint:Zoe,boolean:j3,date:ese,discriminatedUnion:fse,effect:pR,enum:wse,function:yse,instanceof:Xoe,intersection:hse,lazy:xse,literal:bse,map:gse,nan:Joe,nativeEnum:Sse,never:sse,null:rse,nullable:Ase,number:A3,object:lse,oboolean:Pse,onumber:Nse,optional:_se,ostring:Tse,pipeline:Ese,preprocess:jse,promise:Cse,record:mse,set:vse,strictObject:use,string:_3,symbol:tse,transformer:pR,tuple:pse,undefined:nse,union:dse,unknown:ose,void:ase,NEVER:Ose,ZodIssueCode:_e,quotelessJson:koe,ZodError:eo}),Ise="Label",E3=v.forwardRef((t,e)=>a.jsx(it.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));E3.displayName=Ise;var T3=E3;const Rse=XT("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),mo=v.forwardRef(({className:t,...e},n)=>a.jsx(T3,{ref:n,className:Ne(Rse(),t),...e}));mo.displayName=T3.displayName;const K0=foe,N3=v.createContext({}),vt=({...t})=>a.jsx(N3.Provider,{value:{name:t.name},children:a.jsx(goe,{...t})}),W0=()=>{const t=v.useContext(N3),e=v.useContext(P3),{getFieldState:n,formState:r}=H0(),i=n(t.name,r);if(!t)throw new Error("useFormField should be used within ");const{id:o}=e;return{id:o,name:t.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...i}},P3=v.createContext({}),dt=v.forwardRef(({className:t,...e},n)=>{const r=v.useId();return a.jsx(P3.Provider,{value:{id:r},children:a.jsx("div",{ref:n,className:Ne("space-y-2",t),...e})})});dt.displayName="FormItem";const ft=v.forwardRef(({className:t,...e},n)=>{const{error:r,formItemId:i}=W0();return a.jsx(mo,{ref:n,className:Ne(r&&"text-destructive",t),htmlFor:i,...e})});ft.displayName="FormLabel";const ht=v.forwardRef(({...t},e)=>{const{error:n,formItemId:r,formDescriptionId:i,formMessageId:o}=W0();return a.jsx(Hs,{ref:e,id:r,"aria-describedby":n?`${i} ${o}`:`${i}`,"aria-invalid":!!n,...t})});ht.displayName="FormControl";const Nn=v.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:r}=W0();return a.jsx("p",{ref:n,id:r,className:Ne("text-sm text-muted-foreground",t),...e})});Nn.displayName="FormDescription";const pt=v.forwardRef(({className:t,children:e,...n},r)=>{const{error:i,formMessageId:o}=W0(),s=i?String(i==null?void 0:i.message):e;return s?a.jsx("p",{ref:r,id:o,className:Ne("text-sm font-medium text-destructive",t),...n,children:s}):null});pt.displayName="FormMessage";const Ht=v.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:Ne("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Ht.displayName="Input";const mt=v.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:Ne("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));mt.displayName="Textarea";function vm(t,[e,n]){return Math.min(n,Math.max(e,t))}function Mse(t,e=[]){let n=[];function r(o,s){const c=v.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,y=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=v.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,Dse(i,...e)]}function Dse(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function q0(t){const e=t+"CollectionProvider",[n,r]=Mse(e),[i,o]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:g,children:m}=p,y=N.useRef(null),b=N.useRef(new Map).current;return a.jsx(i,{scope:g,itemMap:b,collectionRef:y,children:m})};s.displayName=e;const c=t+"CollectionSlot",l=N.forwardRef((p,g)=>{const{scope:m,children:y}=p,b=o(c,m),x=Pt(g,b.collectionRef);return a.jsx(Hs,{ref:x,children:y})});l.displayName=c;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=N.forwardRef((p,g)=>{const{scope:m,children:y,...b}=p,x=N.useRef(null),w=Pt(g,x),S=o(u,m);return N.useEffect(()=>(S.itemMap.set(x,{ref:x,...b}),()=>void S.itemMap.delete(x))),a.jsx(Hs,{[d]:"",ref:w,children:y})});f.displayName=u;function h(p){const g=o(t+"CollectionConsumer",p);return N.useCallback(()=>{const y=g.collectionRef.current;if(!y)return[];const b=Array.from(y.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((S,C)=>b.indexOf(S.ref.current)-b.indexOf(C.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}var $se=v.createContext(void 0);function Nu(t){const e=v.useContext($se);return t||e||"ltr"}var WS=0;function aN(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??mR()),document.body.insertAdjacentElement("beforeend",t[1]??mR()),WS++,()=>{WS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),WS--}},[])}function mR(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var qS="focusScope.autoFocusOnMount",YS="focusScope.autoFocusOnUnmount",gR={bubbles:!1,cancelable:!0},Lse="FocusScope",Y0=v.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=t,[c,l]=v.useState(null),u=Cr(i),d=Cr(o),f=v.useRef(null),h=Pt(e,m=>l(m)),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let m=function(w){if(p.paused||!c)return;const S=w.target;c.contains(S)?f.current=S:tc(f.current,{select:!0})},y=function(w){if(p.paused||!c)return;const S=w.relatedTarget;S!==null&&(c.contains(S)||tc(f.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&tc(c)};document.addEventListener("focusin",m),document.addEventListener("focusout",y);const x=new MutationObserver(b);return c&&x.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",y),x.disconnect()}}},[r,c,p.paused]),v.useEffect(()=>{if(c){yR.add(p);const m=document.activeElement;if(!c.contains(m)){const b=new CustomEvent(qS,gR);c.addEventListener(qS,u),c.dispatchEvent(b),b.defaultPrevented||(Fse(Gse(k3(c)),{select:!0}),document.activeElement===m&&tc(c))}return()=>{c.removeEventListener(qS,u),setTimeout(()=>{const b=new CustomEvent(YS,gR);c.addEventListener(YS,d),c.dispatchEvent(b),b.defaultPrevented||tc(m??document.body,{select:!0}),c.removeEventListener(YS,d),yR.remove(p)},0)}}},[c,u,d,p]);const g=v.useCallback(m=>{if(!n&&!r||p.paused)return;const y=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(y&&b){const x=m.currentTarget,[w,S]=Bse(x);w&&S?!m.shiftKey&&b===S?(m.preventDefault(),n&&tc(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),n&&tc(S,{select:!0})):b===x&&m.preventDefault()}},[n,r,p.paused]);return a.jsx(it.div,{tabIndex:-1,...s,ref:h,onKeyDown:g})});Y0.displayName=Lse;function Fse(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(tc(r,{select:e}),document.activeElement!==n)return}function Bse(t){const e=k3(t),n=vR(e,t),r=vR(e.reverse(),t);return[n,r]}function k3(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function vR(t,e){for(const n of t)if(!Use(n,{upTo:e}))return n}function Use(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Hse(t){return t instanceof HTMLInputElement&&"select"in t}function tc(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Hse(t)&&e&&t.select()}}var yR=zse();function zse(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=xR(t,e),t.unshift(e)},remove(e){var n;t=xR(t,e),(n=t[0])==null||n.resume()}}}function xR(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Gse(t){return t.filter(e=>e.tagName!=="A")}function wg(t){const e=v.useRef({value:t,previous:t});return v.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Vse=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Bu=new WeakMap,gv=new WeakMap,vv={},QS=0,O3=function(t){return t&&(t.host||O3(t.parentNode))},Kse=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=O3(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},Wse=function(t,e,n,r){var i=Kse(e,Array.isArray(t)?t:[t]);vv[n]||(vv[n]=new WeakMap);var o=vv[n],s=[],c=new Set,l=new Set(i),u=function(f){!f||c.has(f)||(c.add(f),u(f.parentNode))};i.forEach(u);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(c.has(h))d(h);else try{var p=h.getAttribute(r),g=p!==null&&p!=="false",m=(Bu.get(h)||0)+1,y=(o.get(h)||0)+1;Bu.set(h,m),o.set(h,y),s.push(h),m===1&&g&&gv.set(h,!0),y===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(e),c.clear(),QS++,function(){s.forEach(function(f){var h=Bu.get(f)-1,p=o.get(f)-1;Bu.set(f,h),o.set(f,p),h||(gv.has(f)||f.removeAttribute(r),gv.delete(f)),p||f.removeAttribute(n)}),QS--,QS||(Bu=new WeakMap,Bu=new WeakMap,gv=new WeakMap,vv={})}},cN=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=Vse(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),Wse(r,i,n,"aria-hidden")):function(){return null}},Ps=function(){return Ps=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return uae;var e=dae(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},hae=D3(),jd="data-scroll-locked",pae=function(t,e,n,r){var i=t.left,o=t.top,s=t.right,c=t.gap;return n===void 0&&(n="margin"),` - .`.concat(Yse,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(c,"px ").concat(r,`; - } - body[`).concat(jd,`] { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(i,`px; - padding-top: `).concat(o,`px; - padding-right: `).concat(s,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(c,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(oy,` { - right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(sy,` { - margin-right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(oy," .").concat(oy,` { - right: 0 `).concat(r,`; - } - - .`).concat(sy," .").concat(sy,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(jd,`] { - `).concat(Qse,": ").concat(c,`px; - } -`)},wR=function(){var t=parseInt(document.body.getAttribute(jd)||"0",10);return isFinite(t)?t:0},mae=function(){v.useEffect(function(){return document.body.setAttribute(jd,(wR()+1).toString()),function(){var t=wR()-1;t<=0?document.body.removeAttribute(jd):document.body.setAttribute(jd,t.toString())}},[])},gae=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;mae();var o=v.useMemo(function(){return fae(i)},[i]);return v.createElement(hae,{styles:pae(o,!e,i,n?"":"!important")})},xA=!1;if(typeof window<"u")try{var yv=Object.defineProperty({},"passive",{get:function(){return xA=!0,!0}});window.addEventListener("test",yv,yv),window.removeEventListener("test",yv,yv)}catch{xA=!1}var Uu=xA?{passive:!1}:!1,vae=function(t){return t.tagName==="TEXTAREA"},$3=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!vae(t)&&n[e]==="visible")},yae=function(t){return $3(t,"overflowY")},xae=function(t){return $3(t,"overflowX")},SR=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=L3(t,r);if(i){var o=F3(t,r),s=o[1],c=o[2];if(s>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},bae=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},wae=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},L3=function(t,e){return t==="v"?yae(e):xae(e)},F3=function(t,e){return t==="v"?bae(e):wae(e)},Sae=function(t,e){return t==="h"&&e==="rtl"?-1:1},Cae=function(t,e,n,r,i){var o=Sae(t,window.getComputedStyle(e).direction),s=o*r,c=n.target,l=e.contains(c),u=!1,d=s>0,f=0,h=0;do{var p=F3(t,c),g=p[0],m=p[1],y=p[2],b=m-y-o*g;(g||b)&&L3(t,c)&&(f+=b,h+=g),c instanceof ShadowRoot?c=c.host:c=c.parentNode}while(!l&&c!==document.body||l&&(e.contains(c)||e===c));return(d&&(Math.abs(f)<1||!i)||!d&&(Math.abs(h)<1||!i))&&(u=!0),u},xv=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},CR=function(t){return[t.deltaX,t.deltaY]},_R=function(t){return t&&"current"in t?t.current:t},_ae=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Aae=function(t){return` - .block-interactivity-`.concat(t,` {pointer-events: none;} - .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},jae=0,Hu=[];function Eae(t){var e=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(jae++)[0],o=v.useState(D3)[0],s=v.useRef(t);v.useEffect(function(){s.current=t},[t]),v.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var m=qse([t.lockRef.current],(t.shards||[]).map(_R),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var c=v.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var b=xv(m),x=n.current,w="deltaX"in m?m.deltaX:x[0]-b[0],S="deltaY"in m?m.deltaY:x[1]-b[1],C,_=m.target,A=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in m&&A==="h"&&_.type==="range")return!1;var j=SR(A,_);if(!j)return!0;if(j?C=A:(C=A==="v"?"h":"v",j=SR(A,_)),!j)return!1;if(!r.current&&"changedTouches"in m&&(w||S)&&(r.current=C),!C)return!0;var P=r.current||C;return Cae(P,y,m,P==="h"?w:S,!0)},[]),l=v.useCallback(function(m){var y=m;if(!(!Hu.length||Hu[Hu.length-1]!==o)){var b="deltaY"in y?CR(y):xv(y),x=e.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&_ae(C.delta,b)})[0];if(x&&x.should){y.cancelable&&y.preventDefault();return}if(!x){var w=(s.current.shards||[]).map(_R).filter(Boolean).filter(function(C){return C.contains(y.target)}),S=w.length>0?c(y,w[0]):!s.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),u=v.useCallback(function(m,y,b,x){var w={name:m,delta:y,target:b,should:x,shadowParent:Tae(b)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),d=v.useCallback(function(m){n.current=xv(m),r.current=void 0},[]),f=v.useCallback(function(m){u(m.type,CR(m),m.target,c(m,t.lockRef.current))},[]),h=v.useCallback(function(m){u(m.type,xv(m),m.target,c(m,t.lockRef.current))},[]);v.useEffect(function(){return Hu.push(o),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Uu),document.addEventListener("touchmove",l,Uu),document.addEventListener("touchstart",d,Uu),function(){Hu=Hu.filter(function(m){return m!==o}),document.removeEventListener("wheel",l,Uu),document.removeEventListener("touchmove",l,Uu),document.removeEventListener("touchstart",d,Uu)}},[]);var p=t.removeScrollBar,g=t.inert;return v.createElement(v.Fragment,null,g?v.createElement(o,{styles:Aae(i)}):null,p?v.createElement(gae,{gapMode:t.gapMode}):null)}function Tae(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Nae=rae(M3,Eae);var X0=v.forwardRef(function(t,e){return v.createElement(Q0,Ps({},t,{ref:e,sideCar:Nae}))});X0.classNames=Q0.classNames;var Pae=[" ","Enter","ArrowUp","ArrowDown"],kae=[" ","Enter"],Sg="Select",[J0,Z0,Oae]=q0(Sg),[Kf,cFe]=Li(Sg,[Oae,Df]),ew=Df(),[Iae,ll]=Kf(Sg),[Rae,Mae]=Kf(Sg),B3=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:o,value:s,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:g}=t,m=ew(e),[y,b]=v.useState(null),[x,w]=v.useState(null),[S,C]=v.useState(!1),_=Nu(u),[A=!1,j]=as({prop:r,defaultProp:i,onChange:o}),[P,k]=as({prop:s,defaultProp:c,onChange:l}),O=v.useRef(null),E=y?g||!!y.closest("form"):!0,[I,D]=v.useState(new Set),z=Array.from(I).map($=>$.props.value).join(";");return a.jsx(k4,{...m,children:a.jsxs(Iae,{required:p,scope:e,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Xo(),value:P,onValueChange:k,open:A,onOpenChange:j,dir:_,triggerPointerDownPosRef:O,disabled:h,children:[a.jsx(J0.Provider,{scope:e,children:a.jsx(Rae,{scope:t.__scopeSelect,onNativeOptionAdd:v.useCallback($=>{D(G=>new Set(G).add($))},[]),onNativeOptionRemove:v.useCallback($=>{D(G=>{const R=new Set(G);return R.delete($),R})},[]),children:n})}),E?a.jsxs(d6,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:P,onChange:$=>k($.target.value),disabled:h,form:g,children:[P===void 0?a.jsx("option",{value:""}):null,Array.from(I)]},z):null]})})};B3.displayName=Sg;var U3="SelectTrigger",H3=v.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,o=ew(n),s=ll(U3,n),c=s.disabled||r,l=Pt(e,s.onTriggerChange),u=Z0(n),d=v.useRef("touch"),[f,h,p]=f6(m=>{const y=u().filter(w=>!w.disabled),b=y.find(w=>w.value===s.value),x=h6(y,m,b);x!==void 0&&s.onValueChange(x.value)}),g=m=>{c||(s.onOpenChange(!0),p()),m&&(s.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return a.jsx(bE,{asChild:!0,...o,children:a.jsx(it.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":u6(s.value)?"":void 0,...i,ref:l,onClick:Te(i.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:Te(i.onPointerDown,m=>{d.current=m.pointerType;const y=m.target;y.hasPointerCapture(m.pointerId)&&y.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:Te(i.onKeyDown,m=>{const y=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(y&&m.key===" ")&&Pae.includes(m.key)&&(g(),m.preventDefault())})})})});H3.displayName=U3;var z3="SelectValue",G3=v.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:s="",...c}=t,l=ll(z3,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=Pt(e,l.onValueNodeChange);return Kr(()=>{u(d)},[u,d]),a.jsx(it.span,{...c,ref:f,style:{pointerEvents:"none"},children:u6(l.value)?a.jsx(a.Fragment,{children:s}):o})});G3.displayName=z3;var Dae="SelectIcon",V3=v.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return a.jsx(it.span,{"aria-hidden":!0,...i,ref:e,children:r||"ā–¼"})});V3.displayName=Dae;var $ae="SelectPortal",K3=t=>a.jsx(d0,{asChild:!0,...t});K3.displayName=$ae;var yu="SelectContent",W3=v.forwardRef((t,e)=>{const n=ll(yu,t.__scopeSelect),[r,i]=v.useState();if(Kr(()=>{i(new DocumentFragment)},[]),!n.open){const o=r;return o?If.createPortal(a.jsx(q3,{scope:t.__scopeSelect,children:a.jsx(J0.Slot,{scope:t.__scopeSelect,children:a.jsx("div",{children:t.children})})}),o):null}return a.jsx(Y3,{...t,ref:e})});W3.displayName=yu;var Do=10,[q3,ul]=Kf(yu),Lae="SelectContentImpl",Y3=v.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:y,...b}=t,x=ll(yu,n),[w,S]=v.useState(null),[C,_]=v.useState(null),A=Pt(e,ae=>S(ae)),[j,P]=v.useState(null),[k,O]=v.useState(null),E=Z0(n),[I,D]=v.useState(!1),z=v.useRef(!1);v.useEffect(()=>{if(w)return cN(w)},[w]),aN();const $=v.useCallback(ae=>{const[De,...de]=E().map(Z=>Z.ref.current),[ye]=de.slice(-1),Ee=document.activeElement;for(const Z of ae)if(Z===Ee||(Z==null||Z.scrollIntoView({block:"nearest"}),Z===De&&C&&(C.scrollTop=0),Z===ye&&C&&(C.scrollTop=C.scrollHeight),Z==null||Z.focus(),document.activeElement!==Ee))return},[E,C]),G=v.useCallback(()=>$([j,w]),[$,j,w]);v.useEffect(()=>{I&&G()},[I,G]);const{onOpenChange:R,triggerPointerDownPosRef:L}=x;v.useEffect(()=>{if(w){let ae={x:0,y:0};const De=ye=>{var Ee,Z;ae={x:Math.abs(Math.round(ye.pageX)-(((Ee=L.current)==null?void 0:Ee.x)??0)),y:Math.abs(Math.round(ye.pageY)-(((Z=L.current)==null?void 0:Z.y)??0))}},de=ye=>{ae.x<=10&&ae.y<=10?ye.preventDefault():w.contains(ye.target)||R(!1),document.removeEventListener("pointermove",De),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",De),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",De),document.removeEventListener("pointerup",de,{capture:!0})}}},[w,R,L]),v.useEffect(()=>{const ae=()=>R(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[R]);const[W,Y]=f6(ae=>{const De=E().filter(Ee=>!Ee.disabled),de=De.find(Ee=>Ee.ref.current===document.activeElement),ye=h6(De,ae,de);ye&&setTimeout(()=>ye.ref.current.focus())}),te=v.useCallback((ae,De,de)=>{const ye=!z.current&&!de;(x.value!==void 0&&x.value===De||ye)&&(P(ae),ye&&(z.current=!0))},[x.value]),me=v.useCallback(()=>w==null?void 0:w.focus(),[w]),F=v.useCallback((ae,De,de)=>{const ye=!z.current&&!de;(x.value!==void 0&&x.value===De||ye)&&O(ae)},[x.value]),se=r==="popper"?bA:Q3,ne=se===bA?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:y}:{};return a.jsx(q3,{scope:n,content:w,viewport:C,onViewportChange:_,itemRefCallback:te,selectedItem:j,onItemLeave:me,itemTextRefCallback:F,focusSelectedItem:G,selectedItemText:k,position:r,isPositioned:I,searchRef:W,children:a.jsx(X0,{as:Hs,allowPinchZoom:!0,children:a.jsx(Y0,{asChild:!0,trapped:x.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:Te(i,ae=>{var De;(De=x.trigger)==null||De.focus({preventScroll:!0}),ae.preventDefault()}),children:a.jsx(fg,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:a.jsx(se,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:ae=>ae.preventDefault(),...b,...ne,onPlaced:()=>D(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Te(b.onKeyDown,ae=>{const De=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!De&&ae.key.length===1&&Y(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let ye=E().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(ye=ye.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const Ee=ae.target,Z=ye.indexOf(Ee);ye=ye.slice(Z+1)}setTimeout(()=>$(ye)),ae.preventDefault()}})})})})})})});Y3.displayName=Lae;var Fae="SelectItemAlignedPosition",Q3=v.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,o=ll(yu,n),s=ul(yu,n),[c,l]=v.useState(null),[u,d]=v.useState(null),f=Pt(e,A=>d(A)),h=Z0(n),p=v.useRef(!1),g=v.useRef(!0),{viewport:m,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,w=v.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&m&&y&&b){const A=o.trigger.getBoundingClientRect(),j=u.getBoundingClientRect(),P=o.valueNode.getBoundingClientRect(),k=b.getBoundingClientRect();if(o.dir!=="rtl"){const Ee=k.left-j.left,Z=P.left-Ee,ct=A.left-Z,Le=A.width+ct,At=Math.max(Le,j.width),lt=window.innerWidth-Do,Jt=vm(Z,[Do,Math.max(Do,lt-At)]);c.style.minWidth=Le+"px",c.style.left=Jt+"px"}else{const Ee=j.right-k.right,Z=window.innerWidth-P.right-Ee,ct=window.innerWidth-A.right-Z,Le=A.width+ct,At=Math.max(Le,j.width),lt=window.innerWidth-Do,Jt=vm(Z,[Do,Math.max(Do,lt-At)]);c.style.minWidth=Le+"px",c.style.right=Jt+"px"}const O=h(),E=window.innerHeight-Do*2,I=m.scrollHeight,D=window.getComputedStyle(u),z=parseInt(D.borderTopWidth,10),$=parseInt(D.paddingTop,10),G=parseInt(D.borderBottomWidth,10),R=parseInt(D.paddingBottom,10),L=z+$+I+R+G,W=Math.min(y.offsetHeight*5,L),Y=window.getComputedStyle(m),te=parseInt(Y.paddingTop,10),me=parseInt(Y.paddingBottom,10),F=A.top+A.height/2-Do,se=E-F,ne=y.offsetHeight/2,ae=y.offsetTop+ne,De=z+$+ae,de=L-De;if(De<=F){const Ee=O.length>0&&y===O[O.length-1].ref.current;c.style.bottom="0px";const Z=u.clientHeight-m.offsetTop-m.offsetHeight,ct=Math.max(se,ne+(Ee?me:0)+Z+G),Le=De+ct;c.style.height=Le+"px"}else{const Ee=O.length>0&&y===O[0].ref.current;c.style.top="0px";const ct=Math.max(F,z+m.offsetTop+(Ee?te:0)+ne)+de;c.style.height=ct+"px",m.scrollTop=De-F+m.offsetTop}c.style.margin=`${Do}px 0`,c.style.minHeight=W+"px",c.style.maxHeight=E+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,o.trigger,o.valueNode,c,u,m,y,b,o.dir,r]);Kr(()=>w(),[w]);const[S,C]=v.useState();Kr(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const _=v.useCallback(A=>{A&&g.current===!0&&(w(),x==null||x(),g.current=!1)},[w,x]);return a.jsx(Uae,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:p,onScrollButtonChange:_,children:a.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:a.jsx(it.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Q3.displayName=Fae;var Bae="SelectPopperPosition",bA=v.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Do,...o}=t,s=ew(n);return a.jsx(wE,{...s,...o,ref:e,align:r,collisionPadding:i,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});bA.displayName=Bae;var[Uae,lN]=Kf(yu,{}),wA="SelectViewport",X3=v.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,o=ul(wA,n),s=lN(wA,n),c=Pt(e,o.onViewportChange),l=v.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(J0.Slot,{scope:n,children:a.jsx(it.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Te(i.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=s;if(h!=null&&h.current&&f){const p=Math.abs(l.current-d.scrollTop);if(p>0){const g=window.innerHeight-Do*2,m=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),b=Math.max(m,y);if(b0?S:0,f.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});X3.displayName=wA;var J3="SelectGroup",[Hae,zae]=Kf(J3),Gae=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Xo();return a.jsx(Hae,{scope:n,id:i,children:a.jsx(it.div,{role:"group","aria-labelledby":i,...r,ref:e})})});Gae.displayName=J3;var Z3="SelectLabel",e6=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=zae(Z3,n);return a.jsx(it.div,{id:i.id,...r,ref:e})});e6.displayName=Z3;var Nx="SelectItem",[Vae,t6]=Kf(Nx),n6=v.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...s}=t,c=ll(Nx,n),l=ul(Nx,n),u=c.value===r,[d,f]=v.useState(o??""),[h,p]=v.useState(!1),g=Pt(e,x=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,x,r,i)}),m=Xo(),y=v.useRef("touch"),b=()=>{i||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(Vae,{scope:n,value:r,disabled:i,textId:m,isSelected:u,onItemTextChange:v.useCallback(x=>{f(w=>w||((x==null?void 0:x.textContent)??"").trim())},[]),children:a.jsx(J0.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:a.jsx(it.div,{role:"option","aria-labelledby":m,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...s,ref:g,onFocus:Te(s.onFocus,()=>p(!0)),onBlur:Te(s.onBlur,()=>p(!1)),onClick:Te(s.onClick,()=>{y.current!=="mouse"&&b()}),onPointerUp:Te(s.onPointerUp,()=>{y.current==="mouse"&&b()}),onPointerDown:Te(s.onPointerDown,x=>{y.current=x.pointerType}),onPointerMove:Te(s.onPointerMove,x=>{var w;y.current=x.pointerType,i?(w=l.onItemLeave)==null||w.call(l):y.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Te(s.onPointerLeave,x=>{var w;x.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:Te(s.onKeyDown,x=>{var S;((S=l.searchRef)==null?void 0:S.current)!==""&&x.key===" "||(kae.includes(x.key)&&b(),x.key===" "&&x.preventDefault())})})})})});n6.displayName=Nx;var qh="SelectItemText",r6=v.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...o}=t,s=ll(qh,n),c=ul(qh,n),l=t6(qh,n),u=Mae(qh,n),[d,f]=v.useState(null),h=Pt(e,b=>f(b),l.onItemTextChange,b=>{var x;return(x=c.itemTextRefCallback)==null?void 0:x.call(c,b,l.value,l.disabled)}),p=d==null?void 0:d.textContent,g=v.useMemo(()=>a.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:y}=u;return Kr(()=>(m(g),()=>y(g)),[m,y,g]),a.jsxs(a.Fragment,{children:[a.jsx(it.span,{id:l.textId,...o,ref:h}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?If.createPortal(o.children,s.valueNode):null]})});r6.displayName=qh;var i6="SelectItemIndicator",o6=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return t6(i6,n).isSelected?a.jsx(it.span,{"aria-hidden":!0,...r,ref:e}):null});o6.displayName=i6;var SA="SelectScrollUpButton",s6=v.forwardRef((t,e)=>{const n=ul(SA,t.__scopeSelect),r=lN(SA,t.__scopeSelect),[i,o]=v.useState(!1),s=Pt(e,r.onScrollButtonChange);return Kr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollTop>0;o(u)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?a.jsx(c6,{...t,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop-l.offsetHeight)}}):null});s6.displayName=SA;var CA="SelectScrollDownButton",a6=v.forwardRef((t,e)=>{const n=ul(CA,t.__scopeSelect),r=lN(CA,t.__scopeSelect),[i,o]=v.useState(!1),s=Pt(e,r.onScrollButtonChange);return Kr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?a.jsx(c6,{...t,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop+l.offsetHeight)}}):null});a6.displayName=CA;var c6=v.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,o=ul("SelectScrollButton",n),s=v.useRef(null),c=Z0(n),l=v.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return v.useEffect(()=>()=>l(),[l]),Kr(()=>{var d;const u=c().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[c]),a.jsx(it.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:Te(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Te(i.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Te(i.onPointerLeave,()=>{l()})})}),Kae="SelectSeparator",l6=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return a.jsx(it.div,{"aria-hidden":!0,...r,ref:e})});l6.displayName=Kae;var _A="SelectArrow",Wae=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=ew(n),o=ll(_A,n),s=ul(_A,n);return o.open&&s.position==="popper"?a.jsx(SE,{...i,...r,ref:e}):null});Wae.displayName=_A;function u6(t){return t===""||t===void 0}var d6=v.forwardRef((t,e)=>{const{value:n,...r}=t,i=v.useRef(null),o=Pt(e,i),s=wg(n);return v.useEffect(()=>{const c=i.current,l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==n&&d){const f=new Event("change",{bubbles:!0});d.call(c,n),c.dispatchEvent(f)}},[s,n]),a.jsx(CE,{asChild:!0,children:a.jsx("select",{...r,ref:o,defaultValue:n})})});d6.displayName="BubbleSelect";function f6(t){const e=Cr(t),n=v.useRef(""),r=v.useRef(0),i=v.useCallback(s=>{const c=n.current+s;e(c),function l(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(c)},[e]),o=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function h6(t,e,n){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let s=qae(t,Math.max(o,0));i.length===1&&(s=s.filter(u=>u!==n));const l=s.find(u=>u.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function qae(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Yae=B3,p6=H3,Qae=G3,Xae=V3,Jae=K3,m6=W3,Zae=X3,g6=e6,v6=n6,ece=r6,tce=o6,y6=s6,x6=a6,b6=l6;const Un=Yae,Hn=Qae,Ln=v.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(p6,{ref:r,className:Ne("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,a.jsx(Xae,{asChild:!0,children:a.jsx(Ma,{className:"h-4 w-4 opacity-50"})})]}));Ln.displayName=p6.displayName;const w6=v.forwardRef(({className:t,...e},n)=>a.jsx(y6,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(cu,{className:"h-4 w-4"})}));w6.displayName=y6.displayName;const S6=v.forwardRef(({className:t,...e},n)=>a.jsx(x6,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(Ma,{className:"h-4 w-4"})}));S6.displayName=x6.displayName;const Fn=v.forwardRef(({className:t,children:e,position:n="popper",...r},i)=>a.jsx(Jae,{children:a.jsxs(m6,{ref:i,className:Ne("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[a.jsx(w6,{}),a.jsx(Zae,{className:Ne("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(S6,{})]})}));Fn.displayName=m6.displayName;const nce=v.forwardRef(({className:t,...e},n)=>a.jsx(g6,{ref:n,className:Ne("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));nce.displayName=g6.displayName;const oe=v.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(v6,{ref:r,className:Ne("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(tce,{children:a.jsx(Gs,{className:"h-4 w-4"})})}),a.jsx(ece,{children:e})]}));oe.displayName=v6.displayName;const rce=v.forwardRef(({className:t,...e},n)=>a.jsx(b6,{ref:n,className:Ne("-mx-1 my-1 h-px bg-muted",t),...e}));rce.displayName=b6.displayName;const ice=Oe.object({audienceBrief:Oe.string().min(10,{message:"Audience brief must be at least 10 characters."}),researchObjective:Oe.string().optional(),personaCount:Oe.string().min(1,{message:"Number of personas is required."}),dataFile:Oe.instanceof(FileList).optional(),llm_model:Oe.string().optional()});function oce({onSubmit:t,isGenerating:e}){const[n,r]=v.useState(!1),[i,o]=v.useState(!1),[s,c]=v.useState({audience_brief:[],research_objective:[]}),[l,u]=v.useState(!1),[d,f]=v.useState(null),h=z0({resolver:G0(ice),defaultValues:{audienceBrief:"",researchObjective:"",personaCount:"5",llm_model:"gemini-2.5-pro"}}),p=h.watch("audienceBrief"),g=h.watch("researchObjective"),m=async()=>{var w,S,C,_,A,j,P,k,O,E,I;const b=p==null?void 0:p.trim(),x=g==null?void 0:g.trim();if(!b||b.length<10){re.error("Audience brief too short",{description:"Please enter at least 10 characters in the audience brief"});return}if(!x||x.length<10){re.error("Research objective too short",{description:"Please enter at least 10 characters in the research objective"});return}u(!0),f(null);try{const D=await ua.enhanceAudienceBrief(b,x);c(D.data.suggestions||{audience_brief:[],research_objective:[]}),r(!0),o(!1);const z=(((S=(w=D.data.suggestions)==null?void 0:w.audience_brief)==null?void 0:S.length)||0)+(((_=(C=D.data.suggestions)==null?void 0:C.research_objective)==null?void 0:_.length)||0);re.success("Enhancement suggestions generated",{description:`Generated ${z} suggestions to improve your research inputs`})}catch(D){console.error("Error enhancing audience brief:",D);let z="Please try again or modify your brief",$="Failed to generate suggestions";if(D&&typeof D=="object"){const G=D;G.code==="ECONNABORTED"||(A=G.message)!=null&&A.includes("timeout")?($="Request timeout",z="The AI took too long to analyze your brief. Please try again."):((j=G.response)==null?void 0:j.status)===500?($="Server error",z=((k=(P=G.response)==null?void 0:P.data)==null?void 0:k.message)||"The server encountered an error. Please try again later."):((O=G.response)==null?void 0:O.status)===400?($="Invalid brief",z=((I=(E=G.response)==null?void 0:E.data)==null?void 0:I.message)||"Please check your audience brief and try again."):G.message&&(z=G.message)}else D instanceof Error&&(z=D.message);f(z),re.error($,{description:z,duration:5e3})}finally{u(!1)}},y=()=>{o(!i)};return a.jsx(K0,{...h,children:a.jsxs("form",{onSubmit:h.handleSubmit(t),className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-6",children:[a.jsx(vt,{control:h.control,name:"audienceBrief",render:({field:b})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Audience Brief"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Describe your target audience and research goals...",className:"h-40",...b})}),a.jsx(Nn,{children:"Provide details about the demographics, behaviors, and attitudes you want to explore"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:h.control,name:"researchObjective",render:({field:b})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Research Objective"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"What is the main research topic or objective you want to explore?",className:"h-32",...b})}),a.jsx(Nn,{children:"Specify your research focus to generate more targeted persona goals, frustrations, and scenarios"}),a.jsx(pt,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx(J,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:!p||p.trim().length<10||!g||g.trim().length<10||l||e,className:"flex items-center gap-2 hover-transition",children:l?a.jsxs(a.Fragment,{children:[a.jsx(wd,{className:"h-4 w-4 animate-spin"}),"Analyzing Research Inputs..."]}):a.jsxs(a.Fragment,{children:[a.jsx(uu,{className:"h-4 w-4"}),"Enhance Brief"]})})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(vt,{control:h.control,name:"dataFile",render:({field:{value:b,onChange:x,...w}})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Customer Data (Optional)"}),a.jsx(ht,{children:a.jsxs("div",{className:"border-2 border-dashed border-slate-200 rounded-lg p-6 flex flex-col items-center justify-center bg-slate-50 hover:bg-slate-100 transition cursor-pointer",children:[a.jsx(d5,{className:"h-10 w-10 text-slate-400 mb-2"}),a.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Upload customer data for more accurate personas"}),a.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Supports PDF, Office docs, images, and more"}),a.jsx(Ht,{...w,type:"file",multiple:!0,accept:".pdf,.docx,.pptx,.xlsx,.html,.xml,.rtf,.pages,.key,.epub,.txt,.csv,.jpg,.jpeg,.png",onChange:S=>{x(S.target.files)},className:"hidden",id:"data-file-input"}),a.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:()=>{var S;return(S=document.getElementById("data-file-input"))==null?void 0:S.click()},children:[a.jsx(h5,{className:"mr-2 h-4 w-4"}),"Select Files"]}),b&&b.length>0&&a.jsx("p",{className:"text-xs text-primary mt-2",children:b.length===1?b[0].name:`${b.length} files selected`})]})}),a.jsx(Nn,{children:"Upload existing customer data to create more realistic personas"}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"bg-muted/30 p-4 rounded-lg border border-border",children:[a.jsxs("div",{className:"flex items-center mb-2",children:[a.jsx(H_,{className:"h-5 w-5 text-muted-foreground mr-2"}),a.jsx("h3",{className:"font-sf font-medium",children:"What's included?"})]}),a.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Demographic profiles based on your brief"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Personality traits and behavioral patterns"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Consumer preferences and interests"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Review and refine capabilities"]})]})]})]})]}),n&&a.jsxs("div",{className:"glass-panel rounded-lg p-4 border border-border bg-muted/30",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("h3",{className:"font-sf font-medium text-sm flex items-center gap-2",children:[a.jsx(uu,{className:"h-4 w-4 text-primary"}),"Enhancement Suggestions:"]}),a.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:y,className:"h-6 w-6 p-0 hover:bg-slate-200",title:i?"Expand suggestions":"Collapse suggestions",children:i?a.jsx(Ma,{className:"h-4 w-4"}):a.jsx(cu,{className:"h-4 w-4"})})]}),!i&&a.jsx(a.Fragment,{children:d?a.jsx("div",{className:"text-sm text-red-600 bg-red-50 p-3 rounded-md",children:d}):a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx("div",{children:s.audience_brief.length>0?a.jsxs("div",{children:[a.jsxs("h4",{className:"font-sf font-medium text-sm text-slate-800 mb-2 flex items-center gap-2",children:[a.jsx(Dr,{className:"h-4 w-4 text-blue-600"}),"Suggestions for your Audience Brief:"]}),a.jsx("ul",{className:"space-y-2 text-sm text-slate-700",children:s.audience_brief.map((b,x)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-blue-600 mt-1.5 text-xs",children:"•"}),a.jsx("span",{className:"flex-1",children:b})]},x))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No audience brief suggestions available"})}),a.jsx("div",{children:s.research_objective.length>0?a.jsxs("div",{children:[a.jsxs("h4",{className:"font-sf font-medium text-sm text-slate-800 mb-2 flex items-center gap-2",children:[a.jsx(H_,{className:"h-4 w-4 text-green-600"}),"Suggestions for your Research Objective:"]}),a.jsx("ul",{className:"space-y-2 text-sm text-slate-700",children:s.research_objective.map((b,x)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-green-600 mt-1.5 text-xs",children:"•"}),a.jsx("span",{className:"flex-1",children:b})]},x))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No research objective suggestions available"})}),s.audience_brief.length===0&&s.research_objective.length===0&&a.jsx("div",{className:"col-span-full text-sm text-muted-foreground text-center",children:"No suggestions available"})]})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(vt,{control:h.control,name:"llm_model",render:({field:b})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"AI Model"}),a.jsxs(Un,{onValueChange:b.onChange,defaultValue:b.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select AI model"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(oe,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(oe,{value:"gpt-5",children:"GPT-5"})]})]}),a.jsx(Nn,{children:"Choose which AI model to use for generating personas"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:h.control,name:"personaCount",render:({field:b})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Number of Personas to Generate"}),a.jsx(ht,{children:a.jsx(Ht,{type:"number",min:"1",max:"20",...b})}),a.jsx(Nn,{children:"How many synthetic users do you need for your research?"}),a.jsx(pt,{})]})})]}),a.jsxs("div",{className:"flex flex-col items-end",children:[a.jsx(J,{type:"submit",disabled:e,className:"min-w-36",children:e?a.jsxs(a.Fragment,{children:[a.jsx(wd,{className:"mr-2 h-4 w-4 animate-spin"}),"AI Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Dr,{className:"mr-2 h-4 w-4"}),"Generate Personas"]})}),e&&a.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Generating multiple personas in parallel. This may take 1-2 minutes..."})]})]})})}const gt=v.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Ne("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));gt.displayName="Card";const ji=v.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Ne("flex flex-col space-y-1.5 p-6",t),...e}));ji.displayName="CardHeader";const Wi=v.forwardRef(({className:t,...e},n)=>a.jsx("h3",{ref:n,className:Ne("text-2xl font-semibold leading-none tracking-tight",t),...e}));Wi.displayName="CardTitle";const uN=v.forwardRef(({className:t,...e},n)=>a.jsx("p",{ref:n,className:Ne("text-sm text-muted-foreground",t),...e}));uN.displayName="CardDescription";const Rt=v.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Ne("p-6 pt-0",t),...e}));Rt.displayName="CardContent";const dN=v.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Ne("flex items-center p-6 pt-0",t),...e}));dN.displayName="CardFooter";const sce=t=>{const e=t==null?void 0:t.toLowerCase(),n="/semblance/";switch(e){case"male":return`${n}male_avatar.png`;case"female":return`${n}female_avatar.png`;case"non-binary":case"nonbinary":case"non binary":return`${n}nonbinary_avatar.png`;default:return`${n}male_avatar.png`}},Cg=t=>t.avatar||sce(t.gender);function fN({user:t,selected:e=!1,onClick:n,showDetailedDialog:r=!1,onSelectionToggle:i,showAddToFolderButton:o=!1,onAddToFolder:s,onViewDetails:c,folders:l=[]}){const u=ar();v.useState(!1);const[d,f]=v.useState(t),h=t._id||t.id,p=y=>{y.stopPropagation(),u(`/synthetic-users/${h}`)};d.oceanTraits&&(d.oceanTraits.openness,d.oceanTraits.conscientiousness,d.oceanTraits.extraversion,d.oceanTraits.agreeableness,d.oceanTraits.neuroticism);const g=y=>{var w,S;const b=y.target;b.closest("button")&&((S=(w=b.closest("button"))==null?void 0:w.textContent)!=null&&S.includes("View Details"))||(i?i(y):n&&n(y))},m=y=>{y.stopPropagation(),c?c(d):p(y)};return a.jsxs("div",{className:Ne("persona-card glass-card rounded-xl p-4 cursor-pointer hover:shadow-md button-transition",e&&"selected ring-2 ring-primary"),onClick:g,children:[a.jsx("div",{className:"persona-card-overlay"}),a.jsx("div",{className:"persona-card-checkmark",children:a.jsx(Gs,{className:"h-4 w-4 text-primary"})}),a.jsx("div",{className:"relative z-10",children:a.jsxs("div",{className:"flex items-start space-x-4",children:[a.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center",children:a.jsx("img",{src:Cg(d),alt:`${d.name} avatar`,className:"h-12 w-12 rounded-full object-cover"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsx("h3",{className:"text-sm font-medium truncate flex-1",children:d.name})}),a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[d.age," • ",d.gender]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:d.occupation}),a.jsx("p",{className:"text-xs text-muted-foreground",children:d.location}),a.jsx("div",{className:"mt-2",children:d.aiSynthesizedBio?a.jsxs("p",{className:"text-xs text-slate-700 line-clamp-3 leading-relaxed",children:[d.aiSynthesizedBio,d.aiSynthesizedBio.length>150&&"..."]}):a.jsxs("p",{className:"text-xs text-muted-foreground italic line-clamp-3",children:['"',d.personality,'"']})}),d.qualitativeAttributes&&d.qualitativeAttributes.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx("div",{className:"flex flex-wrap gap-1",children:d.qualitativeAttributes.slice(0,3).map((y,b)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-blue-50 text-blue-700 text-xs rounded-full",children:[a.jsx(hZ,{className:"h-3 w-3"}),y]},b))})}),d.folder_ids&&d.folder_ids.length>0&&a.jsx("div",{className:"mt-2",children:a.jsxs("div",{className:"flex flex-wrap gap-1",children:[d.folder_ids.slice(0,2).map(y=>{const b=l.find(x=>x._id===y);return b?a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded-full",title:`In folder: ${b.name}`,children:[a.jsx(ho,{className:"h-3 w-3"}),b.name]},y):null}),d.folder_ids.length>2&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded-full",children:[a.jsx(Ur,{className:"h-3 w-3"}),d.folder_ids.length-2," more"]})]})}),d.topPersonalityTraits&&d.topPersonalityTraits.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx("div",{className:"flex flex-wrap gap-1",children:d.topPersonalityTraits.slice(0,3).map((y,b)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-purple-50 text-purple-700 text-xs rounded-full",children:[a.jsx(au,{className:"h-3 w-3"}),y]},b))})}),a.jsx("div",{className:"mt-3 flex justify-end",children:a.jsx(J,{variant:"ghost",size:"sm",onClick:m,children:"View Details"})})]})]})})]})}var hN="Collapsible",[ace,lFe]=Li(hN),[cce,pN]=ace(hN),C6=v.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:o,onOpenChange:s,...c}=t,[l=!1,u]=as({prop:r,defaultProp:i,onChange:s});return a.jsx(cce,{scope:n,disabled:o,contentId:Xo(),open:l,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:a.jsx(it.div,{"data-state":gN(l),"data-disabled":o?"":void 0,...c,ref:e})})});C6.displayName=hN;var _6="CollapsibleTrigger",A6=v.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=pN(_6,n);return a.jsx(it.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":gN(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:e,onClick:Te(t.onClick,i.onOpenToggle)})});A6.displayName=_6;var mN="CollapsibleContent",j6=v.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=pN(mN,t.__scopeCollapsible);return a.jsx(Wr,{present:n||i.open,children:({present:o})=>a.jsx(lce,{...r,ref:e,present:o})})});j6.displayName=mN;var lce=v.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...o}=t,s=pN(mN,n),[c,l]=v.useState(r),u=v.useRef(null),d=Pt(e,u),f=v.useRef(0),h=f.current,p=v.useRef(0),g=p.current,m=s.open||c,y=v.useRef(m),b=v.useRef();return v.useEffect(()=>{const x=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(x)},[]),Kr(()=>{const x=u.current;if(x){b.current=b.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const w=x.getBoundingClientRect();f.current=w.height,p.current=w.width,y.current||(x.style.transitionDuration=b.current.transitionDuration,x.style.animationName=b.current.animationName),l(r)}},[s.open,r]),a.jsx(it.div,{"data-state":gN(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!m,...o,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:m&&i})});function gN(t){return t?"open":"closed"}var uce=C6;const _g=uce,Ag=A6,jg=j6;function dce({generatedPersonas:t,selectedPersonas:e,isGenerating:n,onPersonaSelection:r,onRefinePersonas:i,onApprovePersonas:o,onBackToGenerator:s}){const c=ar(),[l,u]=v.useState(""),[d,f]=v.useState(!1),h=p=>{c(`/synthetic-users/${p}?fromReview=true`)};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Review Generated Personas"}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.length," of ",t.length," selected"]})]}),a.jsx("div",{className:"space-y-4",children:t.map(p=>a.jsx(gt,{className:`border ${e.includes(p.id)?"border-primary/50 bg-primary/5":""} cursor-pointer`,onClick:()=>h(p.id),children:a.jsx(Rt,{className:"p-4",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsx("div",{className:"flex-1",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{type:"checkbox",id:`persona-${p.id}`,checked:e.includes(p.id),onChange:g=>{g.stopPropagation(),r(p.id)},className:"mr-3 h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium",children:p.name}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[p.age," • ",p.gender," • ",p.occupation]})]})]})}),a.jsx(fN,{user:p,showDetailedDialog:!1,onClick:g=>{g.stopPropagation(),h(p.id)}})]})})},p.id))}),a.jsx("div",{className:"space-y-4 pt-4 border-t",children:a.jsxs("div",{children:[a.jsx("div",{className:"flex justify-between items-start mb-4",children:a.jsxs(J,{variant:"outline",onClick:s,children:[a.jsx(Kp,{className:"mr-2 h-4 w-4"}),"Back to Generator"]})}),a.jsxs(_g,{open:d,onOpenChange:f,className:"w-full space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx(Ag,{asChild:!0,children:a.jsxs(J,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(wd,{className:"h-4 w-4"}),"Refine Personas",a.jsx(Ma,{className:"h-4 w-4 ml-1 transition-transform duration-200",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]})}),a.jsxs(J,{onClick:o,disabled:e.length===0,children:[a.jsx(zh,{className:"mr-2 h-4 w-4"}),"Approve Selected (",e.length,")"]})]}),a.jsx(jg,{children:a.jsx(gt,{className:"border shadow-sm w-full mt-4",children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"refinement-prompt",className:"text-sm font-medium block mb-2",children:"Refinement Instructions"}),a.jsx(mt,{id:"refinement-prompt",placeholder:"Example: Make all personas 5 years younger, or ensure everyone is from different locations...",value:l,onChange:p=>u(p.target.value),className:"min-h-[100px] w-full resize-y"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Use natural language to describe how you'd like to refine the selected personas."})]}),a.jsxs(J,{onClick:()=>i(l),disabled:n||l.trim()==="",className:"w-full",children:[n?a.jsx(wd,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(wd,{className:"mr-2 h-4 w-4"}),"Apply Refinements"]})]})})})})]})]})})]})}async function fce(t,e,n,r,i,o){console.log(`generateSyntheticPersonas called with targetFolderId: ${i||"none"}`),console.log(`šŸ”„ generateSyntheticPersonas using model: ${o||"gemini-2.5-pro"}`);try{if(console.log(`Generating ${n} synthetic personas using two-stage approach...`),t.trim().length<10)throw new Error("Audience brief is too short. Please provide more context for better persona generation.");let s;if(r&&r.length>0){console.log(`Uploading ${r.length} customer data files...`);try{s=(await ua.uploadCustomerData(r)).data.session_id,console.log(`Customer data uploaded with session ID: ${s}`)}catch(l){throw console.error("Failed to upload customer data:",l),new Error("Failed to upload customer data files. Please try again.")}}const c=await ua.batchGenerateWithStages(t,e,n,.8,s,o);if(c.data){const l=c.data.partial_success===!0,u=c.data.personas&&c.data.personas.length>0,d=c.data.errors&&c.data.errors.length>0;if(u){if(console.log(`Generated ${c.data.personas.length} personas with two-stage process${d?` (${c.data.errors.length} failed)`:""}`),i){const f=c.data.personas,h=f.map(p=>p._id||p.id).filter(Boolean);console.log(`Adding ${h.length} newly generated personas to folder: ${i}`);try{await js.addPersonasBatch(i,h),console.log(`Added ${h.length} newly generated personas to folder: ${i}`)}catch(p){console.error("Error adding personas to folder:",p)}if(s)try{await ua.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(p){console.warn("Failed to cleanup customer data:",p)}return l||d?{...c.data,length:f.length}:{...c.data,personas:f}}if(s)try{await ua.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}if(l||d)return{...c.data.personas,length:c.data.personas.length,partial_success:l,errors:c.data.errors};if(s)try{await ua.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}return c.data.personas}else if(d){if(s)try{await ua.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}throw new Error(`Failed to generate personas: ${c.data.errors.length} generation attempts failed.`)}else throw new Error("No personas returned from API")}else throw new Error("Invalid response format from API")}catch(s){if(customerDataSessionId)try{await ua.cleanupCustomerData(customerDataSessionId),console.log(`Cleaned up customer data for session: ${customerDataSessionId}`)}catch(c){console.warn("Failed to cleanup customer data:",c)}throw console.error("Error generating AI personas:",s),s}}function E6(){const[t,e]=v.useState([]),n=async o=>{const s=[];for(const c of o){const l={...c};l._id&&typeof l._id=="string"&&l._id.startsWith("local-")&&delete l._id;const u=await zr.create(l);console.log("Persona saved to database:",u.data),s.push({...c,id:u.data._id||u.data.id,_id:u.data._id||u.data.id,isDbPersona:!0})}e(s)},r=async()=>{const o=await zr.getAll();return o&&o.data&&Array.isArray(o.data)?(console.log("Personas loaded from database:",o.data.length),o.data.map(s=>({...s,id:s._id||s.id,isDbPersona:!0}))):[]};return v.useEffect(()=>{(async()=>{const s=await r();e(s)})()},[]),{storedPersonas:t,savePersonas:n,loadPersonas:r,clearPersonas:async()=>{const o=await r();for(const s of o)s._id&&await zr.delete(s._id);e([])}}}function hce({targetFolderId:t,targetFolderName:e}){const n=Fi(),r=ar(),{loadPersonas:i,savePersonas:o}=E6(),[s,c]=v.useState(!1),[l,u]=v.useState([]),[d,f]=v.useState([]),[h,p]=v.useState(!1),[g,m]=v.useState(0);v.useEffect(()=>{const C=new URLSearchParams(n.search),_=C.get("mode"),A=C.get("tab"),j=C.get("step");if(_==="create"&&A==="ai"&&j==="review"){const P=i();P.length>0&&(u(P),f(P.map(k=>k.id)),p(!0))}},[n,i]);async function y(C){var _,A,j,P,k,O,E,I,D,z;try{c(!0),m(0);const $=parseInt(C.personaCount);if(isNaN($)||$<1||$>10){re.error("Invalid number of personas",{description:"Please enter a number between 1 and 10"}),c(!1);return}m(5);const G=setInterval(()=>{m(Y=>Y<90?Y+Math.random()*5:Y)},500),R=$<=2?"30-60 seconds":$<=4?"1-2 minutes":$<=6?"2-3 minutes":"3-5 minutes";$>4&&re.info("Generation may take longer",{description:`Generating ${$} personas at once may result in some timeouts. If this happens, the successfully created personas will still be saved.`,duration:8e3}),re.info("Generating AI personas in parallel",{description:`Creating ${$} synthetic personas based on your brief. This may take ${R}. Please be patient.`,duration:1e4}),t&&e?(console.log(`Target folder for new personas: ID=${t}, Name=${e}`),re.info(`Creating personas in "${e}" folder`,{duration:3e3})):console.log("No target folder specified for new personas"),console.log(`šŸ¤– Starting persona generation with model: ${C.llm_model||"gemini-2.5-pro"}`);const L=await fce(C.audienceBrief,C.researchObjective,$,C.dataFile,t,C.llm_model),W=L.personas||L;if(clearInterval(G),m(100),W&&W.length>0)console.log(`āœ… Successfully generated ${W.length} personas using model: ${C.llm_model||"gemini-2.5-pro"}`),L.partial_success||L.errors&&L.errors.length>0?(re.success("Some personas generated successfully",{description:`${W.length} synthetic personas were created using ${C.llm_model||"Gemini 2.5 Pro"}. ${((_=L.errors)==null?void 0:_.length)||0} failed due to timeout or other errors.`,duration:8e3}),L.errors&&L.errors.length>0&&setTimeout(()=>{re.error("Some personas failed to generate",{description:`${L.errors.length} personas timed out. The server took too long to generate them. The successfully generated personas have been saved${t?" in the selected folder":""}.`,duration:1e4})},1e3)):re.success("Personas generated and saved successfully",{description:`${W.length} synthetic personas have been created using ${C.llm_model||"Gemini 2.5 Pro"} and saved ${t?`to the "${e}" folder`:"to the database"}.`}),r("/synthetic-users?mode=view");else throw new Error("No personas were generated")}catch($){console.error(`āŒ Error generating personas using model: ${C.llm_model||"gemini-2.5-pro"}:`,$);let G="Please try again or adjust your parameters",R="Failed to generate personas";$.code==="ECONNABORTED"||(A=$.message)!=null&&A.includes("timeout")||((j=$.response)==null?void 0:j.status)===504?(R="Generation timeout",G="AI persona generation timed out. This often happens when generating multiple complex personas. Try generating fewer personas (2-3) or try again later."):((P=$.response)==null?void 0:P.status)===500?(R="Server error",(O=(k=$.response)==null?void 0:k.data)!=null&&O.message?G=$.response.data.message:(I=(E=$.response)==null?void 0:E.data)!=null&&I.error?G=$.response.data.error:G="The server encountered an error processing your request. Please try again later."):((D=$.response)==null?void 0:D.status)===401?(R="Authentication required",G="Please log in to generate personas."):(z=$.message)!=null&&z.includes("504 Deadline Exceeded")?(R="Generation timeout",G="The AI model took too long to generate personas. Try generating fewer personas or simplify your brief."):$ instanceof Error&&(G=$.message),re.error(R,{description:G,duration:6e3})}finally{setTimeout(()=>{c(!1),m(0)},500)}}const b=C=>{f(_=>_.includes(C)?_.filter(A=>A!==C):[..._,C])},x=(C,_)=>{const A=_.toLowerCase();return C.map(j=>{const P={...j};if(A.includes("younger")){const k=parseInt(P.age);P.age=(k-5).toString()}else if(A.includes("older")){const k=parseInt(P.age);P.age=(k+5).toString()}if(A.includes("different locations")&&(P.location=`${P.location} (Diversified)`),A.includes("more extroverted")?P.personality=`Extroverted, ${P.personality.toLowerCase()}`:A.includes("more introverted")&&(P.personality=`Introverted, ${P.personality.toLowerCase()}`),A.includes("diverse")){const k=["tech-savvy","traditional","innovative","conservative","creative"],O=k[Math.floor(Math.random()*k.length)];P.personality=`${O}, ${P.personality}`}return P})},w=C=>{if(!C.trim()){re.error("Please provide refinement instructions");return}c(!0),setTimeout(()=>{try{const _=l.filter(P=>d.includes(P.id)),A=x(_,C),j=l.map(P=>A.find(O=>O.id===P.id)||P);u(j),c(!1),o(j),re.success("Personas refined based on your instructions",{description:"Review the updated profiles"})}catch(_){console.error("Error refining personas:",_),re.error("Failed to refine personas",{description:"Please try different instructions"}),c(!1)}},1500)},S=()=>{const C=l.filter(_=>d.includes(_.id));re.success(`${C.length} personas approved`,{description:"Added to your synthetic persona library"}),o(C),r("/synthetic-users?mode=view")};return a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[a.jsx(Dr,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Persona Recruiter"})]}),s&&a.jsxs("div",{className:"mb-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-2",children:[a.jsx("span",{className:"text-sm font-medium",children:"Generating personas in parallel..."}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[Math.round(g),"%"]})]}),a.jsx(Rl,{value:g,className:"h-2"})]}),h?a.jsx(dce,{generatedPersonas:l,selectedPersonas:d,isGenerating:s,onPersonaSelection:b,onRefinePersonas:w,onApprovePersonas:S,onBackToGenerator:()=>p(!1)}):a.jsx(oce,{onSubmit:y,isGenerating:s})]})}const nl=new Map;function T6(t){const{id:e,title:n,description:r,type:i="default",duration:o}=t;let s;switch(i){case"success":s=re.success(n,{description:r,duration:o});break;case"error":s=re.error(n,{description:r,duration:o});break;case"warning":s=re.warning(n,{description:r,duration:o});break;case"info":s=re.info(n,{description:r,duration:o});break;default:s=re(n,{description:r,duration:o});break}return nl.set(e,s.toString()),e}function pce(t,e){const n=nl.get(t);if(!n)return console.warn(`Toast with ID "${t}" not found. Creating new toast instead.`),T6({id:t,...e,title:e.title||"Updated"}),!1;const{title:r,description:i,type:o="default",duration:s}=e;re.dismiss(n);let c;switch(o){case"success":c=re.success(r,{description:i,duration:s});break;case"error":c=re.error(r,{description:i,duration:s});break;case"warning":c=re.warning(r,{description:i,duration:s});break;case"info":c=re.info(r,{description:i,duration:s});break;default:c=re(r,{description:i,duration:s});break}return nl.set(t,c.toString()),!0}function mce(t){const e=nl.get(t);return e?(re.dismiss(e),nl.delete(t),!0):(console.warn(`Toast with ID "${t}" not found.`),!1)}function gce(t){return nl.has(t)}function vce(){nl.forEach(t=>{re.dismiss(t)}),nl.clear()}const qe={success:re.success,error:re.error,warning:re.warning,info:re.info,loading:re.loading,dismiss:re.dismiss,createPersistent:T6,updatePersistent:pce,dismissPersistent:mce,hasPersistent:gce,dismissAllPersistent:vce};var N6=["PageUp","PageDown"],P6=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],k6={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Wf="Slider",[AA,yce,xce]=q0(Wf),[O6,uFe]=Li(Wf,[xce]),[bce,tw]=O6(Wf),I6=v.forwardRef((t,e)=>{const{name:n,min:r=0,max:i=100,step:o=1,orientation:s="horizontal",disabled:c=!1,minStepsBetweenThumbs:l=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:p=!1,form:g,...m}=t,y=v.useRef(new Set),b=v.useRef(0),w=s==="horizontal"?wce:Sce,[S=[],C]=as({prop:d,defaultProp:u,onChange:O=>{var I;(I=[...y.current][b.current])==null||I.focus(),f(O)}}),_=v.useRef(S);function A(O){const E=Ece(S,O);k(O,E)}function j(O){k(O,b.current)}function P(){const O=_.current[b.current];S[b.current]!==O&&h(S)}function k(O,E,{commit:I}={commit:!1}){const D=kce(o),z=Oce(Math.round((O-r)/o)*o+r,D),$=vm(z,[r,i]);C((G=[])=>{const R=Ace(G,$,E);if(Pce(R,l*o)){b.current=R.indexOf($);const L=String(R)!==String(G);return L&&I&&h(R),L?R:G}else return G})}return a.jsx(bce,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:i,valueIndexToChangeRef:b,thumbs:y.current,values:S,orientation:s,form:g,children:a.jsx(AA.Provider,{scope:t.__scopeSlider,children:a.jsx(AA.Slot,{scope:t.__scopeSlider,children:a.jsx(w,{"aria-disabled":c,"data-disabled":c?"":void 0,...m,ref:e,onPointerDown:Te(m.onPointerDown,()=>{c||(_.current=S)}),min:r,max:i,inverted:p,onSlideStart:c?void 0:A,onSlideMove:c?void 0:j,onSlideEnd:c?void 0:P,onHomeKeyDown:()=>!c&&k(r,0,{commit:!0}),onEndKeyDown:()=>!c&&k(i,S.length-1,{commit:!0}),onStepKeyDown:({event:O,direction:E})=>{if(!c){const z=N6.includes(O.key)||O.shiftKey&&P6.includes(O.key)?10:1,$=b.current,G=S[$],R=o*z*E;k(G+R,$,{commit:!0})}}})})})})});I6.displayName=Wf;var[R6,M6]=O6(Wf,{startEdge:"left",endEdge:"right",size:"width",direction:1}),wce=v.forwardRef((t,e)=>{const{min:n,max:r,dir:i,inverted:o,onSlideStart:s,onSlideMove:c,onSlideEnd:l,onStepKeyDown:u,...d}=t,[f,h]=v.useState(null),p=Pt(e,w=>h(w)),g=v.useRef(),m=Nu(i),y=m==="ltr",b=y&&!o||!y&&o;function x(w){const S=g.current||f.getBoundingClientRect(),C=[0,S.width],A=vN(C,b?[n,r]:[r,n]);return g.current=S,A(w-S.left)}return a.jsx(R6,{scope:t.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:a.jsx(D6,{dir:m,"data-orientation":"horizontal",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const S=x(w.clientX);s==null||s(S)},onSlideMove:w=>{const S=x(w.clientX);c==null||c(S)},onSlideEnd:()=>{g.current=void 0,l==null||l()},onStepKeyDown:w=>{const C=k6[b?"from-left":"from-right"].includes(w.key);u==null||u({event:w,direction:C?-1:1})}})})}),Sce=v.forwardRef((t,e)=>{const{min:n,max:r,inverted:i,onSlideStart:o,onSlideMove:s,onSlideEnd:c,onStepKeyDown:l,...u}=t,d=v.useRef(null),f=Pt(e,d),h=v.useRef(),p=!i;function g(m){const y=h.current||d.current.getBoundingClientRect(),b=[0,y.height],w=vN(b,p?[r,n]:[n,r]);return h.current=y,w(m-y.top)}return a.jsx(R6,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:a.jsx(D6,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{const y=g(m.clientY);o==null||o(y)},onSlideMove:m=>{const y=g(m.clientY);s==null||s(y)},onSlideEnd:()=>{h.current=void 0,c==null||c()},onStepKeyDown:m=>{const b=k6[p?"from-bottom":"from-top"].includes(m.key);l==null||l({event:m,direction:b?-1:1})}})})}),D6=v.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:o,onHomeKeyDown:s,onEndKeyDown:c,onStepKeyDown:l,...u}=t,d=tw(Wf,n);return a.jsx(it.span,{...u,ref:e,onKeyDown:Te(t.onKeyDown,f=>{f.key==="Home"?(s(f),f.preventDefault()):f.key==="End"?(c(f),f.preventDefault()):N6.concat(P6).includes(f.key)&&(l(f),f.preventDefault())}),onPointerDown:Te(t.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:Te(t.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&i(f)}),onPointerUp:Te(t.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),o(f))})})}),$6="SliderTrack",L6=v.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=tw($6,n);return a.jsx(it.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:e})});L6.displayName=$6;var jA="SliderRange",F6=v.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=tw(jA,n),o=M6(jA,n),s=v.useRef(null),c=Pt(e,s),l=i.values.length,u=i.values.map(h=>U6(h,i.min,i.max)),d=l>1?Math.min(...u):0,f=100-Math.max(...u);return a.jsx(it.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:c,style:{...t.style,[o.startEdge]:d+"%",[o.endEdge]:f+"%"}})});F6.displayName=jA;var EA="SliderThumb",B6=v.forwardRef((t,e)=>{const n=yce(t.__scopeSlider),[r,i]=v.useState(null),o=Pt(e,c=>i(c)),s=v.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return a.jsx(Cce,{...t,ref:o,index:s})}),Cce=v.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:i,...o}=t,s=tw(EA,n),c=M6(EA,n),[l,u]=v.useState(null),d=Pt(e,x=>u(x)),f=l?s.form||!!l.closest("form"):!0,h=pg(l),p=s.values[r],g=p===void 0?0:U6(p,s.min,s.max),m=jce(r,s.values.length),y=h==null?void 0:h[c.size],b=y?Tce(y,g,c.direction):0;return v.useEffect(()=>{if(l)return s.thumbs.add(l),()=>{s.thumbs.delete(l)}},[l,s.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${g}% + ${b}px)`},children:[a.jsx(AA.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(it.span,{role:"slider","aria-label":t["aria-label"]||m,"aria-valuemin":s.min,"aria-valuenow":p,"aria-valuemax":s.max,"aria-orientation":s.orientation,"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,tabIndex:s.disabled?void 0:0,...o,ref:d,style:p===void 0?{display:"none"}:t.style,onFocus:Te(t.onFocus,()=>{s.valueIndexToChangeRef.current=r})})}),f&&a.jsx(_ce,{name:i??(s.name?s.name+(s.values.length>1?"[]":""):void 0),form:s.form,value:p},r)]})});B6.displayName=EA;var _ce=t=>{const{value:e,...n}=t,r=v.useRef(null),i=wg(e);return v.useEffect(()=>{const o=r.current,s=window.HTMLInputElement.prototype,l=Object.getOwnPropertyDescriptor(s,"value").set;if(i!==e&&l){const u=new Event("input",{bubbles:!0});l.call(o,e),o.dispatchEvent(u)}},[i,e]),a.jsx("input",{style:{display:"none"},...n,ref:r,defaultValue:e})};function Ace(t=[],e,n){const r=[...t];return r[n]=e,r.sort((i,o)=>i-o)}function U6(t,e,n){const o=100/(n-e)*(t-e);return vm(o,[0,100])}function jce(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Ece(t,e){if(t.length===1)return 0;const n=t.map(i=>Math.abs(i-e)),r=Math.min(...n);return n.indexOf(r)}function Tce(t,e,n){const r=t/2,o=vN([0,50],[0,r]);return(r-o(e)*n)*n}function Nce(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function Pce(t,e){if(e>0){const n=Nce(t);return Math.min(...n)>=e}return!0}function vN(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function kce(t){return(String(t).split(".")[1]||"").length}function Oce(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var H6=I6,Ice=L6,Rce=F6,Mce=B6;const br=v.forwardRef(({className:t,...e},n)=>a.jsxs(H6,{ref:n,className:Ne("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(Ice,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(Rce,{className:"absolute h-full bg-primary"})}),a.jsx(Mce,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));br.displayName=H6.displayName;var yN="Switch",[Dce,dFe]=Li(yN),[$ce,Lce]=Dce(yN),z6=v.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:o,required:s,disabled:c,value:l="on",onCheckedChange:u,form:d,...f}=t,[h,p]=v.useState(null),g=Pt(e,w=>p(w)),m=v.useRef(!1),y=h?d||!!h.closest("form"):!0,[b=!1,x]=as({prop:i,defaultProp:o,onChange:u});return a.jsxs($ce,{scope:n,checked:b,disabled:c,children:[a.jsx(it.button,{type:"button",role:"switch","aria-checked":b,"aria-required":s,"data-state":K6(b),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:g,onClick:Te(t.onClick,w=>{x(S=>!S),y&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})}),y&&a.jsx(Fce,{control:h,bubbles:!m.current,name:r,value:l,checked:b,required:s,disabled:c,form:d,style:{transform:"translateX(-100%)"}})]})});z6.displayName=yN;var G6="SwitchThumb",V6=v.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=Lce(G6,n);return a.jsx(it.span,{"data-state":K6(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});V6.displayName=G6;var Fce=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,o=v.useRef(null),s=wg(n),c=pg(e);return v.useEffect(()=>{const l=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(h)}},[s,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...t.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function K6(t){return t?"checked":"unchecked"}var W6=z6,Bce=V6;const ym=v.forwardRef(({className:t,...e},n)=>a.jsx(W6,{className:Ne("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:a.jsx(Bce,{className:Ne("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));ym.displayName=W6.displayName;function Uce(t,e=[]){let n=[];function r(o,s){const c=v.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,y=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=v.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,Hce(i,...e)]}function Hce(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var eC="rovingFocusGroup.onEntryFocus",zce={bubbles:!1,cancelable:!0},nw="RovingFocusGroup",[TA,q6,Gce]=q0(nw),[Vce,qf]=Uce(nw,[Gce]),[Kce,Wce]=Vce(nw),Y6=v.forwardRef((t,e)=>a.jsx(TA.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(TA.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(qce,{...t,ref:e})})}));Y6.displayName=nw;var qce=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=t,h=v.useRef(null),p=Pt(e,h),g=Nu(o),[m=null,y]=as({prop:s,defaultProp:c,onChange:l}),[b,x]=v.useState(!1),w=Cr(u),S=q6(n),C=v.useRef(!1),[_,A]=v.useState(0);return v.useEffect(()=>{const j=h.current;if(j)return j.addEventListener(eC,w),()=>j.removeEventListener(eC,w)},[w]),a.jsx(Kce,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:m,onItemFocus:v.useCallback(j=>y(j),[y]),onItemShiftTab:v.useCallback(()=>x(!0),[]),onFocusableItemAdd:v.useCallback(()=>A(j=>j+1),[]),onFocusableItemRemove:v.useCallback(()=>A(j=>j-1),[]),children:a.jsx(it.div,{tabIndex:b||_===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...t.style},onMouseDown:Te(t.onMouseDown,()=>{C.current=!0}),onFocus:Te(t.onFocus,j=>{const P=!C.current;if(j.target===j.currentTarget&&P&&!b){const k=new CustomEvent(eC,zce);if(j.currentTarget.dispatchEvent(k),!k.defaultPrevented){const O=S().filter($=>$.focusable),E=O.find($=>$.active),I=O.find($=>$.id===m),z=[E,I,...O].filter(Boolean).map($=>$.ref.current);J6(z,d)}}C.current=!1}),onBlur:Te(t.onBlur,()=>x(!1))})})}),Q6="RovingFocusGroupItem",X6=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=t,c=Xo(),l=o||c,u=Wce(Q6,n),d=u.currentTabStopId===l,f=q6(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=u;return v.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),a.jsx(TA.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:a.jsx(it.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:e,onMouseDown:Te(t.onMouseDown,g=>{r?u.onItemFocus(l):g.preventDefault()}),onFocus:Te(t.onFocus,()=>u.onItemFocus(l)),onKeyDown:Te(t.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const m=Xce(g,u.orientation,u.dir);if(m!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let b=f().filter(x=>x.focusable).map(x=>x.ref.current);if(m==="last")b.reverse();else if(m==="prev"||m==="next"){m==="prev"&&b.reverse();const x=b.indexOf(g.currentTarget);b=u.loop?Jce(b,x+1):b.slice(x+1)}setTimeout(()=>J6(b))}})})})});X6.displayName=Q6;var Yce={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Qce(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Xce(t,e,n){const r=Qce(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Yce[r]}function J6(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Jce(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var xN=Y6,bN=X6,wN="Tabs",[Zce,fFe]=Li(wN,[qf]),Z6=qf(),[ele,SN]=Zce(wN),eH=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:c,activationMode:l="automatic",...u}=t,d=Nu(c),[f,h]=as({prop:r,onChange:i,defaultProp:o});return a.jsx(ele,{scope:n,baseId:Xo(),value:f,onValueChange:h,orientation:s,dir:d,activationMode:l,children:a.jsx(it.div,{dir:d,"data-orientation":s,...u,ref:e})})});eH.displayName=wN;var tH="TabsList",nH=v.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...i}=t,o=SN(tH,n),s=Z6(n);return a.jsx(xN,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:a.jsx(it.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:e})})});nH.displayName=tH;var rH="TabsTrigger",iH=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=t,s=SN(rH,n),c=Z6(n),l=aH(s.baseId,r),u=cH(s.baseId,r),d=r===s.value;return a.jsx(bN,{asChild:!0,...c,focusable:!i,active:d,children:a.jsx(it.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...o,ref:e,onMouseDown:Te(t.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Te(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Te(t.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!i&&f&&s.onValueChange(r)})})})});iH.displayName=rH;var oH="TabsContent",sH=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=t,c=SN(oH,n),l=aH(c.baseId,r),u=cH(c.baseId,r),d=r===c.value,f=v.useRef(d);return v.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),a.jsx(Wr,{present:i||d,children:({present:h})=>a.jsx(it.div,{"data-state":d?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:u,tabIndex:0,...s,ref:e,style:{...t.style,animationDuration:f.current?"0s":void 0},children:h&&o})})});sH.displayName=oH;function aH(t,e){return`${t}-trigger-${e}`}function cH(t,e){return`${t}-content-${e}`}var tle=eH,lH=nH,uH=iH,dH=sH;const dl=tle,Va=v.forwardRef(({className:t,...e},n)=>a.jsx(lH,{ref:n,className:Ne("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));Va.displayName=lH.displayName;const gn=v.forwardRef(({className:t,...e},n)=>a.jsx(uH,{ref:n,className:Ne("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...e}));gn.displayName=uH.displayName;const vn=v.forwardRef(({className:t,...e},n)=>a.jsx(dH,{ref:n,className:Ne("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));vn.displayName=dH.displayName;const nle=Oe.object({name:Oe.string().min(2,{message:"Name must be at least 2 characters."}),age:Oe.string().min(1,{message:"Age is required."}),gender:Oe.string().min(1,{message:"Gender is required."}),occupation:Oe.string().min(2,{message:"Occupation is required."}),education:Oe.string().min(1,{message:"Education is required."}),location:Oe.string().min(2,{message:"Location is required."}),ethnicity:Oe.string().optional(),personality:Oe.string(),interests:Oe.string(),hasPurchasingPower:Oe.boolean().optional(),hasChildren:Oe.boolean().optional(),techSavviness:Oe.number().min(0).max(100),brandLoyalty:Oe.number().min(0).max(100),priceConsciousness:Oe.number().min(0).max(100),environmentalConcern:Oe.number().min(0).max(100),socialGrade:Oe.string().optional(),householdIncome:Oe.string().optional(),householdComposition:Oe.string().optional(),livingSituation:Oe.string().optional(),goals:Oe.array(Oe.string()).optional(),frustrations:Oe.array(Oe.string()).optional(),motivations:Oe.array(Oe.string()).optional(),scenarios:Oe.array(Oe.string()).optional(),scenarioType:Oe.string().optional(),oceanTraits:Oe.object({openness:Oe.number().min(0).max(100),conscientiousness:Oe.number().min(0).max(100),extraversion:Oe.number().min(0).max(100),agreeableness:Oe.number().min(0).max(100),neuroticism:Oe.number().min(0).max(100)}).optional(),thinkFeelDo:Oe.object({thinks:Oe.array(Oe.string()),feels:Oe.array(Oe.string()),does:Oe.array(Oe.string())}).optional(),mediaConsumption:Oe.string().optional(),deviceUsage:Oe.string().optional(),shoppingHabits:Oe.string().optional(),brandPreferences:Oe.string().optional(),communicationPreferences:Oe.string().optional(),paymentMethods:Oe.string().optional(),purchaseBehaviour:Oe.string().optional(),coreValues:Oe.string().optional(),lifestyleChoices:Oe.string().optional(),socialActivities:Oe.string().optional(),categoryKnowledge:Oe.string().optional(),decisionInfluences:Oe.string().optional(),painPoints:Oe.string().optional(),journeyContext:Oe.string().optional(),keyTouchpoints:Oe.string().optional(),selfDeterminationNeeds:Oe.object({autonomy:Oe.string(),competence:Oe.string(),relatedness:Oe.string()}).optional(),fears:Oe.array(Oe.string()).optional(),narrative:Oe.string().optional(),additionalInformation:Oe.string().optional()});function rle({targetFolderId:t,targetFolderName:e}){const[n,r]=v.useState(1),[i,o]=v.useState(!1),[s,c]=v.useState(!1),[l,u]=v.useState(0),d=ar(),{isAuthenticated:f,login:h}=Xs();v.useEffect(()=>{u(0)},[]),v.useEffect(()=>{(async()=>{if(!f&&!s){c(!0);try{console.log("Attempting auto login with default credentials"),await h("user","pass"),console.log("Auto login successful");const A=localStorage.getItem("auth_token");A?(console.log("Token successfully stored:",A.substring(0,10)+"..."),qe.success("Logged in automatically with default account")):(console.error("Token not stored after successful login"),qe.error("Authentication problem, token not stored"))}catch(A){console.error("Auto login failed:",A)}finally{c(!1)}}})()},[]);const p=z0({resolver:G0(nle),defaultValues:{name:"",age:"",gender:"",occupation:"",education:"",location:"",ethnicity:"",personality:"",interests:"",hasPurchasingPower:!1,hasChildren:!1,techSavviness:50,brandLoyalty:50,priceConsciousness:50,environmentalConcern:50,socialGrade:"",householdIncome:"",householdComposition:"",livingSituation:"",goals:[],frustrations:[],motivations:[],scenarios:[],scenarioType:"",oceanTraits:{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:{thinks:[],feels:[],does:[]},mediaConsumption:"",deviceUsage:"",shoppingHabits:"",brandPreferences:"",communicationPreferences:"",paymentMethods:"",purchaseBehaviour:"",coreValues:"",lifestyleChoices:"",socialActivities:"",categoryKnowledge:"",decisionInfluences:"",painPoints:"",journeyContext:"",keyTouchpoints:"",selfDeterminationNeeds:{autonomy:"",competence:"",relatedness:""},fears:[],narrative:"",additionalInformation:""}}),g=_=>{const A=p.getValues(_)||[];p.setValue(_,[...A,""])},m=(_,A,j)=>{const k=[...p.getValues(_)||[]];k[A]=j,p.setValue(_,k)},y=(_,A)=>{const P=[...p.getValues(_)||[]];P.splice(A,1),p.setValue(_,P)},b=_=>{const A=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},j={...A,[_]:[...A[_]||[],""]};p.setValue("thinkFeelDo",j)},x=(_,A,j)=>{const P=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},k=[...P[_]||[]];k[A]=j;const O={...P,[_]:k};p.setValue("thinkFeelDo",O)},w=(_,A)=>{const j=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},P=[...j[_]||[]];P.splice(A,1);const k={...j,[_]:P};p.setValue("thinkFeelDo",k)},S=(_,A)=>{const P={...p.getValues("oceanTraits")||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},[_]:A};p.setValue("oceanTraits",P)};async function C(_,A=!1){var j,P,k,O,E;if(A&&l>=1){console.log("Max retry attempts reached, stopping retry loop"),qe.error("Authentication failed after multiple attempts",{description:"Please try logging in manually (user/pass)"}),d("/login",{state:{from:"/synthetic-users"}}),o(!1);return}A?(u(I=>I+1),console.log(`Retry attempt ${l+1}`)):u(0),o(!0);try{if(!f)try{console.log("Not authenticated, attempting login with default credentials before submission"),await h("user","pass"),console.log("Login successful before persona creation")}catch(L){console.error("Login failed before persona creation:",L),qe.error("Authentication required",{description:"Please log in before creating personas. Default: user/pass"}),d("/login",{state:{from:"/synthetic-users"}}),o(!1);return}const I=`persona-generation-${Date.now()}`,D=t&&e?` in "${e}" folder`:"",z=n>1?`${n} personas`:"persona";console.log(`UserCreator - Creating ${z}${D}`),qe.createPersistent({id:I,title:`Generating ${z}...`,description:`Creating synthetic user profile${n>1?"s":""}${D}`,type:"info"});const $={..._,oceanTraits:_.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:_.thinkFeelDo||{thinks:[],feels:[],does:[]},folderId:t||void 0},G={id:`temp-${Date.now()}`,...$},R=JSON.parse(localStorage.getItem("tempPersonas")||"[]");if(R.push(G),localStorage.setItem("tempPersonas",JSON.stringify(R)),n===1)try{if(!localStorage.getItem("auth_token")){console.error("No authentication token found"),qe.error("Authentication required",{description:"No valid token found. Please log in again."});try{console.log("No token found, attempting new login"),await h("user","pass"),console.log("Login successful, token:",((j=localStorage.getItem("auth_token"))==null?void 0:j.substring(0,10))+"...")}catch(Y){throw console.error("Login retry failed:",Y),new Error("Authentication failed after retry")}}console.log("Sending persona creation request to API with auth token");const W=await zr.create($);console.log("Persona created successfully:",W),qe.updatePersistent(I,{title:"Synthetic user created successfully",description:`Created profile for ${_.name}`,type:"success"})}catch(L){throw console.error("Error creating persona via API:",L),L.response&&L.response.status===401&&qe.error("Authentication error",{description:"Failed to authenticate with server. Please try again."}),L}else{const L=[];L.push($);for(let W=1;W{d("/synthetic-users?mode=view")},300)}catch(I){if(console.error("Error creating personas:",I),I.response&&I.response.status===401||I.message&&I.message.includes("Authentication failed")&&l<1)try{console.log("Got auth error, attempting login retry with default credentials"),localStorage.removeItem("auth_token");const D=await ey.login("user","pass");if((k=D==null?void 0:D.data)!=null&&k.access_token){localStorage.setItem("auth_token",D.data.access_token),localStorage.setItem("user",JSON.stringify(D.data.user)),console.log("Manual login successful, got new token:",D.data.access_token.substring(0,10)+"..."),qe.info("Logged in with default account, retrying submission..."),setTimeout(()=>{C(_,!0)},500);return}else throw new Error("No access token received")}catch(D){console.error("Login retry failed:",D),qe.error("Authentication error",{description:"Cannot authenticate with server. Please contact support."})}else qe.updatePersistent(generationToastId,{title:"Failed to create synthetic users",description:((E=(O=I.response)==null?void 0:O.data)==null?void 0:E.message)||I.message||"An unexpected error occurred",type:"error"})}finally{o(!1)}}return a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h2",{className:"text-2xl font-sf font-semibold",children:"Create Synthetic Users"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(J,{variant:"outline",size:"sm",onClick:()=>r(Math.max(1,n-1)),children:"-"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Dr,{size:16,className:"text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:n})]}),a.jsx(J,{variant:"outline",size:"sm",onClick:()=>r(n+1),children:"+"})]})]}),a.jsx(K0,{...p,children:a.jsxs("form",{onSubmit:p.handleSubmit(C),className:"space-y-6",children:[a.jsxs(dl,{defaultValue:"basic",children:[a.jsxs(Va,{className:"grid w-full grid-cols-6",children:[a.jsx(gn,{value:"basic",children:"Basic"}),a.jsx(gn,{value:"cooper",children:"Cooper"}),a.jsx(gn,{value:"personality",children:"Personality"}),a.jsx(gn,{value:"demographics",children:"Demographics"}),a.jsx(gn,{value:"lifestyle",children:"Lifestyle"}),a.jsx(gn,{value:"extended",children:"Extended"})]}),a.jsx(vn,{value:"basic",className:"mt-6",children:a.jsx(gt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"name",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Name"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"Jane Smith",..._})}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(vt,{control:p.control,name:"age",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Age Range"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select age range"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"18-24",children:"18-24"}),a.jsx(oe,{value:"25-34",children:"25-34"}),a.jsx(oe,{value:"35-44",children:"35-44"}),a.jsx(oe,{value:"45-54",children:"45-54"}),a.jsx(oe,{value:"55-64",children:"55-64"}),a.jsx(oe,{value:"65+",children:"65+"})]})]}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"gender",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Gender"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select gender"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Male",children:"Male"}),a.jsx(oe,{value:"Female",children:"Female"}),a.jsx(oe,{value:"Non-binary",children:"Non-binary"}),a.jsx(oe,{value:"Other",children:"Other"})]})]}),a.jsx(pt,{})]})})]}),a.jsx(vt,{control:p.control,name:"occupation",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Occupation"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"Software Engineer",..._})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"education",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Education"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select education level"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"High School",children:"High School"}),a.jsx(oe,{value:"Some College",children:"Some College"}),a.jsx(oe,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(oe,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(oe,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(oe,{value:"PhD",children:"PhD"})]})]}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"location",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Location"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"New York, USA",..._})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"ethnicity",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Ethnicity (Optional)"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select ethnicity"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"white",children:"White"}),a.jsx(oe,{value:"black",children:"Black"}),a.jsx(oe,{value:"asian",children:"Asian"}),a.jsx(oe,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(oe,{value:"native-american",children:"Native American"}),a.jsx(oe,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(oe,{value:"mixed",children:"Mixed"}),a.jsx(oe,{value:"other",children:"Other"}),a.jsx(oe,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]}),a.jsx(pt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"personality",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Personality Traits"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Curious, analytical, detail-oriented",..._,rows:3})}),a.jsx(Nn,{children:"Describe key personality traits that define this user"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"interests",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Interests"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Technology, fitness, cooking, travel",..._,rows:3})}),a.jsx(Nn,{children:"List interests, hobbies and activities this user enjoys"}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"font-medium text-sm",children:"Behavioral Attributes"}),a.jsx(vt,{control:p.control,name:"techSavviness",render:({field:_})=>a.jsxs(dt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ft,{children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(ht,{children:a.jsx(br,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"brandLoyalty",render:({field:_})=>a.jsxs(dt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ft,{children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(ht,{children:a.jsx(br,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"priceConsciousness",render:({field:_})=>a.jsxs(dt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ft,{children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(ht,{children:a.jsx(br,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"environmentalConcern",render:({field:_})=>a.jsxs(dt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ft,{children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(ht,{children:a.jsx(br,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsx(vt,{control:p.control,name:"hasPurchasingPower",render:({field:_})=>a.jsxs(dt,{className:"flex items-center justify-between",children:[a.jsx(ft,{children:"Purchasing Power"}),a.jsx(ht,{children:a.jsx(ym,{checked:_.value,onCheckedChange:_.onChange})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"hasChildren",render:({field:_})=>a.jsxs(dt,{className:"flex items-center justify-between",children:[a.jsx(ft,{children:"Has Children"}),a.jsx(ht,{children:a.jsx(ym,{checked:_.value,onCheckedChange:_.onChange})}),a.jsx(pt,{})]})})]})]})]})]})})})}),a.jsxs(vn,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Goals"}),(p.watch("goals")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("goals",A,j.target.value),placeholder:"Enter a goal"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("goals",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>g("goals"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Goal"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Frustrations"}),(p.watch("frustrations")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("frustrations",A,j.target.value),placeholder:"Enter a frustration"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("frustrations",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>g("frustrations"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Frustration"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Motivations"}),(p.watch("motivations")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("motivations",A,j.target.value),placeholder:"Enter a motivation"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("motivations",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>g("motivations"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Thinks"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).thinks||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>x("thinks",A,j.target.value),placeholder:"What they think"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("thinks",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>b("thinks"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Thought"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Feels"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).feels||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>x("feels",A,j.target.value),placeholder:"What they feel"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("feels",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>b("feels"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Feeling"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Does"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).does||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>x("does",A,j.target.value),placeholder:"What they do"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("does",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>b("does"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(gt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"scenarioType",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Scenario Section Title"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"Life Scenarios",..._})}),a.jsx(Nn,{children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'}),a.jsx(pt,{})]})}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(p.watch("scenarios")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(mt,{value:_,onChange:j=>m("scenarios",A,j.target.value),rows:2,placeholder:"Describe a usage scenario"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("scenarios",A),className:"mt-2",children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>g("scenarios"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})]})})})]}),a.jsx(vn,{value:"personality",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Openness to Experience"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{openness:50}).openness||50,"%"]})]}),a.jsx(br,{value:[(p.watch("oceanTraits")||{openness:50}).openness||50],onValueChange:_=>S("openness",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Creativity, curiosity, and openness to new ideas"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Conscientiousness"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50,"%"]})]}),a.jsx(br,{value:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50],onValueChange:_=>S("conscientiousness",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization, responsibility, and self-discipline"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Extraversion"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50,"%"]})]}),a.jsx(br,{value:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50],onValueChange:_=>S("extraversion",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Sociability, assertiveness, and talkativeness"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Agreeableness"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50,"%"]})]}),a.jsx(br,{value:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50],onValueChange:_=>S("agreeableness",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Compassion, cooperation, and concern for others"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Neuroticism"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50,"%"]})]}),a.jsx(br,{value:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50],onValueChange:_=>S("neuroticism",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Emotional reactivity, anxiety, and sensitivity to stress"})]})]})]})})}),a.jsx(vn,{value:"demographics",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Demographic Information"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"socialGrade",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Social Grade"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select social grade"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"A",children:"A - Higher managerial"}),a.jsx(oe,{value:"B",children:"B - Intermediate managerial"}),a.jsx(oe,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(oe,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(oe,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(oe,{value:"E",children:"E - State pensioners, unemployed"})]})]}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"householdIncome",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Household Income"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select income range"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Under $25k",children:"Under $25,000"}),a.jsx(oe,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(oe,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(oe,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(oe,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(oe,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(oe,{value:"Over $250k",children:"Over $250,000"}),a.jsx(oe,{value:"Prefer not to say",children:"Prefer not to say"})]})]}),a.jsx(pt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"householdComposition",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Household Composition"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select household type"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Single person",children:"Single person"}),a.jsx(oe,{value:"Couple without children",children:"Couple without children"}),a.jsx(oe,{value:"Couple with children",children:"Couple with children"}),a.jsx(oe,{value:"Single parent",children:"Single parent"}),a.jsx(oe,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(oe,{value:"Shared housing",children:"Shared housing"}),a.jsx(oe,{value:"Other",children:"Other"})]})]}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"livingSituation",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Living Situation"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select living situation"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Own home",children:"Own home"}),a.jsx(oe,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(oe,{value:"Rent house",children:"Rent house"}),a.jsx(oe,{value:"Live with family",children:"Live with family"}),a.jsx(oe,{value:"Student housing",children:"Student housing"}),a.jsx(oe,{value:"Assisted living",children:"Assisted living"}),a.jsx(oe,{value:"Other",children:"Other"})]})]}),a.jsx(pt,{})]})})]})]})]})})}),a.jsx(vn,{value:"lifestyle",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Lifestyle & Behavior"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"mediaConsumption",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Media Consumption"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"TV shows, podcasts, news sources, social media platforms",..._,rows:3})}),a.jsx(Nn,{children:"Describe media consumption habits and preferences"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"deviceUsage",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Device Usage"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Smartphone, laptop, tablet, smart TV, gaming console",..._,rows:3})}),a.jsx(Nn,{children:"Primary devices and usage patterns"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"shoppingHabits",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Shopping Habits"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Online vs in-store, frequency, preferred retailers",..._,rows:3})}),a.jsx(Nn,{children:"Shopping behavior and preferences"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"brandPreferences",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Brand Preferences"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Favorite brands, brand values alignment",..._,rows:3})}),a.jsx(Nn,{children:"Preferred brands and reasoning"}),a.jsx(pt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"communicationPreferences",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Communication Preferences"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Email, phone, text, video calls, in-person",..._,rows:3})}),a.jsx(Nn,{children:"Preferred communication methods and channels"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"paymentMethods",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Payment Methods"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Credit cards, digital wallets, cash, BNPL",..._,rows:3})}),a.jsx(Nn,{children:"Preferred payment methods and financial tools"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"purchaseBehaviour",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Purchase Behavior"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Research habits, decision factors, impulse vs planned buying",..._,rows:3})}),a.jsx(Nn,{children:"How they approach making purchase decisions"}),a.jsx(pt,{})]})})]})]})]})})}),a.jsxs(vn,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Extended Profile"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"coreValues",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Core Values"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Key principles and values that guide decisions",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"lifestyleChoices",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Lifestyle Choices"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Health, fitness, diet, work-life balance preferences",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"socialActivities",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Social Activities"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Social hobbies, community involvement, networking",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"categoryKnowledge",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Category Knowledge"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Expertise in specific product/service categories",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"decisionInfluences",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Decision Influences"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"What factors most influence their decisions",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"painPoints",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Pain Points"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Common challenges and friction points",..._,rows:3})}),a.jsx(pt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"journeyContext",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Journey Context"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Current life stage and contextual factors",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"keyTouchpoints",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Key Touchpoints"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Important interaction points and channels",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsx(vt,{control:p.control,name:"selfDeterminationNeeds.autonomy",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Autonomy"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Need for independence and self-direction",..._,rows:2})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"selfDeterminationNeeds.competence",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Competence"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Need to feel capable and effective",..._,rows:2})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"selfDeterminationNeeds.relatedness",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Relatedness"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Need for connection and belonging",..._,rows:2})}),a.jsx(pt,{})]})})]})]})]})]})}),a.jsx(gt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Fears & Concerns"}),(p.watch("fears")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("fears",A,j.target.value),placeholder:"Enter a fear or concern"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("fears",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>g("fears"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsx(vt,{control:p.control,name:"narrative",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Personal Narrative"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Personal story, background, key life experiences",..._,rows:4})}),a.jsx(Nn,{children:"A brief narrative that captures their personal story"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"additionalInformation",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Additional Information"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Any other relevant details or context",..._,rows:4})}),a.jsx(Nn,{children:"Additional context or details not covered elsewhere"}),a.jsx(pt,{})]})})]})})})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(J,{variant:"outline",type:"button",onClick:()=>p.reset(),children:"Reset"}),a.jsxs(J,{type:"submit",disabled:i,children:[i?a.jsx(tZ,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(DE,{className:"mr-2 h-4 w-4"}),i?"Creating...":`Create ${n>1?`${n} Users`:"User"}`]})]})]})})]})}var NA=["Enter"," "],ile=["ArrowDown","PageUp","Home"],fH=["ArrowUp","PageDown","End"],ole=[...ile,...fH],sle={ltr:[...NA,"ArrowRight"],rtl:[...NA,"ArrowLeft"]},ale={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Eg="Menu",[xm,cle,lle]=q0(Eg),[Pu,hH]=Li(Eg,[lle,Df,qf]),rw=Df(),pH=qf(),[ule,ku]=Pu(Eg),[dle,Tg]=Pu(Eg),mH=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=t,c=rw(e),[l,u]=v.useState(null),d=v.useRef(!1),f=Cr(o),h=Nu(i);return v.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),a.jsx(k4,{...c,children:a.jsx(ule,{scope:e,open:n,onOpenChange:f,content:l,onContentChange:u,children:a.jsx(dle,{scope:e,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:s,children:r})})})};mH.displayName=Eg;var fle="MenuAnchor",CN=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=rw(n);return a.jsx(bE,{...i,...r,ref:e})});CN.displayName=fle;var _N="MenuPortal",[hle,gH]=Pu(_N,{forceMount:void 0}),vH=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,o=ku(_N,e);return a.jsx(hle,{scope:e,forceMount:n,children:a.jsx(Wr,{present:n||o.open,children:a.jsx(d0,{asChild:!0,container:i,children:r})})})};vH.displayName=_N;var Ao="MenuContent",[ple,AN]=Pu(Ao),yH=v.forwardRef((t,e)=>{const n=gH(Ao,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,o=ku(Ao,t.__scopeMenu),s=Tg(Ao,t.__scopeMenu);return a.jsx(xm.Provider,{scope:t.__scopeMenu,children:a.jsx(Wr,{present:r||o.open,children:a.jsx(xm.Slot,{scope:t.__scopeMenu,children:s.modal?a.jsx(mle,{...i,ref:e}):a.jsx(gle,{...i,ref:e})})})})}),mle=v.forwardRef((t,e)=>{const n=ku(Ao,t.__scopeMenu),r=v.useRef(null),i=Pt(e,r);return v.useEffect(()=>{const o=r.current;if(o)return cN(o)},[]),a.jsx(jN,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Te(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),gle=v.forwardRef((t,e)=>{const n=ku(Ao,t.__scopeMenu);return a.jsx(jN,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),jN=v.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:g,...m}=t,y=ku(Ao,n),b=Tg(Ao,n),x=rw(n),w=pH(n),S=cle(n),[C,_]=v.useState(null),A=v.useRef(null),j=Pt(e,A,y.onContentChange),P=v.useRef(0),k=v.useRef(""),O=v.useRef(0),E=v.useRef(null),I=v.useRef("right"),D=v.useRef(0),z=g?X0:v.Fragment,$=g?{as:Hs,allowPinchZoom:!0}:void 0,G=L=>{var ae,De;const W=k.current+L,Y=S().filter(de=>!de.disabled),te=document.activeElement,me=(ae=Y.find(de=>de.ref.current===te))==null?void 0:ae.textValue,F=Y.map(de=>de.textValue),se=Tle(F,W,me),ne=(De=Y.find(de=>de.textValue===se))==null?void 0:De.ref.current;(function de(ye){k.current=ye,window.clearTimeout(P.current),ye!==""&&(P.current=window.setTimeout(()=>de(""),1e3))})(W),ne&&setTimeout(()=>ne.focus())};v.useEffect(()=>()=>window.clearTimeout(P.current),[]),aN();const R=v.useCallback(L=>{var Y,te;return I.current===((Y=E.current)==null?void 0:Y.side)&&Ple(L,(te=E.current)==null?void 0:te.area)},[]);return a.jsx(ple,{scope:n,searchRef:k,onItemEnter:v.useCallback(L=>{R(L)&&L.preventDefault()},[R]),onItemLeave:v.useCallback(L=>{var W;R(L)||((W=A.current)==null||W.focus(),_(null))},[R]),onTriggerLeave:v.useCallback(L=>{R(L)&&L.preventDefault()},[R]),pointerGraceTimerRef:O,onPointerGraceIntentChange:v.useCallback(L=>{E.current=L},[]),children:a.jsx(z,{...$,children:a.jsx(Y0,{asChild:!0,trapped:i,onMountAutoFocus:Te(o,L=>{var W;L.preventDefault(),(W=A.current)==null||W.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:a.jsx(fg,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:a.jsx(xN,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:_,onEntryFocus:Te(l,L=>{b.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(wE,{role:"menu","aria-orientation":"vertical","data-state":RH(y.open),"data-radix-menu-content":"",dir:b.dir,...x,...m,ref:j,style:{outline:"none",...m.style},onKeyDown:Te(m.onKeyDown,L=>{const Y=L.target.closest("[data-radix-menu-content]")===L.currentTarget,te=L.ctrlKey||L.altKey||L.metaKey,me=L.key.length===1;Y&&(L.key==="Tab"&&L.preventDefault(),!te&&me&&G(L.key));const F=A.current;if(L.target!==F||!ole.includes(L.key))return;L.preventDefault();const ne=S().filter(ae=>!ae.disabled).map(ae=>ae.ref.current);fH.includes(L.key)&&ne.reverse(),jle(ne)}),onBlur:Te(t.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(P.current),k.current="")}),onPointerMove:Te(t.onPointerMove,bm(L=>{const W=L.target,Y=D.current!==L.clientX;if(L.currentTarget.contains(W)&&Y){const te=L.clientX>D.current?"right":"left";I.current=te,D.current=L.clientX}}))})})})})})})});yH.displayName=Ao;var vle="MenuGroup",EN=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(it.div,{role:"group",...r,ref:e})});EN.displayName=vle;var yle="MenuLabel",xH=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(it.div,{...r,ref:e})});xH.displayName=yle;var Px="MenuItem",AR="menu.itemSelect",iw=v.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,o=v.useRef(null),s=Tg(Px,t.__scopeMenu),c=AN(Px,t.__scopeMenu),l=Pt(e,o),u=v.useRef(!1),d=()=>{const f=o.current;if(!n&&f){const h=new CustomEvent(AR,{bubbles:!0,cancelable:!0});f.addEventListener(AR,p=>r==null?void 0:r(p),{once:!0}),u4(f,h),h.defaultPrevented?u.current=!1:s.onClose()}};return a.jsx(bH,{...i,ref:l,disabled:n,onClick:Te(t.onClick,d),onPointerDown:f=>{var h;(h=t.onPointerDown)==null||h.call(t,f),u.current=!0},onPointerUp:Te(t.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:Te(t.onKeyDown,f=>{const h=c.searchRef.current!=="";n||h&&f.key===" "||NA.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});iw.displayName=Px;var bH=v.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=t,s=AN(Px,n),c=pH(n),l=v.useRef(null),u=Pt(e,l),[d,f]=v.useState(!1),[h,p]=v.useState("");return v.useEffect(()=>{const g=l.current;g&&p((g.textContent??"").trim())},[o.children]),a.jsx(xm.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:a.jsx(bN,{asChild:!0,...c,focusable:!r,children:a.jsx(it.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:u,onPointerMove:Te(t.onPointerMove,bm(g=>{r?s.onItemLeave(g):(s.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Te(t.onPointerLeave,bm(g=>s.onItemLeave(g))),onFocus:Te(t.onFocus,()=>f(!0)),onBlur:Te(t.onBlur,()=>f(!1))})})})}),xle="MenuCheckboxItem",wH=v.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return a.jsx(jH,{scope:t.__scopeMenu,checked:n,children:a.jsx(iw,{role:"menuitemcheckbox","aria-checked":kx(n)?"mixed":n,...i,ref:e,"data-state":NN(n),onSelect:Te(i.onSelect,()=>r==null?void 0:r(kx(n)?!0:!n),{checkForDefaultPrevented:!1})})})});wH.displayName=xle;var SH="MenuRadioGroup",[ble,wle]=Pu(SH,{value:void 0,onValueChange:()=>{}}),CH=v.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,o=Cr(r);return a.jsx(ble,{scope:t.__scopeMenu,value:n,onValueChange:o,children:a.jsx(EN,{...i,ref:e})})});CH.displayName=SH;var _H="MenuRadioItem",AH=v.forwardRef((t,e)=>{const{value:n,...r}=t,i=wle(_H,t.__scopeMenu),o=n===i.value;return a.jsx(jH,{scope:t.__scopeMenu,checked:o,children:a.jsx(iw,{role:"menuitemradio","aria-checked":o,...r,ref:e,"data-state":NN(o),onSelect:Te(r.onSelect,()=>{var s;return(s=i.onValueChange)==null?void 0:s.call(i,n)},{checkForDefaultPrevented:!1})})})});AH.displayName=_H;var TN="MenuItemIndicator",[jH,Sle]=Pu(TN,{checked:!1}),EH=v.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,o=Sle(TN,n);return a.jsx(Wr,{present:r||kx(o.checked)||o.checked===!0,children:a.jsx(it.span,{...i,ref:e,"data-state":NN(o.checked)})})});EH.displayName=TN;var Cle="MenuSeparator",TH=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(it.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});TH.displayName=Cle;var _le="MenuArrow",NH=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=rw(n);return a.jsx(SE,{...i,...r,ref:e})});NH.displayName=_le;var Ale="MenuSub",[hFe,PH]=Pu(Ale),Yh="MenuSubTrigger",kH=v.forwardRef((t,e)=>{const n=ku(Yh,t.__scopeMenu),r=Tg(Yh,t.__scopeMenu),i=PH(Yh,t.__scopeMenu),o=AN(Yh,t.__scopeMenu),s=v.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:t.__scopeMenu},d=v.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const f=c.current;return()=>{window.clearTimeout(f),l(null)}},[c,l]),a.jsx(CN,{asChild:!0,...u,children:a.jsx(bH,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":RH(n.open),...t,ref:a0(e,i.onTriggerChange),onClick:f=>{var h;(h=t.onClick)==null||h.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Te(t.onPointerMove,bm(f=>{o.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Te(t.onPointerLeave,bm(f=>{var p,g;d();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const m=(g=n.content)==null?void 0:g.dataset.side,y=m==="right",b=y?-5:5,x=h[y?"left":"right"],w=h[y?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+b,y:f.clientY},{x,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x,y:h.bottom}],side:m}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Te(t.onKeyDown,f=>{var p;const h=o.searchRef.current!=="";t.disabled||h&&f.key===" "||sle[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});kH.displayName=Yh;var OH="MenuSubContent",IH=v.forwardRef((t,e)=>{const n=gH(Ao,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,o=ku(Ao,t.__scopeMenu),s=Tg(Ao,t.__scopeMenu),c=PH(OH,t.__scopeMenu),l=v.useRef(null),u=Pt(e,l);return a.jsx(xm.Provider,{scope:t.__scopeMenu,children:a.jsx(Wr,{present:r||o.open,children:a.jsx(xm.Slot,{scope:t.__scopeMenu,children:a.jsx(jN,{id:c.contentId,"aria-labelledby":c.triggerId,...i,ref:u,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;s.isUsingKeyboardRef.current&&((f=l.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Te(t.onFocusOutside,d=>{d.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Te(t.onEscapeKeyDown,d=>{s.onClose(),d.preventDefault()}),onKeyDown:Te(t.onKeyDown,d=>{var p;const f=d.currentTarget.contains(d.target),h=ale[s.dir].includes(d.key);f&&h&&(o.onOpenChange(!1),(p=c.trigger)==null||p.focus(),d.preventDefault())})})})})})});IH.displayName=OH;function RH(t){return t?"open":"closed"}function kx(t){return t==="indeterminate"}function NN(t){return kx(t)?"indeterminate":t?"checked":"unchecked"}function jle(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Ele(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function Tle(t,e,n){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let s=Ele(t,Math.max(o,0));i.length===1&&(s=s.filter(u=>u!==n));const l=s.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Nle(t,e){const{x:n,y:r}=t;let i=!1;for(let o=0,s=e.length-1;or!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Ple(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Nle(n,e)}function bm(t){return e=>e.pointerType==="mouse"?t(e):void 0}var kle=mH,Ole=CN,Ile=vH,Rle=yH,Mle=EN,Dle=xH,$le=iw,Lle=wH,Fle=CH,Ble=AH,Ule=EH,Hle=TH,zle=NH,Gle=kH,Vle=IH,PN="DropdownMenu",[Kle,pFe]=Li(PN,[hH]),Si=hH(),[Wle,MH]=Kle(PN),DH=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:c=!0}=t,l=Si(e),u=v.useRef(null),[d=!1,f]=as({prop:i,defaultProp:o,onChange:s});return a.jsx(Wle,{scope:e,triggerId:Xo(),triggerRef:u,contentId:Xo(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(h=>!h),[f]),modal:c,children:a.jsx(kle,{...l,open:d,onOpenChange:f,dir:r,modal:c,children:n})})};DH.displayName=PN;var $H="DropdownMenuTrigger",LH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,o=MH($H,n),s=Si(n);return a.jsx(Ole,{asChild:!0,...s,children:a.jsx(it.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:a0(e,o.triggerRef),onPointerDown:Te(t.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(o.onOpenToggle(),o.open||c.preventDefault())}),onKeyDown:Te(t.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&o.onOpenToggle(),c.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});LH.displayName=$H;var qle="DropdownMenuPortal",FH=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Si(e);return a.jsx(Ile,{...r,...n})};FH.displayName=qle;var BH="DropdownMenuContent",UH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=MH(BH,n),o=Si(n),s=v.useRef(!1);return a.jsx(Rle,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:e,onCloseAutoFocus:Te(t.onCloseAutoFocus,c=>{var l;s.current||(l=i.triggerRef.current)==null||l.focus(),s.current=!1,c.preventDefault()}),onInteractOutside:Te(t.onInteractOutside,c=>{const l=c.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,d=l.button===2||u;(!i.modal||d)&&(s.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});UH.displayName=BH;var Yle="DropdownMenuGroup",Qle=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Mle,{...i,...r,ref:e})});Qle.displayName=Yle;var Xle="DropdownMenuLabel",HH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Dle,{...i,...r,ref:e})});HH.displayName=Xle;var Jle="DropdownMenuItem",zH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx($le,{...i,...r,ref:e})});zH.displayName=Jle;var Zle="DropdownMenuCheckboxItem",GH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Lle,{...i,...r,ref:e})});GH.displayName=Zle;var eue="DropdownMenuRadioGroup",tue=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Fle,{...i,...r,ref:e})});tue.displayName=eue;var nue="DropdownMenuRadioItem",VH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Ble,{...i,...r,ref:e})});VH.displayName=nue;var rue="DropdownMenuItemIndicator",KH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Ule,{...i,...r,ref:e})});KH.displayName=rue;var iue="DropdownMenuSeparator",WH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Hle,{...i,...r,ref:e})});WH.displayName=iue;var oue="DropdownMenuArrow",sue=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(zle,{...i,...r,ref:e})});sue.displayName=oue;var aue="DropdownMenuSubTrigger",qH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Gle,{...i,...r,ref:e})});qH.displayName=aue;var cue="DropdownMenuSubContent",YH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Vle,{...i,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});YH.displayName=cue;var lue=DH,uue=LH,due=FH,QH=UH,XH=HH,JH=zH,ZH=GH,ez=VH,tz=KH,nz=WH,rz=qH,iz=YH;const PA=lue,kA=uue,fue=v.forwardRef(({className:t,inset:e,children:n,...r},i)=>a.jsxs(rz,{ref:i,className:Ne("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",e&&"pl-8",t),...r,children:[n,a.jsx(fo,{className:"ml-auto h-4 w-4"})]}));fue.displayName=rz.displayName;const hue=v.forwardRef(({className:t,...e},n)=>a.jsx(iz,{ref:n,className:Ne("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));hue.displayName=iz.displayName;const Ox=v.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(due,{children:a.jsx(QH,{ref:r,sideOffset:e,className:Ne("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));Ox.displayName=QH.displayName;const oc=v.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(JH,{ref:r,className:Ne("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));oc.displayName=JH.displayName;const pue=v.forwardRef(({className:t,children:e,checked:n,...r},i)=>a.jsxs(ZH,{ref:i,className:Ne("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(tz,{children:a.jsx(Gs,{className:"h-4 w-4"})})}),e]}));pue.displayName=ZH.displayName;const mue=v.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(ez,{ref:r,className:Ne("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(tz,{children:a.jsx(RE,{className:"h-2 w-2 fill-current"})})}),e]}));mue.displayName=ez.displayName;const gue=v.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(XH,{ref:r,className:Ne("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));gue.displayName=XH.displayName;const vue=v.forwardRef(({className:t,...e},n)=>a.jsx(nz,{ref:n,className:Ne("-mx-1 my-1 h-px bg-muted",t),...e}));vue.displayName=nz.displayName;var kN="Dialog",[oz,sz]=Li(kN),[yue,ps]=oz(kN),az=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=t,c=v.useRef(null),l=v.useRef(null),[u=!1,d]=as({prop:r,defaultProp:i,onChange:o});return a.jsx(yue,{scope:e,triggerRef:c,contentRef:l,contentId:Xo(),titleId:Xo(),descriptionId:Xo(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:s,children:n})};az.displayName=kN;var cz="DialogTrigger",lz=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=ps(cz,n),o=Pt(e,i.triggerRef);return a.jsx(it.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":RN(i.open),...r,ref:o,onClick:Te(t.onClick,i.onOpenToggle)})});lz.displayName=cz;var ON="DialogPortal",[xue,uz]=oz(ON,{forceMount:void 0}),dz=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,o=ps(ON,e);return a.jsx(xue,{scope:e,forceMount:n,children:v.Children.map(r,s=>a.jsx(Wr,{present:n||o.open,children:a.jsx(d0,{asChild:!0,container:i,children:s})}))})};dz.displayName=ON;var Ix="DialogOverlay",fz=v.forwardRef((t,e)=>{const n=uz(Ix,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,o=ps(Ix,t.__scopeDialog);return o.modal?a.jsx(Wr,{present:r||o.open,children:a.jsx(bue,{...i,ref:e})}):null});fz.displayName=Ix;var bue=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=ps(Ix,n);return a.jsx(X0,{as:Hs,allowPinchZoom:!0,shards:[i.contentRef],children:a.jsx(it.div,{"data-state":RN(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),xu="DialogContent",hz=v.forwardRef((t,e)=>{const n=uz(xu,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,o=ps(xu,t.__scopeDialog);return a.jsx(Wr,{present:r||o.open,children:o.modal?a.jsx(wue,{...i,ref:e}):a.jsx(Sue,{...i,ref:e})})});hz.displayName=xu;var wue=v.forwardRef((t,e)=>{const n=ps(xu,t.__scopeDialog),r=v.useRef(null),i=Pt(e,n.contentRef,r);return v.useEffect(()=>{const o=r.current;if(o)return cN(o)},[]),a.jsx(pz,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Te(t.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:Te(t.onPointerDownOutside,o=>{const s=o.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0;(s.button===2||c)&&o.preventDefault()}),onFocusOutside:Te(t.onFocusOutside,o=>o.preventDefault())})}),Sue=v.forwardRef((t,e)=>{const n=ps(xu,t.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return a.jsx(pz,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s,c;(s=t.onCloseAutoFocus)==null||s.call(t,o),o.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var l,u;(l=t.onInteractOutside)==null||l.call(t,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;((u=n.triggerRef.current)==null?void 0:u.contains(s))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),pz=v.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=t,c=ps(xu,n),l=v.useRef(null),u=Pt(e,l);return aN(),a.jsxs(a.Fragment,{children:[a.jsx(Y0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:a.jsx(fg,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":RN(c.open),...s,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(_ue,{titleId:c.titleId}),a.jsx(jue,{contentRef:l,descriptionId:c.descriptionId})]})]})}),IN="DialogTitle",mz=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=ps(IN,n);return a.jsx(it.h2,{id:i.titleId,...r,ref:e})});mz.displayName=IN;var gz="DialogDescription",vz=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=ps(gz,n);return a.jsx(it.p,{id:i.descriptionId,...r,ref:e})});vz.displayName=gz;var yz="DialogClose",xz=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=ps(yz,n);return a.jsx(it.button,{type:"button",...r,ref:e,onClick:Te(t.onClick,()=>i.onOpenChange(!1))})});xz.displayName=yz;function RN(t){return t?"open":"closed"}var bz="DialogTitleWarning",[Cue,wz]=G9(bz,{contentName:xu,titleName:IN,docsSlug:"dialog"}),_ue=({titleId:t})=>{const e=wz(bz),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return v.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},Aue="DialogDescriptionWarning",jue=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wz(Aue).contentName}}.`;return v.useEffect(()=>{var o;const i=(o=t.current)==null?void 0:o.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},Sz=az,Eue=lz,Cz=dz,MN=fz,DN=hz,$N=mz,LN=vz,FN=xz,_z="AlertDialog",[Tue,mFe]=Li(_z,[sz]),Ka=sz(),Az=t=>{const{__scopeAlertDialog:e,...n}=t,r=Ka(e);return a.jsx(Sz,{...r,...n,modal:!0})};Az.displayName=_z;var Nue="AlertDialogTrigger",Pue=v.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Ka(n);return a.jsx(Eue,{...i,...r,ref:e})});Pue.displayName=Nue;var kue="AlertDialogPortal",jz=t=>{const{__scopeAlertDialog:e,...n}=t,r=Ka(e);return a.jsx(Cz,{...r,...n})};jz.displayName=kue;var Oue="AlertDialogOverlay",Ez=v.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Ka(n);return a.jsx(MN,{...i,...r,ref:e})});Ez.displayName=Oue;var Ed="AlertDialogContent",[Iue,Rue]=Tue(Ed),Tz=v.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...i}=t,o=Ka(n),s=v.useRef(null),c=Pt(e,s),l=v.useRef(null);return a.jsx(Cue,{contentName:Ed,titleName:Nz,docsSlug:"alert-dialog",children:a.jsx(Iue,{scope:n,cancelRef:l,children:a.jsxs(DN,{role:"alertdialog",...o,...i,ref:c,onOpenAutoFocus:Te(i.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=l.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[a.jsx(dE,{children:r}),a.jsx(Due,{contentRef:s})]})})})});Tz.displayName=Ed;var Nz="AlertDialogTitle",Pz=v.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Ka(n);return a.jsx($N,{...i,...r,ref:e})});Pz.displayName=Nz;var kz="AlertDialogDescription",Oz=v.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Ka(n);return a.jsx(LN,{...i,...r,ref:e})});Oz.displayName=kz;var Mue="AlertDialogAction",Iz=v.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Ka(n);return a.jsx(FN,{...i,...r,ref:e})});Iz.displayName=Mue;var Rz="AlertDialogCancel",Mz=v.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:i}=Rue(Rz,n),o=Ka(n),s=Pt(e,i);return a.jsx(FN,{...o,...r,ref:s})});Mz.displayName=Rz;var Due=({contentRef:t})=>{const e=`\`${Ed}\` requires a description for the component to be accessible for screen reader users. - -You can add a description to the \`${Ed}\` by passing a \`${kz}\` component as a child, which also benefits sighted users by adding visible context to the dialog. - -Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ed}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. - -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},$ue=Az,Lue=jz,Dz=Ez,$z=Tz,Lz=Iz,Fz=Mz,Bz=Pz,Uz=Oz;const OA=$ue,Fue=Lue,Hz=v.forwardRef(({className:t,...e},n)=>a.jsx(Dz,{className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));Hz.displayName=Dz.displayName;const Rx=v.forwardRef(({className:t,...e},n)=>a.jsxs(Fue,{children:[a.jsx(Hz,{}),a.jsx($z,{ref:n,className:Ne("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));Rx.displayName=$z.displayName;const Mx=({className:t,...e})=>a.jsx("div",{className:Ne("flex flex-col space-y-2 text-center sm:text-left",t),...e});Mx.displayName="AlertDialogHeader";const Dx=({className:t,...e})=>a.jsx("div",{className:Ne("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Dx.displayName="AlertDialogFooter";const $x=v.forwardRef(({className:t,...e},n)=>a.jsx(Bz,{ref:n,className:Ne("text-lg font-semibold",t),...e}));$x.displayName=Bz.displayName;const Lx=v.forwardRef(({className:t,...e},n)=>a.jsx(Uz,{ref:n,className:Ne("text-sm text-muted-foreground",t),...e}));Lx.displayName=Uz.displayName;const Fx=v.forwardRef(({className:t,...e},n)=>a.jsx(Lz,{ref:n,className:Ne(JT(),t),...e}));Fx.displayName=Lz.displayName;const Bx=v.forwardRef(({className:t,...e},n)=>a.jsx(Fz,{ref:n,className:Ne(JT({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Bx.displayName=Fz.displayName;const Ql=Sz,Bue=Cz,zz=v.forwardRef(({className:t,...e},n)=>a.jsx(MN,{ref:n,className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));zz.displayName=MN.displayName;const $c=v.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(Bue,{children:[a.jsx(zz,{}),a.jsxs(DN,{ref:r,className:Ne("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,a.jsxs(FN,{className:"absolute right-4 top-4 z-[100] rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(Jo,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$c.displayName=DN.displayName;const Lc=({className:t,...e})=>a.jsx("div",{className:Ne("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Lc.displayName="DialogHeader";const Fc=({className:t,...e})=>a.jsx("div",{className:Ne("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Fc.displayName="DialogFooter";const Bc=v.forwardRef(({className:t,...e},n)=>a.jsx($N,{ref:n,className:Ne("text-lg font-semibold leading-none tracking-tight",t),...e}));Bc.displayName=$N.displayName;const Xl=v.forwardRef(({className:t,...e},n)=>a.jsx(LN,{ref:n,className:Ne("text-sm text-muted-foreground",t),...e}));Xl.displayName=LN.displayName;var BN="Radio",[Uue,Gz]=Li(BN),[Hue,zue]=Uue(BN),Vz=v.forwardRef((t,e)=>{const{__scopeRadio:n,name:r,checked:i=!1,required:o,disabled:s,value:c="on",onCheck:l,form:u,...d}=t,[f,h]=v.useState(null),p=Pt(e,y=>h(y)),g=v.useRef(!1),m=f?u||!!f.closest("form"):!0;return a.jsxs(Hue,{scope:n,checked:i,disabled:s,children:[a.jsx(it.button,{type:"button",role:"radio","aria-checked":i,"data-state":qz(i),"data-disabled":s?"":void 0,disabled:s,value:c,...d,ref:p,onClick:Te(t.onClick,y=>{i||l==null||l(),m&&(g.current=y.isPropagationStopped(),g.current||y.stopPropagation())})}),m&&a.jsx(Gue,{control:f,bubbles:!g.current,name:r,value:c,checked:i,required:o,disabled:s,form:u,style:{transform:"translateX(-100%)"}})]})});Vz.displayName=BN;var Kz="RadioIndicator",Wz=v.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:r,...i}=t,o=zue(Kz,n);return a.jsx(Wr,{present:r||o.checked,children:a.jsx(it.span,{"data-state":qz(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:e})})});Wz.displayName=Kz;var Gue=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,o=v.useRef(null),s=wg(n),c=pg(e);return v.useEffect(()=>{const l=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(h)}},[s,n,r]),a.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...t.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function qz(t){return t?"checked":"unchecked"}var Vue=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],UN="RadioGroup",[Kue,gFe]=Li(UN,[qf,Gz]),Yz=qf(),Qz=Gz(),[Wue,que]=Kue(UN),Xz=v.forwardRef((t,e)=>{const{__scopeRadioGroup:n,name:r,defaultValue:i,value:o,required:s=!1,disabled:c=!1,orientation:l,dir:u,loop:d=!0,onValueChange:f,...h}=t,p=Yz(n),g=Nu(u),[m,y]=as({prop:o,defaultProp:i,onChange:f});return a.jsx(Wue,{scope:n,name:r,required:s,disabled:c,value:m,onValueChange:y,children:a.jsx(xN,{asChild:!0,...p,orientation:l,dir:g,loop:d,children:a.jsx(it.div,{role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":c?"":void 0,dir:g,...h,ref:e})})})});Xz.displayName=UN;var Jz="RadioGroupItem",Zz=v.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:r,...i}=t,o=que(Jz,n),s=o.disabled||r,c=Yz(n),l=Qz(n),u=v.useRef(null),d=Pt(e,u),f=o.value===i.value,h=v.useRef(!1);return v.useEffect(()=>{const p=m=>{Vue.includes(m.key)&&(h.current=!0)},g=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",g),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",g)}},[]),a.jsx(bN,{asChild:!0,...c,focusable:!s,active:f,children:a.jsx(Vz,{disabled:s,required:o.required,checked:f,...l,...i,name:o.name,ref:d,onCheck:()=>o.onValueChange(i.value),onKeyDown:Te(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:Te(i.onFocus,()=>{var p;h.current&&((p=u.current)==null||p.click())})})})});Zz.displayName=Jz;var Yue="RadioGroupIndicator",eG=v.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...r}=t,i=Qz(n);return a.jsx(Wz,{...i,...r,ref:e})});eG.displayName=Yue;var tG=Xz,nG=Zz,Que=eG;const IA=v.forwardRef(({className:t,...e},n)=>a.jsx(tG,{className:Ne("grid gap-2",t),...e,ref:n}));IA.displayName=tG.displayName;const Qh=v.forwardRef(({className:t,...e},n)=>a.jsx(nG,{ref:n,className:Ne("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:a.jsx(Que,{className:"flex items-center justify-center",children:a.jsx(RE,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Qh.displayName=nG.displayName;var HN="Checkbox",[Xue,vFe]=Li(HN),[Jue,Zue]=Xue(HN),rG=v.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:c,value:l="on",onCheckedChange:u,form:d,...f}=t,[h,p]=v.useState(null),g=Pt(e,S=>p(S)),m=v.useRef(!1),y=h?d||!!h.closest("form"):!0,[b=!1,x]=as({prop:i,defaultProp:o,onChange:u}),w=v.useRef(b);return v.useEffect(()=>{const S=h==null?void 0:h.form;if(S){const C=()=>x(w.current);return S.addEventListener("reset",C),()=>S.removeEventListener("reset",C)}},[h,x]),a.jsxs(Jue,{scope:n,state:b,disabled:c,children:[a.jsx(it.button,{type:"button",role:"checkbox","aria-checked":Uc(b)?"mixed":b,"aria-required":s,"data-state":sG(b),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:g,onKeyDown:Te(t.onKeyDown,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Te(t.onClick,S=>{x(C=>Uc(C)?!0:!C),y&&(m.current=S.isPropagationStopped(),m.current||S.stopPropagation())})}),y&&a.jsx(ede,{control:h,bubbles:!m.current,name:r,value:l,checked:b,required:s,disabled:c,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Uc(o)?!1:o})]})});rG.displayName=HN;var iG="CheckboxIndicator",oG=v.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...i}=t,o=Zue(iG,n);return a.jsx(Wr,{present:r||Uc(o.state)||o.state===!0,children:a.jsx(it.span,{"data-state":sG(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:e,style:{pointerEvents:"none",...t.style}})})});oG.displayName=iG;var ede=t=>{const{control:e,checked:n,bubbles:r=!0,defaultChecked:i,...o}=t,s=v.useRef(null),c=wg(n),l=pg(e);v.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==n&&p){const g=new Event("click",{bubbles:r});d.indeterminate=Uc(n),p.call(d,Uc(n)?!1:n),d.dispatchEvent(g)}},[c,n,r]);const u=v.useRef(Uc(n)?!1:n);return a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...o,tabIndex:-1,ref:s,style:{...t.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Uc(t){return t==="indeterminate"}function sG(t){return Uc(t)?"indeterminate":t?"checked":"unchecked"}var aG=rG,tde=oG;const Dl=v.forwardRef(({className:t,...e},n)=>a.jsx(aG,{ref:n,className:Ne("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:a.jsx(tde,{className:Ne("flex items-center justify-center text-current"),children:a.jsx(Gs,{className:"h-4 w-4"})})}));Dl.displayName=aG.displayName;const zN=({isActive:t,isComplete:e,hasError:n,label:r,onComplete:i,className:o})=>{const[s,c]=v.useState(0),[l,u]=v.useState("progressing"),[d,f]=v.useState(!1),h=v.useRef(null),p=v.useRef(null),g=()=>{h.current&&(clearInterval(h.current),h.current=null),p.current&&(clearTimeout(p.current),p.current=null)},m=()=>{g(),c(0),u("progressing"),f(!1)},y=S=>{g(),u("completing");const C=100-S,_=50,A=500/_,j=C/A;let P=0;h.current=setInterval(()=>{P++;const k=S+j*P;k>=100||P>=A?(c(100),u("completed"),g(),p.current=setTimeout(()=>{u("hiding"),setTimeout(()=>{m(),i==null||i()},300)},2e3)):c(k)},_)},b=()=>{l==="progressing"&&y(s)},x=()=>{l==="waiting"&&y(90)},w=()=>{g()};return v.useEffect(()=>{if(t&&!d){f(!0),c(0),u("progressing");const S=90/540;let C=0;h.current=setInterval(()=>{C+=S,C>=90?(c(90),u("waiting"),g()):c(C)},100)}return e&&l==="progressing"&&b(),e&&l==="waiting"&&x(),n&&(l==="progressing"||l==="waiting")&&w(),!t&&d&&m(),()=>{t||g()}},[t,e,n,l,d]),v.useEffect(()=>()=>{g()},[]),d?a.jsxs("div",{className:Ne("w-full space-y-2",o),children:[r&&a.jsxs("div",{className:"flex justify-between items-center text-sm text-muted-foreground",children:[a.jsx("span",{children:l==="waiting"?`${r} - finalizing...`:r}),a.jsxs("span",{children:[Math.round(s),"%"]})]}),a.jsx(Rl,{value:s,className:Ne("w-full transition-all duration-200",n&&"opacity-75",l==="completed"&&"bg-green-100")}),n&&a.jsx("div",{className:"text-sm text-red-600",children:"Generation failed. Please try again."}),l==="completed"&&!n&&a.jsx("div",{className:"text-sm text-green-600",children:"Generation completed successfully!"})]}):null},tr="all",nde=()=>{var Xt,wn,oo,ta;const t=v.useCallback(()=>{document.body.style.pointerEvents==="none"&&(console.log("ensureBodyInteractive: Fixing body pointer-events..."),document.body.style.pointerEvents="auto")},[]),e=ar(),[n]=FJ(),{loadPersonas:r}=E6(),[i,o]=v.useState("view"),[s,c]=v.useState("ai"),[l,u]=v.useState("");v.useState(null);const[d,f]=v.useState(tr),[h,p]=v.useState(!1),[g,m]=v.useState("");v.useEffect(()=>{const q=n.get("mode");(q==="view"||q==="create")&&o(q)},[n]);const[y,b]=v.useState([]),[x,w]=v.useState([]),[S,C]=v.useState(!0);v.useState(null);const[_,A]=v.useState(new Set),[j,P]=v.useState(!1),[k,O]=v.useState(null),[E,I]=v.useState(""),[D,z]=v.useState(!1),[$,G]=v.useState(null),[R,L]=v.useState(!1),[W,Y]=v.useState(null),[te,me]=v.useState(!1),[F,se]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[ne,ae]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[De,de]=v.useState(!1),[ye,Ee]=v.useState(!1),[Z,ct]=v.useState(!1),[Le,At]=v.useState(!1),[lt,Jt]=v.useState("gemini-2.5-pro"),T=()=>{de(!1),Ee(!1),ct(!1)},M=q=>{const Pe={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return q.forEach(We=>{if(We.age&&Pe.age.add(We.age),We.gender&&Pe.gender.add(We.gender),We.occupation&&Pe.occupation.add(We.occupation),We.location&&Pe.location.add(We.location),We.techSavviness!==void 0){const yt=We.techSavviness<30?"Low (0-30)":We.techSavviness<70?"Medium (31-70)":"High (71-100)";Pe.techSavviness.add(yt)}We.ethnicity&&Pe.ethnicity.add(We.ethnicity)}),{age:Array.from(Pe.age).sort(),gender:Array.from(Pe.gender).sort(),occupation:Array.from(Pe.occupation).sort(),location:Array.from(Pe.location).sort(),techSavviness:Array.from(Pe.techSavviness).sort((We,yt)=>{const et=["Low (0-30)","Medium (31-70)","High (71-100)"];return et.indexOf(We)-et.indexOf(yt)}),ethnicity:Array.from(Pe.ethnicity).sort()}},U=()=>{me(!1),setTimeout(()=>{se({...ne})},0)},V=()=>{ae({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]})},Q=(q,Pe)=>{ae(We=>{const yt={...We};return yt[q].includes(Pe)?yt[q]=yt[q].filter(et=>et!==Pe):yt[q]=[...yt[q],Pe],yt})},B=async()=>{try{const We=(await js.getAll()).data.map(yt=>({...yt,id:yt._id}));return w(We),We}catch(q){return console.error("Error fetching folders:",q),qe.error("Failed to load folders"),w([]),[]}},X=async()=>{C(!0);try{const We=(await zr.getAll()).data;{const et=[...We.map(bt=>({...bt,id:bt.id||bt._id}))];try{(async()=>{const hn=await r();console.log("Loaded stored personas (for debugging only):",hn?hn.length:0)})()}catch(bt){console.warn("Error loading stored personas:",bt)}b(et)}}catch(Pe){console.error("Error fetching personas:",Pe),qe.error("Failed to load personas"),b([])}finally{C(!1)}};v.useEffect(()=>((async()=>{try{const[,]=await Promise.all([B(),X()])}catch(Pe){console.error("Error loading data:",Pe)}})(),()=>{}),[t]),v.useEffect(()=>{var q;if(i==="view")X();else if(i==="create"&&(console.log(`Switching to create mode with folder: ${d}, ${d!==tr?"NOT default":"IS default"}`),d!==tr)){const Pe=(q=x.find(We=>We.id===d))==null?void 0:q.name;console.log(`Selected folder for creation: ${d} (${Pe})`)}},[i]),v.useEffect(()=>{X();const q=()=>{window.location.pathname.includes("/synthetic-users")&&!window.location.pathname.includes("/synthetic-users/")&&(console.log("Navigation to synthetic users page detected, refreshing data"),X())},Pe=()=>{console.log("Synthetic users navigation event detected, refreshing data"),X()};console.log("Setting up MutationObserver for body style");const We=new MutationObserver(yt=>{yt.forEach(et=>{et.type==="attributes"&&et.attributeName==="style"&&document.body.style.pointerEvents==="none"&&(console.log("MutationObserver detected pointer-events: none, fixing..."),t())})});return We.observe(document.body,{attributes:!0,attributeFilter:["style"]}),t(),window.addEventListener("popstate",q),window.addEventListener("syntheticUsersNavigation",Pe),()=>{window.removeEventListener("popstate",q),window.removeEventListener("syntheticUsersNavigation",Pe),console.log("Disconnecting MutationObserver"),We.disconnect()}},[]);const ge=async()=>{if(!g.trim()){qe.error("Please enter a folder name");return}try{const q=await js.create({name:g.trim(),persona_ids:[]});await B(),m(""),p(!1),qe.success(`Folder "${g}" created`)}catch(q){console.error("Error creating folder:",q),qe.error("Failed to create folder")}},xe=()=>{m(""),p(!1)},Re=q=>{O(q),I(q.name)},be=async()=>{if(!k||!E.trim()){O(null);return}try{await js.update(k._id,{name:E.trim()}),await B(),O(null),qe.success(`Folder renamed to "${E}"`)}catch(q){console.error("Error renaming folder:",q),qe.error("Failed to rename folder"),O(null)}},Ve=()=>{O(null),I("")},st=q=>{G(q),z(!0)},kt=async()=>{if($)try{await js.delete($._id),await B(),(d===$._id||d===$.id)&&f(tr),z(!1),G(null),qe.success(`Folder "${$.name}" deleted`)}catch(q){console.error("Error deleting folder:",q),qe.error("Failed to delete folder")}},Ke=async(q,Pe)=>{var hn;const We=q||_,yt=Pe||W;if(!yt||We.size===0)return;const et=Array.from(We),bt=et.map(ut=>{const An=y.find(an=>an.id===ut);return(An==null?void 0:An._id)||(An==null?void 0:An.id)||ut}).filter(Boolean);try{const ut=[],An=[];if(yt!==tr)try{await js.addPersonasBatch(yt,bt),ut.push(...et)}catch(rn){console.error("Error adding personas to folder:",rn),An.push(...et)}else ut.push(...et);await Promise.all([B(),X()]);const an=yt===tr?"All Personas":((hn=x.find(rn=>rn._id===yt||rn.id===yt))==null?void 0:hn.name)||"folder";return ut.length>0&&qe.success(`Added ${ut.length} persona${ut.length!==1?"s":""} to ${an}`),An.length>0&&qe.error(`Failed to add ${An.length} persona${An.length!==1?"s":""} to ${an}.`),q||A(new Set),{success:ut.length>0,successCount:ut.length,failureCount:An.length}}catch(ut){return console.error("Error moving personas to folder:",ut),qe.error("An unexpected error occurred while adding personas to folder."),{success:!1,error:ut}}},tt=async()=>{var We,yt,et;if(_.size===0||d===tr)return;const q=Array.from(_),Pe=q.map(bt=>{const hn=y.find(ut=>ut.id===bt);return(hn==null?void 0:hn._id)||(hn==null?void 0:hn.id)||bt}).filter(Boolean);console.log("Removing personas from folder:",{selectedFolder:d,selectedIds:q,mongoIds:Pe,folderName:(We=x.find(bt=>bt._id===d))==null?void 0:We.name});try{await js.removePersonasBatch(d,Pe),await Promise.all([B(),X()]);const bt=((yt=x.find(hn=>hn._id===d))==null?void 0:yt.name)||"folder";qe.success(`Removed ${q.length} persona${q.length!==1?"s":""} from ${bt}`),A(new Set)}catch(bt){console.error("Error removing personas from folder:",bt),console.error("Error details:",((et=bt.response)==null?void 0:et.data)||bt.message),qe.error("Failed to remove personas from folder")}},Nt=q=>{A(Pe=>{const We=new Set(Pe);return We.has(q)?We.delete(q):We.add(q),We})},sn=()=>{_.size===fn.length?A(new Set):A(new Set(fn.map(q=>q.id)))},Nr=async()=>{if(_.size===0)return;const q=Array.from(_);A(new Set),P(!1),C(!0);const Pe=[],We=[];for(const yt of q)try{const et=y.find(hn=>hn.id===yt);if(!et){console.error(`Could not find persona with id: ${yt}`),We.push(yt);continue}let bt=yt;et._id&&(bt=et._id.toString()),console.log(`Attempting to delete persona: ${bt}`),await zr.delete(bt),Pe.push(yt)}catch(et){console.error(`Failed to delete persona ${yt}:`,et),We.push(yt)}b(yt=>yt.filter(et=>!Pe.includes(et.id))),await B(),C(!1),setTimeout(()=>{Pe.length>0&&qe.success(`Successfully deleted ${Pe.length} persona${Pe.length!==1?"s":""}`),We.length>0&&qe.error(`Failed to delete ${We.length} persona${We.length!==1?"s":""}`),(Pe.length>0||We.length>0)&&X()},50)},fn=y.filter(q=>{const Pe=q.name.toLowerCase().includes(l.toLowerCase())||q.occupation.toLowerCase().includes(l.toLowerCase())||q.location.toLowerCase().includes(l.toLowerCase()),We=(F.age.length===0||F.age.includes(q.age))&&(F.gender.length===0||F.gender.includes(q.gender))&&(F.occupation.length===0||F.occupation.includes(q.occupation))&&(F.location.length===0||F.location.includes(q.location))&&(F.ethnicity.length===0||q.ethnicity&&F.ethnicity.includes(q.ethnicity))&&(F.techSavviness.length===0||q.techSavviness!==void 0&&F.techSavviness.includes(q.techSavviness<30?"Low (0-30)":q.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&(F.folderStatus.length===0||F.folderStatus.includes("hasFolder")&&F.folderStatus.includes("noFolder")||F.folderStatus.includes("hasFolder")&&!F.folderStatus.includes("noFolder")&&q.folderId&&q.folderId!==tr||F.folderStatus.includes("noFolder")&&!F.folderStatus.includes("hasFolder")&&(!q.folderId||q.folderId===tr));return d===tr||q.folder_ids&&Array.isArray(q.folder_ids)&&q.folder_ids.includes(d)||q.folder_id===d||q.folderId===d?Pe&&We:!1}),St=(q,Pe)=>{const We=new Date().toISOString().split("T")[0],yt=q.length;let et=`# Persona Summary Report - -`;return et+=`**Folder:** ${Pe} -`,et+=`**Date:** ${We} -`,et+=`**Total Personas:** ${yt} - -`,yt===0?(et+=`No personas found in this folder. -`,et):(q.forEach((bt,hn)=>{et+=`## ${bt.name} - -`,et+=`### Demographics -`,et+=`- **Age:** ${bt.age} -`,et+=`- **Gender:** ${bt.gender} -`,et+=`- **Occupation:** ${bt.occupation} -`,et+=`- **Location:** ${bt.location} - -`,bt.aiSynthesizedBio&&(et+=`### AI-Synthesized Bio -`,et+=`${bt.aiSynthesizedBio} - -`),bt.qualitativeAttributes&&bt.qualitativeAttributes.length>0&&(et+=`### Key Attributes -`,bt.qualitativeAttributes.forEach(ut=>{et+=`- šŸ·ļø ${ut} -`}),et+=` -`),bt.topPersonalityTraits&&bt.topPersonalityTraits.length>0&&(et+=`### Top Personality Traits -`,bt.topPersonalityTraits.forEach(ut=>{et+=`- 🧠 ${ut} -`}),et+=` -`),hn{if(fn.length===0){qe.error("No personas to download");return}At(!0)},ot=async()=>{var We,yt,et,bt,hn;const q=d===tr?"All Personas":((We=x.find(ut=>ut.id===d))==null?void 0:We.name)||"Unknown Folder",Pe=fn.map(ut=>ut._id||ut.id);console.log(`šŸ¤– Frontend: User selected ${lt} for persona summary download`),At(!1),de(!0),Ee(!1),ct(!1),C(!0);try{qe.info("Generating persona summaries...",{description:`Processing ${fn.length} persona${fn.length!==1?"s":""} with AI`});const ut=await ua.batchGenerateSummaries(Pe,.7,lt),{summaries:An,summary_stats:an,errors:rn}=ut.data,gr=new Date().toISOString().split("T")[0],H=`persona-summary-${q.toLowerCase().replace(/\s+/g,"-")}-${gr}.md`;let he=`# Persona Summary Report - -`;he+=`**Folder:** ${q} -`,he+=`**Date:** ${gr} -`,he+=`**Total Personas:** ${an.total_requested} -`,he+=`**Successfully Processed:** ${an.total_successful} -`,an.total_failed>0&&(he+=`**Failed to Process:** ${an.total_failed} -`),he+=` ---- - -`,An.length===0?he+=`No persona summaries could be generated. -`:An.forEach((zt,er)=>{he+=`# ${zt.persona_name} - -`,he+=`${zt.summary} - -`,er0||((et=rn.missing_personas)==null?void 0:et.length)>0)&&(he+=` ---- - -## Processing Errors - -`,((bt=rn.failed_summaries)==null?void 0:bt.length)>0&&(he+=`### Failed to Generate Summaries -`,rn.failed_summaries.forEach(zt=>{he+=`- **${zt.persona_name}** (ID: ${zt.persona_id}): ${zt.error} -`}),he+=` -`),((hn=rn.missing_personas)==null?void 0:hn.length)>0&&(he+=`### Missing Personas -`,rn.missing_personas.forEach(zt=>{he+=`- ID: ${zt} -`})));const ue=document.createElement("a"),je=new Blob([he],{type:"text/markdown"});ue.href=URL.createObjectURL(je),ue.download=H,document.body.appendChild(ue),ue.click(),document.body.removeChild(ue),Ee(!0);const Be=lt==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro";an.total_successful===an.total_requested?qe.success("Persona summary downloaded",{description:`Successfully processed all ${an.total_successful} persona${an.total_successful!==1?"s":""} from "${q}" using ${Be}`}):qe.success("Persona summary downloaded with warnings",{description:`Processed ${an.total_successful} of ${an.total_requested} personas from "${q}" using ${Be}`})}catch(ut){console.error("Error generating persona summaries:",ut),ut.response?(console.error("Error response data:",ut.response.data),console.error("Error response status:",ut.response.status),console.error("Error response headers:",ut.response.headers)):ut.request?console.error("Error request:",ut.request):console.error("Error message:",ut.message),ct(!0),qe.error("AI summary generation failed, creating basic summary",{description:"Using simplified format due to processing error"});try{const An=new Date().toISOString().split("T")[0],an=`persona-summary-basic-${q.toLowerCase().replace(/\s+/g,"-")}-${An}.md`,rn=St(fn,q),gr=document.createElement("a"),H=new Blob([rn],{type:"text/markdown"});gr.href=URL.createObjectURL(H),gr.download=an,document.body.appendChild(gr),gr.click(),document.body.removeChild(gr)}catch{qe.error("Failed to create persona summary",{description:"Unable to generate summary in any format"})}}finally{C(!1)}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:"Synthetic Personas"}),a.jsx("p",{className:"text-slate-600 mt-1",children:"Create and manage AI-generated research participants"})]}),a.jsx("div",{className:"mt-4 sm:mt-0 flex flex-col items-end gap-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[i==="view"&&fn.length>0&&a.jsxs(J,{variant:"outline",onClick:Ze,disabled:De,className:"flex items-center gap-2 hover-transition",children:[a.jsx(lu,{className:"h-4 w-4"}),De?"Generating Summary...":"Download Persona Summary"]}),a.jsx(J,{onClick:()=>o(i==="view"?"create":"view"),className:"hover-transition",children:i==="view"?"Create New Personas":"View All Personas"})]})})]}),i==="view"&&fn.length>0&&De&&a.jsx("div",{className:"mb-6",children:a.jsx(zN,{isActive:De,isComplete:ye,hasError:Z,label:"Generating comprehensive persona summaries",onComplete:T,className:"max-w-4xl mx-auto"})}),i==="view"?a.jsx(a.Fragment,{children:a.jsxs("div",{className:"flex flex-col md:flex-row gap-6 mb-6",children:[a.jsxs("div",{className:"w-full md:w-64 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium",children:"Folders"}),a.jsx(J,{variant:"ghost",size:"sm",onClick:()=>p(!0),className:"h-7 w-7 p-0",children:a.jsx(f5,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>f(tr),className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${d===tr?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),x.map(q=>a.jsx("div",{className:"flex items-center justify-between group",children:k&&k._id===q._id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx(Ht,{value:E,onChange:Pe=>I(Pe.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:Pe=>{Pe.key==="Enter"?be():Pe.key==="Escape"&&Ve()}}),a.jsx(J,{size:"sm",variant:"ghost",onClick:be,className:"h-7 w-7 p-0",children:a.jsx(Gs,{className:"h-4 w-4"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:Ve,className:"h-7 w-7 p-0",children:a.jsx(Jo,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>f(q._id),className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${d===q._id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:q.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:y.filter(Pe=>Pe.folder_ids&&Pe.folder_ids.includes(q._id)).length})]}),a.jsxs(PA,{children:[a.jsx(kA,{asChild:!0,children:a.jsx(J,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(U_,{className:"h-4 w-4"})})}),a.jsxs(Ox,{align:"end",children:[a.jsx(oc,{onClick:()=>Re(q),children:"Rename"}),a.jsx(oc,{className:"text-red-600",onClick:()=>st(q),children:"Delete"})]})]})]})},q._id)),h&&a.jsxs("div",{className:"flex items-center px-3 py-2 space-x-2",children:[a.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx(Ht,{value:g,onChange:q=>m(q.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:q=>{q.key==="Enter"?ge():q.key==="Escape"&&xe()}})]}),a.jsx(J,{size:"sm",variant:"ghost",onClick:ge,className:"h-7 w-7 p-0",children:a.jsx(Gs,{className:"h-4 w-4"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:xe,className:"h-7 w-7 p-0",children:a.jsx(Jo,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx($E,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Ht,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:l,onChange:q=>u(q.target.value)})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[_.size>0&&a.jsxs(PA,{children:[a.jsx(kA,{asChild:!0,children:a.jsxs(J,{variant:"outline",size:"sm",className:"flex items-center gap-2",onClick:q=>{q.stopPropagation()},children:[a.jsxs("span",{children:["Actions (",_.size,")"]}),a.jsx(U_,{className:"h-4 w-4"})]})}),a.jsxs(Ox,{align:"end",onCloseAutoFocus:q=>{q.preventDefault()},children:[a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:q=>{q.preventDefault(),q.stopPropagation();const Pe=Array.from(_);e("/focus-groups",{state:{mode:"create",preSelectedParticipants:Pe}})},children:[a.jsx(Vs,{className:"h-4 w-4"}),"Create Focus Group with selected Personas"]}),a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:q=>{q.preventDefault(),q.stopPropagation(),P(!0)},children:[a.jsx(nr,{className:"h-4 w-4"}),"Delete"]}),a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:q=>{q.preventDefault(),q.stopPropagation(),L(!0)},children:[a.jsx(ho,{className:"h-4 w-4"}),"Move to folder"]}),d!==tr&&a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:q=>{q.preventDefault(),q.stopPropagation(),tt()},children:[a.jsx(Jo,{className:"h-4 w-4"}),"Remove from ",((Xt=x.find(q=>q._id===d))==null?void 0:Xt.name)||"folder"]})]})]}),a.jsxs(J,{variant:"outline",className:"flex items-center gap-2",onClick:()=>me(!0),children:[a.jsx(ME,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(F).some(q=>q.length>0)?` (${Object.values(F).reduce((q,Pe)=>q+Pe.length,0)})`:""]})]})]})]}),a.jsxs("div",{className:"glass-panel rounded-xl p-6 mb-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Dr,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:d===tr?"Your Synthetic Persona Library":((wn=x.find(q=>q._id===d))==null?void 0:wn.name)||"Personas"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",fn.length,")"]})]}),fn.length>0&&a.jsxs("div",{className:"flex items-center",children:[a.jsx(Dl,{id:"select-all",checked:fn.length>0&&_.size===fn.length,onCheckedChange:sn,className:"mr-2"}),a.jsx("label",{htmlFor:"select-all",className:"text-sm cursor-pointer",children:"Select All"})]})]}),fn.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-1 lg:grid-cols-2 xl:grid-cols-2 gap-4",children:fn.map(q=>a.jsx("div",{className:"relative group",children:a.jsx(fN,{user:q,selected:_.has(q.id),onClick:()=>e(`/synthetic-users/${q._id||q.id}`),onSelectionToggle:Pe=>{Pe.stopPropagation(),Nt(q.id)},showAddToFolderButton:!1,folders:x})},q.id))}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No personas found matching your criteria."})})]}),a.jsx(OA,{open:j,onOpenChange:q=>{P(q||!1)},children:a.jsxs(Rx,{onInteractOutside:q=>{q.preventDefault()},children:[a.jsxs(Mx,{children:[a.jsx($x,{children:"Delete Personas"}),a.jsxs(Lx,{children:["Are you sure you want to delete ",_.size," selected persona",_.size!==1?"s":"","? This action cannot be undone."]})]}),a.jsxs(Dx,{children:[a.jsx(Bx,{onClick:()=>{setTimeout(()=>A(new Set),50)},children:"Cancel"}),a.jsx(Fx,{onClick:Nr,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(OA,{open:D,onOpenChange:q=>{z(q||!1)},children:a.jsxs(Rx,{children:[a.jsxs(Mx,{children:[a.jsx($x,{children:"Delete Folder"}),a.jsxs(Lx,{children:['Are you sure you want to delete the folder "',$==null?void 0:$.name,'"?',a.jsx("br",{}),a.jsx("br",{}),a.jsx("strong",{children:"Note:"})," Any personas in this folder will not be deleted - they will still be available under 'All Personas' after folder deletion."]})]}),a.jsxs(Dx,{children:[a.jsx(Bx,{children:"Cancel"}),a.jsx(Fx,{onClick:kt,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(Ql,{open:R,onOpenChange:q=>{L(q||!1)},children:a.jsxs($c,{className:"z-50",children:[a.jsxs(Lc,{children:[a.jsx(Bc,{children:"Move to Folder"}),a.jsxs(Xl,{children:["Choose a folder to move ",_.size," selected persona",_.size!==1?"s":""," to."]})]}),a.jsx("div",{className:"py-4",children:a.jsxs(IA,{value:W||"",onValueChange:Y,className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:tr,id:"folder-all"}),a.jsxs(mo,{htmlFor:"folder-all",className:"flex items-center gap-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas (Remove from folders)"})]})]}),x.map(q=>a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:q._id,id:`folder-${q._id}`}),a.jsxs(mo,{htmlFor:`folder-${q._id}`,className:"flex items-center gap-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:q.name})]})]},q._id))]})}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:q=>{q.preventDefault(),q.stopPropagation(),L(!1),Y(null)},children:"Cancel"}),a.jsx(J,{onClick:async q=>{if(q.preventDefault(),q.stopPropagation(),!W)return;const Pe=new Set(_),We=W;if(L(!1),Y(null),We&&Pe.size>0){C(!0);try{await Ke(Pe,We)}finally{C(!1),A(new Set)}}},disabled:!W,children:"Move"})]})]})}),a.jsx(Ql,{open:te,onOpenChange:q=>{q?(me(q),ae({...F})):(_.size>0&&A(new Set),me(!1))},children:a.jsxs($c,{className:"max-w-4xl max-h-[80vh] flex flex-col",onInteractOutside:q=>{q.preventDefault()},children:[a.jsx("div",{className:"sticky top-0 bg-background border-b shadow-sm pb-4 z-10",children:a.jsxs(Lc,{children:[a.jsx(Bc,{children:"Filter Personas"}),a.jsx(Xl,{children:"Select attributes to filter personas by. Multiple selections within a category use OR logic, different categories use AND logic. Filter options dynamically update to show only relevant values."})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-1 py-4 space-y-6",children:[Object.values(ne).some(q=>q.length>0)&&a.jsx("div",{className:"bg-muted/30 p-3 rounded-md",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[Object.values(ne).reduce((q,Pe)=>q+Pe.length,0)," active filters"]})}),a.jsx("div",{className:"space-y-4",children:(()=>{const q=et=>{const bt={...ne};bt[et]=[];const hn=y.filter(ut=>Object.entries(bt).every(([An,an])=>{if(an.length===0)return!0;const rn=An;if(rn==="techSavviness"&&ut.techSavviness!==void 0){const gr=ut.techSavviness<30?"Low (0-30)":ut.techSavviness<70?"Medium (31-70)":"High (71-100)";return an.includes(gr)}else{if(rn==="age"&&ut.age)return an.includes(ut.age);if(rn==="gender"&&ut.gender)return an.includes(ut.gender);if(rn==="occupation"&&ut.occupation)return an.includes(ut.occupation);if(rn==="location"&&ut.location)return an.includes(ut.location);if(rn==="ethnicity"&&ut.ethnicity)return an.includes(ut.ethnicity)}return!0}));return M(hn)},Pe=Object.values(ne).every(et=>et.length===0),We=M(y),yt=(et,bt,hn,ut=1)=>{const An=ne[bt],an=[...new Set([...hn,...An])].sort();return an.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:et}),a.jsx("div",{className:`grid grid-cols-1 ${ut===2?"sm:grid-cols-2":ut===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:an.map(rn=>{const gr=ne[bt].includes(rn),H=hn.includes(rn);return a.jsxs("div",{className:`flex items-center space-x-2 ${!H&&!gr?"opacity-50":""}`,children:[a.jsx(Dl,{id:`${bt}-${rn}`,checked:gr,onCheckedChange:()=>Q(bt,rn),disabled:!H&&!gr}),a.jsxs(mo,{htmlFor:`${bt}-${rn}`,className:"truncate overflow-hidden",children:[rn,gr&&!H&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},rn)})})]})};return a.jsxs(a.Fragment,{children:[yt("Gender","gender",Pe?We.gender:q("gender").gender,3),yt("Age","age",Pe?We.age:q("age").age,3),yt("Ethnicity","ethnicity",Pe?We.ethnicity:q("ethnicity").ethnicity,2),yt("Location","location",Pe?We.location:q("location").location,2),yt("Occupation","occupation",Pe?We.occupation:q("occupation").occupation,2),yt("Tech Savviness","techSavviness",Pe?We.techSavviness:q("techSavviness").techSavviness,3),a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:"Folder Assignment"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Dl,{id:"folderStatus-hasFolder",checked:ne.folderStatus.includes("hasFolder"),onCheckedChange:()=>Q("folderStatus","hasFolder")}),a.jsx(mo,{htmlFor:"folderStatus-hasFolder",className:"truncate overflow-hidden",children:"Has folder assignment"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Dl,{id:"folderStatus-noFolder",checked:ne.folderStatus.includes("noFolder"),onCheckedChange:()=>Q("folderStatus","noFolder")}),a.jsx(mo,{htmlFor:"folderStatus-noFolder",className:"truncate overflow-hidden",children:"No folder assignment"})]})]})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()})]}),a.jsx("div",{className:"sticky bottom-0 bg-background border-t shadow-[0_-2px_4px_rgba(0,0,0,0.05)] pt-4 z-10",children:a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:V,children:"Reset"}),a.jsx(J,{onClick:U,children:"Apply Filters"})]})})]})}),a.jsx(Ql,{open:Le,onOpenChange:At,children:a.jsxs($c,{children:[a.jsxs(Lc,{children:[a.jsx(Bc,{children:"Select AI Model for Summary Generation"}),a.jsx(Xl,{children:"Choose which AI model to use for generating persona summaries"})]}),a.jsx("div",{className:"py-4",children:a.jsxs(IA,{value:lt,onValueChange:Jt,className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:"gemini-2.5-pro",id:"download-gemini"}),a.jsx(mo,{htmlFor:"download-gemini",className:"text-sm font-medium",children:"Gemini 2.5 Pro"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:"gpt-4.1",id:"download-gpt"}),a.jsx(mo,{htmlFor:"download-gpt",className:"text-sm font-medium",children:"GPT-4.1"})]})]})}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:()=>At(!1),children:"Cancel"}),a.jsx(J,{onClick:ot,children:"Generate Summary"})]})]})})]})]})}):a.jsxs(dl,{defaultValue:"ai",onValueChange:q=>c(q),children:[a.jsxs(Va,{className:"grid w-full grid-cols-2 mb-6",children:[a.jsx(gn,{value:"ai",children:"AI Recruiter"}),a.jsx(gn,{value:"manual",children:"Manual Creation"})]}),a.jsxs(vn,{value:"ai",children:[console.log(`Rendering AIRecruiter with targetFolderId: ${d!==tr?d:"null"}`),console.log("Current folders:",x.map(q=>({id:q.id,name:q.name}))),a.jsx(hce,{targetFolderId:d!==tr?d:null,targetFolderName:d!==tr?(oo=x.find(q=>q.id===d))==null?void 0:oo.name:null})]}),a.jsx(vn,{value:"manual",children:a.jsx(rle,{targetFolderId:d!==tr?d:null,targetFolderName:d!==tr?(ta=x.find(q=>q.id===d))==null?void 0:ta.name:null})})]})]})]})},cG=v.createContext(void 0),tC="synthetic-society-navigation-state",rde=({children:t})=>{const[e,n]=v.useState(()=>{try{const o=localStorage.getItem(tC);return o?JSON.parse(o):{}}catch{return{}}});v.useEffect(()=>{localStorage.setItem(tC,JSON.stringify(e))},[e]);const r=(o,s)=>{n({...e,previousRoute:o,...s})},i=()=>{n({}),localStorage.removeItem(tC)};return a.jsx(cG.Provider,{value:{navigationState:e,setNavigationState:n,clearNavigationState:i,setPreviousRoute:r},children:t})},ow=()=>{const t=v.useContext(cG);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t},ide=XT("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Sr({className:t,variant:e,...n}){return a.jsx("div",{className:Ne(ide({variant:e}),t),...n})}const GN=N.memo(t=>{const{discussionGuide:e,moderatorStatus:n,onSectionSelect:r,onSetPosition:i,onSave:o,showProgress:s=!0,collapsible:c=!0,defaultExpanded:l=!1,className:u,onDownload:d,isDownloading:f=!1,focusGroupId:h,onEditingChange:p}=t,g=typeof e=="string",m=v.useMemo(()=>g?null:e,[e,g]),[y,b]=v.useState(new Set),[x,w]=v.useState(null),[S,C]=v.useState(null),[_,A]=v.useState(!1),[j,P]=v.useState(null),[k,O]=v.useState("");v.useEffect(()=>{p&&p(!!x)},[x,p]),v.useEffect(()=>{if(x&&m){const T=m.sections.find(M=>M.id===x);T&&!S&&C({...T})}},[m,x,S]);const E=T=>{w(T.id),C({...T}),b(M=>new Set(M).add(T.id))},I=()=>{w(null),C(null)},D=v.useCallback(T=>{C(M=>M&&{...M,...T})},[]),z=v.useCallback((T,M,U)=>{C(V=>{if(!V)return V;const Q={...V};if(U==="question"&&Q.questions){if(Q.questions.findIndex(X=>X.id===T)!==-1)return Q.questions=Q.questions.map(X=>X.id===T?{...X,...M}:X),Q}else if(U==="activity"&&Q.activities&&Q.activities.findIndex(X=>X.id===T)!==-1)return Q.activities=Q.activities.map(X=>X.id===T?{...X,...M}:X),Q;return Q.subsections&&(Q.subsections=Q.subsections.map(B=>{const X={...B};return U==="question"&&X.questions?X.questions.findIndex(xe=>xe.id===T)!==-1&&(X.questions=X.questions.map(xe=>xe.id===T?{...xe,...M}:xe)):U==="activity"&&X.activities&&X.activities.findIndex(xe=>xe.id===T)!==-1&&(X.activities=X.activities.map(xe=>xe.id===T?{...xe,...M}:xe)),X})),Q})},[]),$=T=>{if(!S)return;const M={id:`${T}-${Date.now()}`,content:`New ${T}`,type:T==="question"?"open_ended":"discussion",time_limit:void 0},U={...S};T==="question"?U.questions=[...U.questions||[],M]:U.activities=[...U.activities||[],M],C(U)},G=(T,M)=>{if(!S||!S.subsections)return;const U={id:`${M}-${Date.now()}`,content:`New ${M}`,type:M==="question"?"open_ended":"discussion",time_limit:void 0},V=[...S.subsections],Q={...V[T]};M==="question"?Q.questions=[...Q.questions||[],U]:Q.activities=[...Q.activities||[],U],V[T]=Q,C(B=>B&&{...B,subsections:V})},R=()=>{if(!S)return;const T={id:`subsection-${Date.now()}`,title:"New Subsection",questions:[],activities:[]},M=[...S.subsections||[],T];C(U=>U&&{...U,subsections:M})},L=T=>{if(!S||!S.subsections)return;const M=S.subsections.filter((U,V)=>V!==T);C(U=>U&&{...U,subsections:M})},W=(T,M)=>{var V,Q;if(!S)return;const U={...S};M==="question"?U.questions=(V=U.questions)==null?void 0:V.filter(B=>B.id!==T):U.activities=(Q=U.activities)==null?void 0:Q.filter(B=>B.id!==T),C(U)},Y=async()=>{if(!(!S||!m||!o)){A(!0);try{const T={...m,sections:m.sections.map(M=>M.id===x?S:M)};await o(T),I(),re.success("Section updated successfully")}catch(T){console.error("Error saving section:",T),re.error("Failed to save section")}finally{A(!1)}}},te=T=>{b(M=>{const U=new Set(M);return U.has(T)?U.delete(T):U.add(T),U})};v.useEffect(()=>{m&&m.sections.length>0&&b(l?new Set(m.sections.map(T=>T.id)):new Set)},[l,m]);const me=(T,M,U,V)=>{if(!n||n.legacy_format)return null;const Q=n.moderator_position;if(Q.section_index!==T)return Q.section_index>T?"completed":null;if(V!==void 0){if(Q.subsection_index===void 0)return null;if(Q.subsection_index!==V)return Q.subsection_index>V?"completed":null}else if(Q.subsection_index!==void 0)return"completed";return Q.item_type!==U?U==="activity"&&Q.item_type==="question"?"completed":null:Q.item_index===M?"current":Q.item_index>M?"completed":null},F=(T,M)=>T===`New ${M}`,se=v.useCallback((T,M,U)=>{if(M<0||M>=T.length||U<0||U>=T.length)return T;const V=[...T],[Q]=V.splice(M,1);return V.splice(U,0,Q),V},[]),ne=v.useCallback((T,M)=>M>0,[]),ae=v.useCallback((T,M)=>M{if(!S||!S.subsections)return;const M=S.subsections;if(ne(M,T)){const U=se(M,T,T-1);C(V=>V&&{...V,subsections:U})}},[S,ne,se]),de=v.useCallback(T=>{if(!S||!S.subsections)return;const M=S.subsections;if(ae(M,T)){const U=se(M,T,T+1);C(V=>V&&{...V,subsections:U})}},[S,ae,se]),ye=v.useCallback((T,M)=>{P(T),O(M)},[]),Ee=v.useCallback(()=>{P(null),O("")},[]),Z=v.useCallback(()=>{if(!j||!S||!S.subsections)return;const T=S.subsections.map(M=>M.id===j?{...M,title:k.trim()}:M);C(M=>M&&{...M,subsections:T}),Ee()},[j,S,k,Ee]),ct=v.useCallback((T,M,U,V)=>{if(!S)return;const Q=M==="question"?"questions":"activities";if(V!==void 0){const B=S.subsections||[];if(V>=0&&Vbe&&{...be,subsections:Re})}}}else{const B=S[Q]||[];if(ne(B,U)){const X=se(B,U,U-1);C(ge=>ge&&{...ge,[Q]:X})}}},[S,ne,se]),Le=v.useCallback((T,M,U,V)=>{if(!S)return;const Q=M==="question"?"questions":"activities";if(V!==void 0){const B=S.subsections||[];if(V>=0&&Vbe&&{...be,subsections:Re})}}}else{const B=S[Q]||[];if(ae(B,U)){const X=se(B,U,U+1);C(ge=>ge&&{...ge,[Q]:X})}}},[S,ae,se]),At=(T,M,U,V,Q)=>{var kt,Ke,tt,Nt,sn,Nr,fn,St,Ze;const B=m==null?void 0:m.sections[M],X=x===(B==null?void 0:B.id),ge=me(M,U,V,Q),xe=ge==="current",Re=ge==="completed",Ve=(ot=>{const Xt=ot.match(/['"`]([^'"`]*fg-[^'"`]*\.(jpe?g|png|gif|webp))['"`]/i);return Xt?Xt[1]:null})(T.content),st=F(T.content,V);return X?a.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-white border-blue-200",children:[a.jsxs("div",{className:"flex-shrink-0 flex flex-col gap-1",children:[a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>ct(T.id,V,U,Q),disabled:(()=>{if(Q!==void 0){const Xt=((S==null?void 0:S.subsections)||[])[Q],wn=(Xt==null?void 0:Xt[V==="question"?"questions":"activities"])||[];return!ne(wn,U)}else{const ot=(S==null?void 0:S[V==="question"?"questions":"activities"])||[];return!ne(ot,U)}})(),className:"h-6 w-6 p-0",title:"Move item up",children:a.jsx(cu,{className:"h-3 w-3"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>Le(T.id,V,U,Q),disabled:(()=>{if(Q!==void 0){const Xt=((S==null?void 0:S.subsections)||[])[Q],wn=(Xt==null?void 0:Xt[V==="question"?"questions":"activities"])||[];return!ae(wn,U)}else{const ot=(S==null?void 0:S[V==="question"?"questions":"activities"])||[];return!ae(ot,U)}})(),className:"h-6 w-6 p-0",title:"Move item down",children:a.jsx(Ma,{className:"h-3 w-3"})})]}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Sr,{variant:"outline",className:"text-xs",children:V==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(pa,{className:"h-3 w-3 mr-1"}),typeof T.type=="string"?T.type.replace("_"," "):String(T.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(As,{className:"h-3 w-3 mr-1"}),typeof T.type=="string"?T.type.replace("_"," "):String(T.type||"unknown")]})}),T.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500",children:[a.jsx(Wp,{className:"h-3 w-3"}),a.jsx(Ht,{type:"number",value:T.time_limit,onChange:ot=>z(T.id,{time_limit:parseInt(ot.target.value)||void 0},V),className:"w-16 h-6 text-xs",placeholder:"min"}),"min"]})]}),a.jsx(mt,{value:st?"":T.content,onChange:ot=>z(T.id,{content:ot.target.value},V),placeholder:st?T.content:"Enter content...",className:"min-h-[60px]"}),V==="question"&&a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Probe Questions (one per line)"}),a.jsx(mt,{value:((kt=T.probes)==null?void 0:kt.join(` -`))||"",onChange:ot=>{const Xt=ot.target.value.trim()?ot.target.value.split(` -`).filter(wn=>wn.trim()):[];z(T.id,{probes:Xt},V)},placeholder:"Enter probe questions, one per line...",className:"min-h-[40px]"})]}),(((Ke=T.metadata)==null?void 0:Ke.image_url)||((tt=T.metadata)==null?void 0:tt.image_id)||Ve)&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Yv,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),(Nt=T.metadata)!=null&&Nt.image_url?a.jsx("img",{src:T.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(sn=T.metadata)!=null&&sn.image_id&&h?a.jsx("img",{src:Ot.getAssetUrl(h,T.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):Ve&&h?a.jsx("img",{src:Ot.getAssetUrl(h,Ve),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]}),a.jsx("div",{className:"flex-shrink-0",children:a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>W(T.id,V),className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:a.jsx(nr,{className:"h-3 w-3"})})})]},`edit-item-${T.id}`):a.jsxs("div",{className:Ne("flex items-start gap-3 p-3 rounded-lg border transition-colors",xe&&"bg-blue-50 border-blue-200",Re&&"bg-green-50 border-green-200",!xe&&!Re&&"bg-slate-50 border-slate-200",r&&"cursor-pointer hover:bg-slate-100"),onClick:()=>r==null?void 0:r(m.sections[M].id,T.id),children:[a.jsx("div",{className:"flex-shrink-0 mt-1",children:Re?a.jsx(IE,{className:"h-4 w-4 text-green-600"}):xe?a.jsx(u5,{className:"h-4 w-4 text-blue-600"}):a.jsx(RE,{className:"h-4 w-4 text-slate-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[a.jsx(Sr,{variant:"outline",className:"text-xs whitespace-nowrap",children:V==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(pa,{className:"h-3 w-3 mr-1"}),typeof T.type=="string"?T.type.replace("_"," "):String(T.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(As,{className:"h-3 w-3 mr-1"}),typeof T.type=="string"?T.type.replace("_"," "):String(T.type||"unknown")]})}),T.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500 whitespace-nowrap",children:[a.jsx(Wp,{className:"h-3 w-3"}),T.time_limit," min"]}),i&&a.jsxs(J,{size:"sm",variant:"ghost",onClick:ot=>{ot.stopPropagation();const Xt=m.sections[M],wn=V==="activity"?`Activity ${U+1}`:`Question ${U+1}`;i(Xt.id,T.id,T.content,Xt.title,wn,V)},className:"h-6 px-2 ml-auto",children:[a.jsx(Qv,{className:"h-3 w-3 mr-1"}),"Set Position"]})]}),a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:T.content}),T.probes&&T.probes.length>0&&a.jsxs("div",{className:"mt-2 pl-4 border-l-2 border-slate-200",children:[a.jsx("p",{className:"text-xs font-medium text-slate-600 mb-1",children:"Probe Questions:"}),a.jsx("ul",{className:"space-y-1",children:T.probes.map((ot,Xt)=>a.jsxs("li",{className:"text-xs text-slate-600",children:["• ",ot]},Xt))})]}),(((Nr=T.metadata)==null?void 0:Nr.image_url)||((fn=T.metadata)==null?void 0:fn.image_id)||Ve)&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Yv,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),(St=T.metadata)!=null&&St.image_url?a.jsx("img",{src:T.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(Ze=T.metadata)!=null&&Ze.image_id&&h?a.jsx("img",{src:Ot.getAssetUrl(h,T.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):Ve&&h?a.jsx("img",{src:Ot.getAssetUrl(h,Ve),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},T.id)},lt=(T,M)=>{var X,ge,xe,Re;const U=y.has(T.id),V=x===T.id,Q=V?S:T,B=(n==null?void 0:n.moderator_position.section_index)===M;return a.jsxs("div",{className:Ne("border rounded-lg overflow-hidden transition-colors",B&&"border-blue-500 shadow-md",!B&&"border-slate-200"),children:[a.jsxs("div",{className:Ne("px-4 py-3 flex items-center justify-between cursor-pointer hover:bg-slate-50 transition-colors",B&&"bg-blue-50"),onClick:()=>!V&&te(T.id),children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"transition-transform",style:{transform:U?"rotate(90deg)":"rotate(0deg)"},children:a.jsx(fo,{className:"h-5 w-5 text-slate-500"})}),a.jsx("h3",{className:"font-semibold text-slate-800",children:V?a.jsx(Ht,{value:Q.title,onChange:be=>D({title:be.target.value}),onClick:be=>be.stopPropagation(),className:"font-semibold"}):Q.title}),B&&a.jsx(Sr,{variant:"default",className:"text-xs",children:"Current"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[o&&!V&&a.jsx(J,{size:"sm",variant:"ghost",onClick:be=>{be.stopPropagation(),E(T)},className:"h-8 px-2",children:a.jsx(eI,{className:"h-3 w-3"})}),V&&a.jsxs("div",{className:"flex items-center gap-2",onClick:be=>be.stopPropagation(),children:[a.jsxs(J,{size:"sm",variant:"default",onClick:Y,disabled:_,className:"h-8",children:[_?a.jsx(Ds,{className:"h-3 w-3 animate-spin"}):a.jsx(DE,{className:"h-3 w-3"}),a.jsx("span",{className:"ml-1",children:"Save"})]}),a.jsxs(J,{size:"sm",variant:"ghost",onClick:I,disabled:_,className:"h-8",children:[a.jsx(Jo,{className:"h-3 w-3"}),a.jsx("span",{className:"ml-1",children:"Cancel"})]})]})]})]}),U&&a.jsxs("div",{className:"px-4 py-3 border-t border-slate-200 space-y-4",children:[Q.content&&a.jsx("div",{className:"prose prose-sm max-w-none",children:V?a.jsx(mt,{value:Q.content,onChange:be=>D({content:be.target.value}),placeholder:"Section introduction or context...",className:"min-h-[80px] w-full"}):a.jsx("p",{className:"text-slate-700",children:Q.content})}),Q.activities&&Q.activities.length>0||V?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(pa,{className:"h-4 w-4"}),"Activities"]}),V&&a.jsxs(J,{size:"sm",variant:"outline",onClick:()=>$("activity"),className:"h-7",children:[a.jsx(pa,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx("div",{className:"space-y-2",children:(X=Q.activities)==null?void 0:X.map((be,Ve)=>At(be,M,Ve,"activity"))})]}):null,Q.questions&&Q.questions.length>0||V?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(As,{className:"h-4 w-4"}),"Questions"]}),V&&a.jsxs(J,{size:"sm",variant:"outline",onClick:()=>$("question"),className:"h-7",children:[a.jsx(As,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx("div",{className:"space-y-2",children:(ge=Q.questions)==null?void 0:ge.map((be,Ve)=>At(be,M,Ve,"question"))})]}):null,V&&a.jsx("div",{className:"space-y-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(Qv,{className:"h-4 w-4"}),"Subsections"]}),a.jsxs(J,{size:"sm",variant:"outline",onClick:R,className:"h-7",children:[a.jsx(Qv,{className:"h-3 w-3 mr-1"}),"Add Subsection"]})]})}),Q.subsections&&Q.subsections.length>0&&a.jsx("div",{className:"space-y-3 ml-4",children:Q.subsections.map((be,Ve)=>{var st,kt;return a.jsxs("div",{className:"border-l-2 border-slate-200 pl-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[V&&a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>De(Ve),disabled:!ne(Q.subsections||[],Ve),className:"h-7 w-7 p-0",title:"Move subsection up",children:a.jsx(cu,{className:"h-4 w-4"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>de(Ve),disabled:!ae(Q.subsections||[],Ve),className:"h-7 w-7 p-0",title:"Move subsection down",children:a.jsx(Ma,{className:"h-4 w-4"})})]}),V&&j===be.id?a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx(Ht,{value:k,onChange:Ke=>O(Ke.target.value),className:"flex-1",onKeyDown:Ke=>{Ke.key==="Enter"?Z():Ke.key==="Escape"&&Ee()},autoFocus:!0}),a.jsx(J,{size:"sm",onClick:Z,children:a.jsx(Gs,{className:"h-3 w-3"})}),a.jsx(J,{size:"sm",variant:"outline",onClick:Ee,children:a.jsx(Jo,{className:"h-3 w-3"})})]}):a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx("h5",{className:Ne("font-medium text-slate-700",V&&"cursor-pointer hover:text-blue-600"),onClick:()=>V&&ye(be.id,be.title),children:be.title}),V&&a.jsxs(a.Fragment,{children:[a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>ye(be.id,be.title),className:"h-6 w-6 p-0 opacity-60 hover:opacity-100",children:a.jsx(eI,{className:"h-3 w-3"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>L(Ve),className:"h-6 w-6 p-0 opacity-60 hover:opacity-100 text-red-600 hover:text-red-700",title:"Delete subsection",children:a.jsx(nr,{className:"h-3 w-3"})})]})]})]}),be.questions&&be.questions.length>0||V?a.jsxs("div",{className:"space-y-2 mb-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h6",{className:"text-sm font-medium text-slate-600 flex items-center gap-1",children:[a.jsx(As,{className:"h-3 w-3"}),"Questions"]}),V&&a.jsxs(J,{size:"sm",variant:"outline",onClick:()=>G(Ve,"question"),className:"h-6",children:[a.jsx(As,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx("div",{className:"space-y-2",children:(st=be.questions)==null?void 0:st.map((Ke,tt)=>At(Ke,M,tt,"question",Ve))})]}):null,be.activities&&be.activities.length>0||V?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h6",{className:"text-sm font-medium text-slate-600 flex items-center gap-1",children:[a.jsx(pa,{className:"h-3 w-3"}),"Activities"]}),V&&a.jsxs(J,{size:"sm",variant:"outline",onClick:()=>G(Ve,"activity"),className:"h-6",children:[a.jsx(pa,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx("div",{className:"space-y-2",children:(kt=be.activities)==null?void 0:kt.map((Ke,tt)=>At(Ke,M,tt,"activity",Ve))})]}):null]},be.id)})}),(((xe=T.metadata)==null?void 0:xe.image_url)||((Re=T.metadata)==null?void 0:Re.image_id))&&a.jsxs("div",{className:"mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Yv,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),T.metadata.image_url?a.jsx("img",{src:T.metadata.image_url,alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):T.metadata.image_id&&h?a.jsx("img",{src:Ot.getAssetUrl(h,T.metadata.image_id),alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},T.id)};if(g)return a.jsxs("div",{className:Ne("space-y-4",u),children:[s&&n&&a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-600 mb-2",children:[a.jsx("span",{children:"Progress"}),a.jsxs("span",{children:[Math.round(n.progress),"%"]})]}),a.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all",style:{width:`${n.progress}%`}})})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h2",{className:"text-xl font-semibold text-slate-800",children:"Discussion Guide"}),d&&a.jsxs(J,{size:"sm",variant:"outline",onClick:d,disabled:f,children:[f?a.jsx(Ds,{className:"h-4 w-4 animate-spin mr-2"}):a.jsx(lu,{className:"h-4 w-4 mr-2"}),"Download"]})]}),a.jsx("div",{className:"prose prose-sm max-w-none",children:a.jsx("pre",{className:"whitespace-pre-wrap text-sm text-slate-700 font-sans",children:e})}),n&&a.jsxs("div",{className:"mt-6 p-4 bg-blue-50 rounded-lg border border-blue-200",children:[a.jsx("h3",{className:"font-medium text-blue-900 mb-2",children:"Current Position"}),a.jsx("p",{className:"text-sm text-blue-800",children:n.current_section}),n.current_item&&a.jsx("p",{className:"text-sm text-blue-700 mt-1",children:n.current_item})]})]})]});if(!m)return a.jsx("div",{className:Ne("bg-slate-50 rounded-lg p-8 text-center",u),children:a.jsx("p",{className:"text-slate-600",children:"No discussion guide available"})});const Jt=a.jsxs("div",{className:"space-y-4",children:[s&&n&&a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-600 mb-2",children:[a.jsx("span",{children:"Overall Progress"}),a.jsxs("span",{children:[Math.round(n.progress),"%"]})]}),a.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all",style:{width:`${n.progress}%`}})}),a.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-500 mt-2",children:[a.jsxs("span",{children:["Section ",n.moderator_position.section_index+1," of ",n.total_sections]}),a.jsxs("span",{children:[Math.round(n.section_progress),"% of current section"]})]})]}),a.jsx("div",{className:"space-y-3",children:m.sections.map((T,M)=>lt(T,M))})]});return c?a.jsxs(_g,{defaultOpen:l,className:u,children:[a.jsx(Ag,{asChild:!0,children:a.jsxs("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-slate-200 cursor-pointer hover:bg-slate-50 transition-colors",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(fo,{className:"h-5 w-5 text-slate-500 transition-transform data-[state=open]:rotate-90"}),a.jsx("h2",{className:"text-lg font-semibold text-slate-800",children:m.title||"Discussion Guide"}),a.jsxs(Sr,{variant:"outline",className:"text-xs",children:[m.total_duration," min"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[n&&a.jsxs(Sr,{variant:n.progress===100?"success":"default",className:"text-xs",children:[Math.round(n.progress),"% Complete"]}),d&&a.jsx(J,{size:"sm",variant:"outline",onClick:T=>{T.stopPropagation(),d()},disabled:f,children:f?a.jsx(Ds,{className:"h-4 w-4 animate-spin"}):a.jsx(lu,{className:"h-4 w-4"})})]})]})}),a.jsx(jg,{className:"mt-4",children:Jt})]}):a.jsx("div",{className:u,children:Jt})});GN.displayName="DiscussionGuideViewer";const vl="all",ode=Oe.object({researchBrief:Oe.string().min(10,{message:"Research brief must be at least 10 characters."}),focusGroupName:Oe.string().min(3,{message:"Focus group name must be at least 3 characters."}),discussionTopics:Oe.string().min(10,{message:"Discussion topics are required."}),creativeAssets:Oe.instanceof(FileList).optional(),duration:Oe.string().min(1,{message:"Duration is required."}),llm_model:Oe.string().optional(),reasoning_effort:Oe.string().optional(),verbosity:Oe.string().optional()});function sde({draftToEdit:t,onDraftSaved:e,preSelectedParticipants:n=[]}={}){console.log("FocusGroupModerator component rendering, draftToEdit:",t);const r=ar();Fi();const{setPreviousRoute:i,navigationState:o,clearNavigationState:s}=ow(),[c,l]=v.useState("setup"),[u,d]=v.useState(!1),[f,h]=v.useState(!1),[p,g]=v.useState(!1),[m,y]=v.useState(null),[b,x]=v.useState(null),[w,S]=v.useState(!1),C=v.useRef(m);C.current=m;const _=v.useRef(!1),A=H=>H&&typeof H=="object"&&H.title&&H.sections,[j,P]=v.useState([]),[k,O]=v.useState([]),[E,I]=v.useState([]),[D,z]=v.useState(!1),[$,G]=v.useState(!1),[R,L]=v.useState([]),[W,Y]=v.useState(vl),[te,me]=v.useState(!1),[F,se]=v.useState(""),[ne,ae]=v.useState(null),[De,de]=v.useState(""),[ye,Ee]=v.useState(""),[Z,ct]=v.useState(!1),[Le,At]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[lt,Jt]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[T,M]=v.useState("idle"),[U,V]=v.useState(null),[Q,B]=v.useState(0),X=v.useRef(null),ge=v.useRef(!1),xe=v.useRef(!1),Re=H=>{i("/focus-groups",{focusGroupId:b,focusGroupTab:"participants",isNewFocusGroup:!t,focusGroupData:{name:Ze.getValues("name"),description:Ze.getValues("description"),selectedParticipants:j,discussionGuide:m}}),r(`/synthetic-users/${H.id}`)},be=H=>{const he={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return H.forEach(ue=>{if(ue.age&&he.age.add(ue.age),ue.gender&&he.gender.add(ue.gender),ue.occupation&&he.occupation.add(ue.occupation),ue.location&&he.location.add(ue.location),ue.techSavviness!==void 0){const je=ue.techSavviness<30?"Low (0-30)":ue.techSavviness<70?"Medium (31-70)":"High (71-100)";he.techSavviness.add(je)}ue.ethnicity&&he.ethnicity.add(ue.ethnicity)}),{age:Array.from(he.age).sort(),gender:Array.from(he.gender).sort(),occupation:Array.from(he.occupation).sort(),location:Array.from(he.location).sort(),techSavviness:Array.from(he.techSavviness).sort((ue,je)=>{const Be=["Low (0-30)","Medium (31-70)","High (71-100)"];return Be.indexOf(ue)-Be.indexOf(je)}),ethnicity:Array.from(he.ethnicity).sort()}},Ve=H=>{const he={...lt};he[H]=[];const ue=E.filter(je=>{let Be=!0;return W!==vl&&(Be=!1,je.folder_ids&&Array.isArray(je.folder_ids)&&(Be=je.folder_ids.includes(W)),!Be&&(je.folder_id===W||je.folderId===W)&&(Be=!0)),Be?Object.entries(he).every(([zt,er])=>{if(er.length===0)return!0;const so=zt;if(so==="techSavviness"&&je.techSavviness!==void 0){const Mu=je.techSavviness<30?"Low (0-30)":je.techSavviness<70?"Medium (31-70)":"High (71-100)";return er.includes(Mu)}else{if(so==="age"&&je.age)return er.includes(je.age);if(so==="gender"&&je.gender)return er.includes(je.gender);if(so==="occupation"&&je.occupation)return er.includes(je.occupation);if(so==="location"&&je.location)return er.includes(je.location);if(so==="ethnicity"&&je.ethnicity)return er.includes(je.ethnicity)}return!0}):!1});return be(ue)},st=()=>{ct(!1),setTimeout(()=>{At({...lt})},0)},kt=()=>{Jt({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]})},Ke=(H,he)=>{Jt(ue=>{const je={...ue};return je[H].includes(he)?je[H]=je[H].filter(Be=>Be!==he):je[H]=[...je[H],he],je})},tt=async()=>{try{const ue=(await js.getAll()).data.map(je=>({...je,id:je._id}));return L(ue),ue}catch(H){return console.error("Error fetching folders:",H),re.error("Failed to load folders"),L([]),[]}},Nt=async()=>{if(!F.trim()){re.error("Please enter a folder name");return}try{const H=await js.create({name:F.trim()});await tt(),se(""),me(!1),re.success(`Folder "${F}" created`)}catch(H){console.error("Error creating folder:",H),re.error("Failed to create folder")}},sn=()=>{se(""),me(!1)},Nr=H=>{ae(H),de(H.name)},fn=async()=>{if(!ne||!De.trim()){ae(null);return}try{await js.update(ne._id,{name:De.trim()}),await tt(),ae(null),re.success(`Folder renamed to "${De}"`)}catch(H){console.error("Error renaming folder:",H),re.error("Failed to rename folder"),ae(null)}},St=()=>{ae(null),de("")};v.useEffect(()=>{const H=async()=>{z(!0);try{const ue=await zr.getAll();console.log("Fetched personas for FocusGroupModerator:",ue.data),Array.isArray(ue.data)&&ue.data.length>0?I(ue.data):(console.warn("No personas returned from API or invalid format",ue.data),re.warning("No participants available"))}catch(ue){console.error("Error fetching personas:",ue),re.error("Failed to load participants")}finally{z(!1)}};(async()=>{await Promise.all([tt(),H()])})()},[]),console.log("About to initialize form with useForm hook");const Ze=z0({resolver:G0(ode),defaultValues:{researchBrief:"",focusGroupName:"",discussionTopics:"",duration:"60",llm_model:"gemini-2.5-pro",reasoning_effort:"medium",verbosity:"medium"}});console.log("Form initialized successfully");const ot=()=>{c!=="setup"||xe.current||(X.current&&clearTimeout(X.current),X.current=setTimeout(async()=>{if(ge.current)return;const H=Ze.getValues(),he={name:H.focusGroupName||"",description:H.researchBrief||"",objective:H.researchBrief||"",topic:H.discussionTopics||"",duration:H.duration?parseInt(H.duration):60,llm_model:H.llm_model||"gemini-2.5-pro",reasoning_effort:H.reasoning_effort||"medium",verbosity:H.verbosity||"medium",participants:j,participants_count:j.length,status:"draft",date:new Date().toISOString(),uploadedAssets:k.map(ue=>ue.name)};if(!(U&&JSON.stringify(he)===JSON.stringify(U))&&!(!he.name&&!he.description&&!he.topic)){ge.current=!0,M("saving");try{let ue=b||(t==null?void 0:t.id)||(t==null?void 0:t._id);if(console.log("Auto-save: draftFocusGroupId =",b),console.log("Auto-save: draftToEdit ID =",(t==null?void 0:t.id)||(t==null?void 0:t._id)),console.log("Auto-save: using focusGroupId =",ue),console.log("Auto-save: llm_model in currentData =",he.llm_model),console.log("Auto-save: duration in currentData =",he.duration),ue)console.log("Auto-save: Updating existing focus group:",ue),await Ot.update(ue,he),console.log("Auto-save: Updated existing draft:",ue);else{console.log("Auto-save: Creating NEW focus group (no existing ID)");const je=await Ot.create(he);ue=je.data.focus_group_id||je.data.id||je.data._id,x(ue),console.log("Auto-save: Created new draft with ID:",ue)}V(he),M("saved"),B(0),setTimeout(()=>{M("idle")},2e3)}catch(ue){if(console.error("Auto-save failed:",ue),M("error"),B(je=>je+1),Q<3){const je=Math.pow(2,Q)*2e3;setTimeout(()=>{ot()},je)}else re.error("Auto-save failed",{description:"Your changes may not be saved. Please check your connection."})}finally{ge.current=!1}}},2e3))},Xt=Ze.watch(),wn=v.useRef(""),oo=v.useRef(""),ta=v.useRef("");v.useEffect(()=>{const H=JSON.stringify(Xt);c==="setup"&&H!==wn.current&&(wn.current=H,ot())},[Xt,c]),v.useEffect(()=>{const H=JSON.stringify(j);c==="setup"&&H!==oo.current&&(oo.current=H,ot())},[j,c]),v.useEffect(()=>{const H=JSON.stringify(k.map(he=>he.name));c==="setup"&&H!==ta.current&&(ta.current=H,ot())},[k,c]),v.useEffect(()=>(c!=="setup"&&X.current&&clearTimeout(X.current),()=>{X.current&&clearTimeout(X.current)}),[c]),v.useEffect(()=>{if(console.log("Draft loading effect - draftToEdit:",t,"draftLoadedRef.current:",_.current),!t){_.current=!1;return}if(t&&!_.current){console.log("Loading draft focus group:",t),xe.current=!0,_.current=!0;const H=t.id||t._id;x(H),console.log("Setting draft ID from draftToEdit:",H),t.name&&Ze.setValue("focusGroupName",t.name),(t.description||t.objective)&&Ze.setValue("researchBrief",t.description||t.objective||""),t.topic&&Ze.setValue("discussionTopics",t.topic),t.duration&&Ze.setValue("duration",t.duration.toString()),t.llm_model&&Ze.setValue("llm_model",t.llm_model),t.reasoning_effort&&Ze.setValue("reasoning_effort",t.reasoning_effort),t.verbosity&&Ze.setValue("verbosity",t.verbosity),t.discussionGuide&&(y(t.discussionGuide),(!o.focusGroupTab||o.previousRoute!=="/focus-groups")&&l("review")),t.participants&&Array.isArray(t.participants)&&P(t.participants);const he={name:t.name||"",description:t.description||t.objective||"",objective:t.description||t.objective||"",topic:t.topic||"",duration:t.duration||60,llm_model:t.llm_model||"gemini-2.5-pro",reasoning_effort:t.reasoning_effort||"medium",verbosity:t.verbosity||"medium",participants:t.participants||[],participants_count:(t.participants||[]).length,status:"draft",date:t.date||new Date().toISOString(),uploadedAssets:[]};V(he),console.log("Set lastSavedData to current draft:",he),re.success("Draft focus group loaded",{description:"Continue editing your focus group setup"}),setTimeout(()=>{xe.current=!1;const ue=JSON.stringify(Ze.getValues());wn.current=ue},1e3)}},[t,Ze]),v.useEffect(()=>{n.length>0&&(console.log("Pre-selected participants received:",n),P(n),l("participants"))},[n]),v.useEffect(()=>{o.focusGroupTab&&o.previousRoute==="/focus-groups"&&setTimeout(()=>{l(o.focusGroupTab),s()},0)},[o.focusGroupTab,t,s]),v.useEffect(()=>{t||setTimeout(()=>{xe.current=!1;const H=JSON.stringify(Ze.getValues());wn.current=H},500)},[t,Ze]);const q=()=>{if(T==="idle")return null;const he={saving:{text:"Saving...",className:"text-blue-600 bg-blue-50"},saved:{text:"All changes saved",className:"text-green-600 bg-green-50"},error:{text:"Save failed - retrying...",className:"text-red-600 bg-red-50"}}[T];return a.jsx("div",{className:`fixed top-16 left-1/2 transform -translate-x-1/2 z-50 px-3 py-1 rounded-md text-sm font-medium border shadow-sm ${he.className}`,children:he.text})},Pe=async(H,he)=>{var ue,je;d(!0),h(!1),g(!1);try{const Be={name:H.focusGroupName,description:H.researchBrief,objective:H.researchBrief,topic:H.discussionTopics,duration:parseInt(H.duration),llm_model:H.llm_model,reasoning_effort:H.reasoning_effort,verbosity:H.verbosity},zt=he?await Ot.generateDiscussionGuideForGroup(he,Be):await Ot.generateDiscussionGuide(Be);if(zt.data&&zt.data.discussionGuide)return h(!0),zt.data.discussionGuide;throw new Error("Failed to generate discussion guide")}catch(Be){console.error("Error generating discussion guide:",Be),g(!0);let zt="Unknown error occurred";throw(je=(ue=Be==null?void 0:Be.response)==null?void 0:ue.data)!=null&&je.error?zt=Be.response.data.error:Be!=null&&Be.message&&(zt=Be.message),zt.includes("500")||zt.includes("internal error")||zt.includes("Internal Server Error")?re.error("AI service temporarily unavailable",{description:"The discussion guide generator is experiencing issues. Please try again in a few minutes.",action:{label:"Retry",onClick:()=>Pe(H)}}):re.error("Failed to generate discussion guide",{description:zt,action:{label:"Retry",onClick:()=>Pe(H)}}),Be}},We=()=>{d(!1),h(!1),g(!1)};async function yt(H){var he;try{let ue=b;if(!ue){const je={name:H.focusGroupName,status:"draft",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(H.duration),topic:H.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:H.researchBrief,objective:H.researchBrief,llm_model:H.llm_model,reasoning_effort:H.reasoning_effort,verbosity:H.verbosity},Be=await Ot.create(je);ue=Be.data.focus_group_id||Be.data.id||Be.data._id,x(ue),console.log("Draft focus group created for asset upload:",Be,"with ID:",ue)}if(H.creativeAssets&&H.creativeAssets.length>0&&ue)try{const je=new FormData;Array.from(H.creativeAssets).forEach(so=>{je.append("assets",so)});const zt=(await Ot.uploadAssets(ue,je,!0)).data;console.log("Assets uploaded successfully:",zt),re.success(`${zt.uploaded_assets} asset(s) uploaded successfully`,{description:"Assets will be included in the discussion guide"});const er=Array.from(H.creativeAssets);O(er)}catch(je){console.error("Asset upload failed:",je);const Be=(he=je.response)==null?void 0:he.data;let zt="Asset upload failed",er="Some assets could not be uploaded";(Be==null?void 0:Be.code)==="TEMP_DIR_ERROR"?(zt="Upload temporarily unavailable",er="Server storage issue. Please try again in a moment."):(Be==null?void 0:Be.code)==="UPLOAD_SYSTEM_FAILURE"?(zt="Upload system unavailable",er="Critical server issue. Please contact support."):Be!=null&&Be.can_retry&&(zt="Upload failed - can retry",er=(Be==null?void 0:Be.details)||"Please try uploading again."),re.error(zt,{description:er}),console.log("Continuing without assets due to upload failure")}if(ue)try{const je={name:H.focusGroupName,participants:j,participants_count:j.length,duration:parseInt(H.duration),topic:H.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:H.researchBrief,objective:H.researchBrief,llm_model:H.llm_model,reasoning_effort:H.reasoning_effort,verbosity:H.verbosity};await Ot.update(ue,je),console.log("Focus group updated with latest form values before guide generation"),console.log(`šŸ”„ Updated focus group ${ue} with model: ${H.llm_model}`)}catch(je){console.error("Failed to update focus group before guide generation:",je)}try{const je=await Pe(H,ue);y(je);try{const Be={name:H.focusGroupName,status:"draft",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(H.duration),topic:H.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:H.researchBrief,objective:H.researchBrief,llm_model:H.llm_model,reasoning_effort:H.reasoning_effort,verbosity:H.verbosity,discussionGuide:je};await Ot.update(ue,Be),console.log("Focus group updated with discussion guide"),re.success("Progress saved as draft",{description:"Your focus group setup has been automatically saved"})}catch(Be){console.error("Failed to update focus group with discussion guide:",Be),re.error("Failed to save draft",{description:"Discussion guide generated, but draft save failed"})}l("review"),re.success("Discussion guide generated",{description:"Review and edit before proceeding"})}catch(je){console.error("Discussion guide generation failed:",je),re.error("Discussion guide generation failed",{description:"Please go back to the setup tab and try generating again. Check your inputs and try a different AI model if the issue persists.",duration:8e3});return}}catch(ue){console.error("Error in focus group creation flow:",ue),re.error("Focus group creation failed",{description:ue.message||"An unexpected error occurred"})}}const et=(()=>{var he;const H=E.filter(ue=>{const je=ue.name.toLowerCase().includes(ye.toLowerCase())||ue.occupation&&ue.occupation.toLowerCase().includes(ye.toLowerCase())||ue.location&&ue.location.toLowerCase().includes(ye.toLowerCase()),Be=(Le.age.length===0||Le.age.includes(ue.age))&&(Le.gender.length===0||Le.gender.includes(ue.gender))&&(Le.occupation.length===0||Le.occupation.includes(ue.occupation))&&(Le.location.length===0||Le.location.includes(ue.location))&&(Le.ethnicity.length===0||ue.ethnicity&&Le.ethnicity.includes(ue.ethnicity))&&(Le.techSavviness.length===0||ue.techSavviness!==void 0&&Le.techSavviness.includes(ue.techSavviness<30?"Low (0-30)":ue.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&!0;let zt=!0;return W!==vl&&(zt=!1,ue.folder_ids&&Array.isArray(ue.folder_ids)&&(zt=ue.folder_ids.includes(W)),zt||(ue.folder_id===W||ue.folderId===W)&&(zt=!0)),je&&Be&&zt});if(console.log(`Filtered personas: ${H.length}/${E.length}`),console.log(`Selected folder: ${W===vl?"All Personas":((he=R.find(ue=>ue._id===W||ue.id===W))==null?void 0:he.name)||W}`),W!==vl){const ue=R.find(je=>je._id===W||je.id===W);if(ue){const je=E.filter(Be=>Be.folder_ids&&Array.isArray(Be.folder_ids)?Be.folder_ids.includes(W):Be.folder_id===W||Be.folderId===W);console.log(`Folder details: ${ue.name}, ID: ${ue._id}, Contains: ${je.length} personas`),console.log("Personas in this folder:",je.map(Be=>Be.name))}}return H})(),bt=H=>{console.log("Toggling selection for participant ID:",H),P(he=>{const ue=he.includes(H);console.log("Current selection:",{id:H,isCurrentlySelected:ue,currentSelections:[...he]});const je=ue?he.filter(Be=>Be!==H):[...he,H];return console.log("New selection:",je),je})},hn=async()=>{try{const H=Ze.getValues(),he={name:H.focusGroupName,status:"in-progress",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(H.duration),topic:H.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),discussionGuide:m},je=(await Ot.create(he)).data;return console.log("Focus group created successfully:",je),je.focus_group_id}catch(H){throw console.error("Error saving focus group:",H),H}},ut=v.useCallback(async()=>{if(!C.current){re.error("No discussion guide available",{description:"Please generate a discussion guide first"});return}G(!0);try{const{downloadDiscussionGuideAsMarkdown:H}=await zie(async()=>{const{downloadDiscussionGuideAsMarkdown:ue}=await import("./discussionGuideMarkdown-eMXneipz.js");return{downloadDiscussionGuideAsMarkdown:ue}},[]),he=Ze.getValues();H(C.current,he.focusGroupName),re.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(H){console.error("Error downloading discussion guide:",H),re.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{G(!1)}},[Ze]),An=v.useCallback(async H=>{console.log("šŸ“ handleSaveDiscussionGuide called with:",H),w?(C.current=H,console.log("šŸ“ Skipping discussionGuide state update during editing to preserve focus")):(y(H),re.success("Discussion guide updated",{description:"Your changes have been saved."}))},[w]),an=v.useCallback(H=>{console.log("šŸ“ Discussion guide editing state changed:",H),S(H),!H&&C.current&&(console.log("šŸ“ Updating discussionGuide state after editing ended"),y(C.current))},[]),rn=v.useCallback(()=>{},[]),gr=async()=>{if(!Ze.getValues().focusGroupName){re.error("Missing focus group name",{description:"Please provide a name for the focus group"});return}if(!m){re.error("Missing discussion guide",{description:"Please generate a discussion guide first"});return}if(j.length<1){re.error("Not enough participants",{description:"Please select at least one participant for the focus group"});return}console.log("Starting focus group with participants:",j);try{re.loading("Creating focus group...");let H;if(b){const he=Ze.getValues(),ue={name:he.focusGroupName,status:"in-progress",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(he.duration),topic:he.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:he.researchBrief,objective:he.researchBrief,discussionGuide:m},je=await Ot.update(b,ue);H=b,console.log("Draft focus group updated to in-progress:",je),e&&e()}else H=await hn();re.dismiss(),re.success("Focus group created successfully",{description:"The AI moderator is now running the session"}),r(`/focus-groups/${H}`)}catch(H){re.dismiss(),H!=null&&H.message,console.error("Failed to start focus group:",H),re.error("Failed to create focus group",{description:"Please try again or check your connection"})}};return a.jsxs(a.Fragment,{children:[a.jsx(q,{}),a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[a.jsx(Vs,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Focus Group Moderator"})]}),u&&a.jsx("div",{className:"mb-6",children:a.jsx(zN,{isActive:u,isComplete:f,hasError:p,label:"Generating discussion guide",onComplete:We})}),a.jsxs(dl,{value:c,onValueChange:l,children:[a.jsxs(Va,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(gn,{value:"setup",children:"Setup"}),a.jsx(gn,{value:"review",children:"Review & Edit"}),a.jsx(gn,{value:"participants",children:"Participants"})]}),a.jsx(vn,{value:"setup",children:a.jsx(K0,{...Ze,children:a.jsxs("form",{onSubmit:Ze.handleSubmit(yt),className:"space-y-6",children:[a.jsx(vt,{control:Ze.control,name:"focusGroupName",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Focus Group Name"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"e.g., Mobile App UX Evaluation",...H})}),a.jsx(Nn,{children:"Give your focus group a descriptive name"}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(vt,{control:Ze.control,name:"researchBrief",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Research Brief"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Describe your research objectives...",className:"h-36",...H})}),a.jsx(Nn,{children:"Provide context about what you want to learn"}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(vt,{control:Ze.control,name:"discussionTopics",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Discussion Topics"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"List main topics to cover, separated by commas",className:"h-24",...H})}),a.jsx(Nn,{children:"E.g., User experience, feature preferences, pain points"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:Ze.control,name:"duration",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Duration (minutes)"}),a.jsxs(Un,{onValueChange:H.onChange,value:H.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select duration"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"30",children:"30 minutes"}),a.jsx(oe,{value:"45",children:"45 minutes"}),a.jsx(oe,{value:"60",children:"60 minutes"}),a.jsx(oe,{value:"90",children:"90 minutes"}),a.jsx(oe,{value:"120",children:"120 minutes"})]})]}),a.jsx(Nn,{children:"How long should the focus group session last?"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:Ze.control,name:"llm_model",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"AI Model"}),a.jsxs(Un,{onValueChange:H.onChange,value:H.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select AI model"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(oe,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(oe,{value:"gpt-5",children:"GPT-5"})]})]}),a.jsx(Nn,{children:"Choose which AI model to use for generating responses and discussion guides"}),a.jsx(pt,{})]})}),Ze.watch("llm_model")==="gpt-5"&&a.jsxs(a.Fragment,{children:[a.jsx(vt,{control:Ze.control,name:"reasoning_effort",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Reasoning Effort"}),a.jsxs(Un,{onValueChange:H.onChange,value:H.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select reasoning effort"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"minimal",children:"Minimal - Fast responses"}),a.jsx(oe,{value:"low",children:"Low - Quick thinking"}),a.jsx(oe,{value:"medium",children:"Medium - Balanced (default)"}),a.jsx(oe,{value:"high",children:"High - Deep reasoning"})]})]}),a.jsx(Nn,{children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx("div",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:Ze.control,name:"verbosity",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Response Verbosity"}),a.jsxs(Un,{onValueChange:H.onChange,value:H.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select verbosity level"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"low",children:"Low - Concise responses"}),a.jsx(oe,{value:"medium",children:"Medium - Balanced length (default)"}),a.jsx(oe,{value:"high",children:"High - Detailed responses"})]})]}),a.jsx(Nn,{children:"Controls how detailed and lengthy GPT-5's responses will be"}),a.jsx("div",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx(pt,{})]})})]})]})]}),a.jsx(vt,{control:Ze.control,name:"creativeAssets",render:({field:{value:H,onChange:he,...ue}})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Creative Assets (Optional)"}),a.jsx(ht,{children:a.jsxs("div",{className:"border-2 border-dashed border-slate-200 rounded-lg p-6 flex flex-col items-center justify-center bg-slate-50 hover:bg-slate-100 transition cursor-pointer",children:[a.jsx(d5,{className:"h-10 w-10 text-slate-400 mb-2"}),a.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Upload creative assets for testing"}),a.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Images, mockups, or product designs"}),a.jsx(Ht,{...ue,type:"file",accept:"image/*,.pdf",multiple:!0,onChange:je=>{he(je.target.files)},className:"hidden",id:"assets-file-input"}),a.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:()=>{var je;return(je=document.getElementById("assets-file-input"))==null?void 0:je.click()},children:[a.jsx(h5,{className:"mr-2 h-4 w-4"}),"Select Files"]}),H&&H.length>0&&a.jsxs("p",{className:"text-xs text-primary mt-2",children:[H.length," file(s) selected"]})]})}),a.jsx(Nn,{children:"Upload visuals that you want feedback on during the session"}),a.jsx(pt,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx("div",{className:"flex justify-end",children:a.jsxs(J,{type:"submit",disabled:u,className:"min-w-32",children:[a.jsx(Vs,{className:"mr-2 h-4 w-4"}),u?"Generating...":"Generate Discussion Guide"]})})})]})})}),a.jsx(vn,{value:"review",children:a.jsxs("div",{className:"space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("div",{className:"flex items-center justify-between mb-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"AI-Generated Discussion Guide"}),m&&a.jsx(Sr,{variant:"outline",className:"text-xs",children:A(m)?"Structured JSON":"Legacy Text"})]})}),a.jsx("div",{className:"prose max-w-none",children:m?a.jsx(GN,{discussionGuide:m,showProgress:!1,collapsible:!0,defaultExpanded:!0,className:"border-0",onSave:An,onDownload:ut,onSectionSelect:rn,isDownloading:$,focusGroupId:b,onEditingChange:an}):a.jsx("div",{className:"bg-slate-50 p-4 rounded border text-center text-slate-600",children:p?a.jsxs("div",{children:[a.jsx("p",{className:"mb-2",children:"Discussion guide generation failed."}),a.jsxs("p",{className:"text-sm",children:["Go back to the ",a.jsx("strong",{children:"Setup"})," tab and try generating again. Check your inputs and try a different AI model if the issue persists."]})]}):a.jsx("p",{children:'No discussion guide generated yet. Complete the setup and click "Generate Discussion Guide" to create one.'})})})]})}),k.length>0&&a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Uploaded Creative Assets"}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4",children:k.map((H,he)=>a.jsxs("div",{className:"border rounded-md p-2",children:[a.jsx("div",{className:"aspect-square bg-slate-100 rounded flex items-center justify-center mb-2",children:H.type.startsWith("image/")?a.jsx("img",{src:URL.createObjectURL(H),alt:`Asset ${he+1}`,className:"max-h-full max-w-full object-contain"}):a.jsx(H_,{className:"h-10 w-10 text-slate-400"})}),a.jsx("p",{className:"text-xs truncate",children:H.name})]},he))})]})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(J,{variant:"outline",onClick:()=>l("setup"),children:"Back to Setup"}),a.jsxs(J,{onClick:()=>l("participants"),children:["Select Participants",a.jsx(Dr,{className:"ml-2 h-4 w-4"})]})]})]})}),a.jsxs(vn,{value:"participants",children:[a.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[a.jsxs("div",{className:"w-full md:w-64 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium",children:"Folders"}),a.jsx(J,{variant:"ghost",size:"sm",onClick:()=>{console.log("Clicked 'Create new folder' button"),me(!0)},className:"h-7 w-7 p-0",children:a.jsx(f5,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>{console.log("Clicked 'All Personas' folder"),console.log("All personas count:",E.length),Y(vl),setTimeout(()=>{console.log(`Will show all ${E.length} personas`)},0)},className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${W===vl?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),R.map(H=>a.jsx("div",{className:"flex items-center justify-between group",children:ne&&ne._id===H._id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx(Ht,{value:De,onChange:he=>de(he.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:he=>{he.key==="Enter"?fn():he.key==="Escape"&&St()}}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming folder rename: "${ne==null?void 0:ne.name}" to "${De}"`),fn()},className:"h-7 w-7 p-0",children:a.jsx(Gs,{className:"h-4 w-4"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Cancelling rename of folder: "${ne==null?void 0:ne.name}"`),St()},className:"h-7 w-7 p-0",children:a.jsx(Jo,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>{console.log(`Clicked folder: ${H.name} (ID: ${H._id})`);const he=E.filter(ue=>ue.folder_ids&&Array.isArray(ue.folder_ids)?ue.folder_ids.includes(H._id):ue.folder_id===H._id||ue.folderId===H._id);console.log(`Current persona count in folder: ${he.length}`),console.log("All personas count:",E.length),Y(H._id),setTimeout(()=>{console.log(`Will show ${he.length} personas after filtering`),console.log("Filtered personas:",he.map(ue=>ue.name))},0)},className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${W===H._id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:H.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:E.filter(he=>he.folder_ids&&Array.isArray(he.folder_ids)?he.folder_ids.includes(H._id):he.folder_id===H._id||he.folderId===H._id).length})]}),a.jsxs(PA,{children:[a.jsx(kA,{asChild:!0,children:a.jsx(J,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(U_,{className:"h-4 w-4"})})}),a.jsx(Ox,{align:"end",children:a.jsx(oc,{onClick:()=>{console.log(`Initiating rename for folder: ${H.name} (ID: ${H.id})`),Nr(H)},children:"Rename"})})]})]})},H._id)),te&&a.jsxs("div",{className:"flex items-center px-3 py-2 space-x-2",children:[a.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx(Ht,{value:F,onChange:H=>se(H.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:H=>{H.key==="Enter"?Nt():H.key==="Escape"&&sn()}})]}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming creation of new folder: "${F}"`),Nt()},className:"h-7 w-7 p-0",children:a.jsx(Gs,{className:"h-4 w-4"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{console.log("Cancelling folder creation"),sn()},className:"h-7 w-7 p-0",children:a.jsx(Jo,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx(gt,{className:"mb-4",children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Select Participants"}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Dr,{className:"h-5 w-5 mr-2 text-muted-foreground"}),a.jsxs("span",{className:"text-sm font-medium",children:[j.length," of ",et.length," selected"]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx($E,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Ht,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:ye,onChange:H=>Ee(H.target.value)})]}),a.jsxs(J,{variant:"outline",className:"flex items-center gap-2",onClick:()=>ct(!0),children:[a.jsx(ME,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(Le).some(H=>H.length>0)?` (${Object.values(Le).reduce((H,he)=>H+he.length,0)})`:""]})]})]}),D?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(Ds,{className:"h-8 w-8 animate-spin text-primary"})}):et.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:et.map(H=>{const he=H._id||H.id;return a.jsx(fN,{user:{id:he,_id:H._id,name:H.name,age:H.age,gender:H.gender,occupation:H.occupation,location:H.location||"Unknown",techSavviness:H.techSavviness||50,personality:H.personality||"No description available",oceanTraits:H.oceanTraits,qualitativeAttributes:H.qualitativeAttributes,topPersonalityTraits:H.topPersonalityTraits,aiSynthesizedBio:H.aiSynthesizedBio},selected:j.includes(he),onSelectionToggle:()=>bt(he),onViewDetails:Re},he)})}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No personas available matching your criteria."})})]})})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(J,{variant:"outline",onClick:()=>l("review"),children:"Back to Review"}),a.jsxs(J,{onClick:gr,disabled:j.length<1||!m,children:[a.jsx(sZ,{className:"mr-2 h-4 w-4"}),"Start Focus Group Session"]})]})]})]}),a.jsx(Ql,{open:Z,onOpenChange:H=>{H?(ct(H),Jt({...Le})):ct(!1)},children:a.jsxs($c,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Lc,{children:[a.jsx(Bc,{children:"Filter Personas"}),a.jsx(Xl,{children:"Select attributes to filter personas by. Multiple selections within a category use OR logic, different categories use AND logic."})]}),a.jsxs("div",{className:"py-4 space-y-6",children:[Object.values(lt).some(H=>H.length>0)&&a.jsx("div",{className:"bg-muted/30 p-3 rounded-md",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[Object.values(lt).reduce((H,he)=>H+he.length,0)," active filters"]})}),(()=>{const H=be(E),he=Object.values(lt).every(je=>je.length===0),ue=(je,Be,zt=1)=>{const er=he?H[Be]:Ve(Be)[Be],so=lt[Be],Mu=[...new Set([...er,...so])].sort();return Mu.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:je}),a.jsx("div",{className:`grid grid-cols-1 ${zt===2?"sm:grid-cols-2":zt===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:Mu.map(na=>{const ee=lt[Be].includes(na),ce=er.includes(na);return a.jsxs("div",{className:`flex items-center space-x-2 ${!ce&&!ee?"opacity-50":""}`,children:[a.jsx(Dl,{id:`${Be}-${na}`,checked:ee,onCheckedChange:()=>Ke(Be,na),disabled:!ce&&!ee}),a.jsxs(mo,{htmlFor:`${Be}-${na}`,className:"truncate overflow-hidden",children:[na,ee&&!ce&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},na)})})]})};return a.jsxs(a.Fragment,{children:[ue("Gender","gender",3),ue("Age","age",3),ue("Ethnicity","ethnicity",2),ue("Location","location",2),ue("Occupation","occupation",2),ue("Tech Savviness","techSavviness",3),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()]}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:kt,children:"Reset"}),a.jsx(J,{onClick:st,children:"Apply Filters"})]})]})})]})]})]})]})}const ade=[{id:"1",name:"Mobile App UX Evaluation",status:"completed",participants:6,date:"2023-06-10T14:00:00Z",duration:60,topic:"user-experience"},{id:"2",name:"Product Feature Feedback",status:"scheduled",participants:8,date:"2023-06-15T10:00:00Z",duration:90,topic:"product-feedback"},{id:"3",name:"Marketing Campaign Testing",status:"in-progress",participants:5,date:"2023-06-12T15:30:00Z",duration:45,topic:"creative-testing"},{id:"4",name:"Website Navigation Study",status:"scheduled",participants:7,date:"2023-06-18T13:00:00Z",duration:60,topic:"user-experience"}],cde={completed:"bg-green-100 text-green-800 border-green-200",scheduled:"bg-blue-100 text-blue-800 border-blue-200","in-progress":"bg-amber-100 text-amber-800 border-amber-200",active:"bg-amber-100 text-amber-800 border-amber-200",paused:"bg-purple-100 text-purple-800 border-purple-200",new:"bg-slate-100 text-slate-800 border-slate-200",ai_mode:"bg-amber-100 text-amber-800 border-amber-200",draft:"bg-gray-100 text-gray-800 border-gray-200"},lde=()=>{console.log("FocusGroups component rendering");const[t,e]=v.useState("view"),[n,r]=v.useState(""),[i,o]=v.useState([]),[s,c]=v.useState(!0),[l,u]=v.useState([]),[d,f]=v.useState(!1),[h,p]=v.useState(!1),[g,m]=v.useState(null),y=ar(),b=Fi(),[x,w]=v.useState([]),S=v.useRef(!0),C=async(E=!0)=>{if(console.log("fetchFocusGroups called with isMountedCheck:",E),console.log("isMounted.current:",S.current),E&&!S.current){console.log("Exiting early: component not mounted");return}console.log("Setting loading to true and making API call"),c(!0);try{console.log("Calling focusGroupsApi.getAll()");const I=await Ot.getAll();if(console.log("API response received:",I),!E||S.current){const D=I.data.map(z=>({...z,id:z.id||z._id,participants_count:Array.isArray(z.participants)?z.participants.length:typeof z.participants=="number"?z.participants:0}));o(D)}}catch(I){console.error("Error fetching focus groups:",I),(!E||S.current)&&(qe.error("Failed to load focus groups"),o(ade))}finally{(!E||S.current)&&c(!1)}},_=async E=>{try{const I=await Ot.getById(E);I&&I.data&&(m(I.data),e("create"))}catch(I){console.error("Error fetching focus group for edit:",I),qe.error("Failed to load focus group for editing")}};v.useEffect(()=>(console.log("useEffect running - about to fetch focus groups"),C(),()=>{console.log("useEffect cleanup - setting isMounted to false"),S.current=!1}),[]),v.useEffect(()=>{console.log("Mode change useEffect running, mode:",t),t==="view"&&(console.log("Mode is view, calling fetchFocusGroups"),C())},[t]),v.useEffect(()=>{const E=b.state;(E==null?void 0:E.mode)==="create"&&(E!=null&&E.preSelectedParticipants)&&(w(E.preSelectedParticipants),e("create"),y(b.pathname,{replace:!0,state:null}))},[b.state,b.pathname,y]),v.useEffect(()=>{const E=new URLSearchParams(b.search),I=E.get("mode"),D=E.get("id"),z=E.get("tab");if(I==="create")e("create"),m(null);else if(I==="edit"&&D){const $=i.find(G=>(G._id||G.id)===D);$?(m($),e("create")):_(D)}if(I||D||z){const $=b.pathname;y($,{replace:!0})}},[b.search,i,y,b.pathname]);const A=i.filter(E=>E.name.toLowerCase().includes(n.toLowerCase())||E.topic.toLowerCase().includes(n.toLowerCase())),j=E=>new Date(E).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),P=E=>new Date(E).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),k=E=>{u(I=>I.includes(E)?I.filter(D=>D!==E):[...I,E])},O=async()=>{if(l.length!==0){p(!0);try{const E=l.map(I=>Ot.delete(I));await Promise.all(E),o(I=>I.filter(D=>!l.includes(D.id||D._id||""))),u([]),qe.success(`${l.length} focus group${l.length>1?"s":""} deleted successfully`)}catch(E){console.error("Error deleting focus groups:",E),qe.error("Failed to delete focus groups")}finally{p(!1),f(!1)}}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:"Focus Groups"}),a.jsx("p",{className:"text-slate-600 mt-1",children:"Set up and manage AI-moderated research sessions"})]}),a.jsx("div",{className:"mt-4 sm:mt-0",children:a.jsx(J,{onClick:()=>{console.log("Create New Focus Group button clicked, current mode:",t);try{t==="view"?(console.log("Setting draft to null and switching to create mode"),m(null),e("create")):(console.log("Switching back to view mode"),e("view"))}catch(E){console.error("Error in Create New Focus Group onClick:",E)}},className:"hover-transition",children:t==="view"?"Create New Focus Group":"View All Focus Groups"})})]}),t==="view"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx($E,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Ht,{placeholder:"Search focus groups by name or topic...",className:"pl-10 bg-white",value:n,onChange:E=>r(E.target.value)})]}),a.jsxs(J,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(ME,{className:"h-4 w-4"}),a.jsx("span",{children:"Filter"})]})]}),a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Vs,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Your Focus Groups"})]}),l.length>0&&a.jsxs(J,{variant:"destructive",size:"sm",onClick:()=>f(!0),disabled:h,className:"flex items-center gap-2",children:[a.jsx(nr,{className:"h-4 w-4"}),"Delete Selected (",l.length,")"]})]}),s?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(Ds,{className:"h-8 w-8 animate-spin text-primary"})}):A.length>0?a.jsx("div",{className:"space-y-4",children:A.map(E=>a.jsx("div",{className:"glass-card rounded-xl overflow-hidden hover:shadow-md button-transition",children:a.jsxs("div",{className:"flex flex-col md:flex-row",children:[a.jsxs("div",{className:"flex-1 p-6",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Dl,{id:`select-${E.id||E._id}`,checked:l.includes(E.id||E._id||""),onCheckedChange:()=>k(E.id||E._id||""),className:"mt-1"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:E.name}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(zJ,{className:"h-4 w-4 mr-1"}),j(E.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Wp,{className:"h-4 w-4 mr-1"}),P(E.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Dr,{className:"h-4 w-4 mr-1"}),E.participants_count||(Array.isArray(E.participants)?E.participants.length:0)," participant",E.participants_count>1||Array.isArray(E.participants)&&E.participants.length>1?"s":""]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Wp,{className:"h-4 w-4 mr-1"}),E.duration," min"]})]})]})]}),a.jsxs("div",{className:Ne("px-3 py-1 rounded-full text-xs font-medium border",cde[E.status]||"bg-gray-100 text-gray-800 border-gray-200"),children:[E.status==="completed"&&"Completed",E.status==="scheduled"&&"Scheduled",E.status==="in-progress"&&"In Progress",E.status==="active"&&"In Progress",E.status==="ai_mode"&&"In Progress",E.status==="paused"&&"Paused",E.status==="new"&&"Not Started",E.status==="draft"&&"Draft",!["completed","scheduled","in-progress","active","ai_mode","paused","new","draft"].includes(E.status)&&E.status]})]}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs("div",{className:"px-3 py-1 bg-slate-100 rounded-full text-xs font-medium text-slate-800",children:[E.topic==="user-experience"&&"User Experience",E.topic==="product-feedback"&&"Product Feedback",E.topic==="creative-testing"&&"Creative Testing",E.topic==="messaging-evaluation"&&"Messaging Evaluation",E.topic&&!["user-experience","product-feedback","creative-testing","messaging-evaluation"].includes(E.topic)&&E.topic.charAt(0).toUpperCase()+E.topic.slice(1).replace(/-/g," ")]}),a.jsx("div",{className:"px-3 py-1 bg-slate-100 rounded-full text-xs font-medium text-slate-800",children:"AI Moderated"})]})]}),a.jsx("div",{className:"bg-slate-50 p-6 flex flex-col justify-center items-center md:border-l border-slate-100",children:a.jsx(J,{variant:E.status==="in-progress"||E.status==="active"||E.status==="ai_mode"?"default":E.status==="new"||E.status==="draft"?"outline":"default",className:Ne("w-full hover-transition",E.status==="new"?"bg-slate-200 text-slate-700 hover:bg-slate-300 border-slate-300":"",E.status==="draft"?"bg-gray-200 text-gray-700 hover:bg-gray-300 border-gray-300":""),onClick:()=>{if(E.status==="draft")m(E),e("create");else{const I=E.id||E._id;console.log("Navigating to focus group:",I),y(`/focus-groups/${I}`)}},children:E.status==="completed"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):E.status==="in-progress"||E.status==="active"||E.status==="ai_mode"?a.jsxs(a.Fragment,{children:["Join Session",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):E.status==="paused"?a.jsxs(a.Fragment,{children:["Session Details",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):E.status==="scheduled"?a.jsxs(a.Fragment,{children:["View Details",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):E.status==="new"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):E.status==="draft"?a.jsxs(a.Fragment,{children:["Edit",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):a.jsxs(a.Fragment,{children:["View Session",a.jsx(fo,{className:"ml-2 h-4 w-4"})]})})})]})},E.id))}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No focus groups found matching your search criteria."})})]})]}):a.jsx(sde,{draftToEdit:g,preSelectedParticipants:x,onDraftSaved:()=>{m(null),e("view"),w([]),C()}})]}),a.jsx(OA,{open:d,onOpenChange:f,children:a.jsxs(Rx,{children:[a.jsxs(Mx,{children:[a.jsxs($x,{children:["Delete ",l.length," Focus Group",l.length!==1?"s":"","?"]}),a.jsxs(Lx,{children:["This action cannot be undone. This will permanently delete the selected focus group",l.length!==1?"s":""," and remove all data associated with ",l.length!==1?"them":"it","."]})]}),a.jsxs(Dx,{children:[a.jsx(Bx,{disabled:h,children:"Cancel"}),a.jsx(Fx,{onClick:E=>{E.preventDefault(),O()},disabled:h,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:h?a.jsxs(a.Fragment,{children:[a.jsx(Ds,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):a.jsx(a.Fragment,{children:"Delete"})})]})]})})]})},ude=({participants:t,selectedParticipantIds:e,onToggleParticipantFilter:n})=>{const r=ar(),{id:i}=OE(),{setPreviousRoute:o}=ow(),s=l=>{const u=l.id||l._id;u&&i&&(o(`/focus-groups/${i}`,{focusGroupId:i}),r(`/personas/${u}`))},c=l=>{const u=l.id||l._id;u&&n(u)};return a.jsx("div",{className:"w-full lg:w-64 shrink-0",children:a.jsxs("div",{className:"glass-panel rounded-xl p-4",children:[a.jsxs("h2",{className:"font-sf text-lg font-semibold flex items-center mb-3",children:[a.jsx(Dr,{className:"h-5 w-5 text-primary mr-2"})," Participants"]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center p-2 bg-primary/5 rounded-lg",children:[a.jsx(ya,{className:"h-8 w-8 text-primary mr-3"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-primary",children:"AI Moderator"}),a.jsx("p",{className:"text-xs text-slate-500",children:"Session facilitator"})]})]}),t.map(l=>{const u=l.id||l._id,d=e.includes(u);return a.jsxs("div",{className:`flex items-center p-2 rounded-lg transition-colors ${d?"bg-blue-50 border border-blue-200":"hover:bg-slate-100"}`,children:[a.jsx("div",{className:"cursor-pointer mr-3",onClick:()=>s(l),title:`View ${l.name}'s profile`,children:a.jsx("img",{src:Cg(l),alt:l.name,className:"h-8 w-8 rounded-full object-cover"})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("p",{className:"font-medium cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>c(l),title:`Filter to show only ${l.name}'s messages`,children:l.name}),d&&a.jsx(Gs,{className:"h-4 w-4 text-blue-600 ml-2"})]}),a.jsx("p",{className:"text-xs text-slate-500",children:l.occupation})]})]},l.id)})]})]})})};function dde(t,e){return v.useReducer((n,r)=>e[n][r]??n,t)}var VN="ScrollArea",[lG,yFe]=Li(VN),[fde,Po]=lG(VN),uG=v.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:o=600,...s}=t,[c,l]=v.useState(null),[u,d]=v.useState(null),[f,h]=v.useState(null),[p,g]=v.useState(null),[m,y]=v.useState(null),[b,x]=v.useState(0),[w,S]=v.useState(0),[C,_]=v.useState(!1),[A,j]=v.useState(!1),P=Pt(e,O=>l(O)),k=Nu(i);return a.jsx(fde,{scope:n,type:r,dir:k,scrollHideDelay:o,scrollArea:c,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:_,scrollbarY:m,onScrollbarYChange:y,scrollbarYEnabled:A,onScrollbarYEnabledChange:j,onCornerWidthChange:x,onCornerHeightChange:S,children:a.jsx(it.div,{dir:k,...s,ref:P,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});uG.displayName=VN;var dG="ScrollAreaViewport",fG=v.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,asChild:i,nonce:o,...s}=t,c=Po(dG,n),l=v.useRef(null),u=Pt(e,l,c.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:` -[data-radix-scroll-area-viewport] { - scrollbar-width: none; - -ms-overflow-style: none; - -webkit-overflow-scrolling: touch; -} -[data-radix-scroll-area-viewport]::-webkit-scrollbar { - display: none; -} -:where([data-radix-scroll-area-viewport]) { - display: flex; - flex-direction: column; - align-items: stretch; -} -:where([data-radix-scroll-area-content]) { - flex-grow: 1; -} -`},nonce:o}),a.jsx(it.div,{"data-radix-scroll-area-viewport":"",...s,asChild:i,ref:u,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...t.style},children:Sde({asChild:i,children:r},d=>a.jsx("div",{"data-radix-scroll-area-content":"",ref:c.onContentChange,style:{minWidth:c.scrollbarXEnabled?"fit-content":void 0},children:d}))})]})});fG.displayName=dG;var Js="ScrollAreaScrollbar",KN=v.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Po(Js,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:s}=i,c=t.orientation==="horizontal";return v.useEffect(()=>(c?o(!0):s(!0),()=>{c?o(!1):s(!1)}),[c,o,s]),i.type==="hover"?a.jsx(hde,{...r,ref:e,forceMount:n}):i.type==="scroll"?a.jsx(pde,{...r,ref:e,forceMount:n}):i.type==="auto"?a.jsx(hG,{...r,ref:e,forceMount:n}):i.type==="always"?a.jsx(WN,{...r,ref:e}):null});KN.displayName=Js;var hde=v.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Po(Js,t.__scopeScrollArea),[o,s]=v.useState(!1);return v.useEffect(()=>{const c=i.scrollArea;let l=0;if(c){const u=()=>{window.clearTimeout(l),s(!0)},d=()=>{l=window.setTimeout(()=>s(!1),i.scrollHideDelay)};return c.addEventListener("pointerenter",u),c.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),c.removeEventListener("pointerenter",u),c.removeEventListener("pointerleave",d)}}},[i.scrollArea,i.scrollHideDelay]),a.jsx(Wr,{present:n||o,children:a.jsx(hG,{"data-state":o?"visible":"hidden",...r,ref:e})})}),pde=v.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Po(Js,t.__scopeScrollArea),o=t.orientation==="horizontal",s=aw(()=>l("SCROLL_END"),100),[c,l]=dde("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(c==="idle"){const u=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[c,i.scrollHideDelay,l]),v.useEffect(()=>{const u=i.viewport,d=o?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const p=u[d];f!==p&&(l("SCROLL"),s()),f=p};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[i.viewport,o,l,s]),a.jsx(Wr,{present:n||c!=="hidden",children:a.jsx(WN,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Te(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Te(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),hG=v.forwardRef((t,e)=>{const n=Po(Js,t.__scopeScrollArea),{forceMount:r,...i}=t,[o,s]=v.useState(!1),c=t.orientation==="horizontal",l=aw(()=>{if(n.viewport){const u=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,i=Po(Js,t.__scopeScrollArea),o=v.useRef(null),s=v.useRef(0),[c,l]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=yG(c.viewport,c.content),d={...r,sizes:c,onSizesChange:l,hasThumb:u>0&&u<1,onThumbChange:h=>o.current=h,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:h=>s.current=h};function f(h,p){return bde(h,s.current,c,p)}return n==="horizontal"?a.jsx(mde,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){const h=i.viewport.scrollLeft,p=jR(h,c,i.dir);o.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollLeft=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollLeft=f(h,i.dir))}}):n==="vertical"?a.jsx(gde,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){const h=i.viewport.scrollTop,p=jR(h,c);o.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollTop=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollTop=f(h))}}):null}),mde=v.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,o=Po(Js,t.__scopeScrollArea),[s,c]=v.useState(),l=v.useRef(null),u=Pt(e,l,o.onScrollbarXChange);return v.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),a.jsx(mG,{"data-orientation":"horizontal",...i,ref:u,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":sw(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollLeft+d.deltaX;t.onWheelScroll(h),bG(h,f)&&d.preventDefault()}},onResize:()=>{l.current&&o.viewport&&s&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Hx(s.paddingLeft),paddingEnd:Hx(s.paddingRight)}})}})}),gde=v.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,o=Po(Js,t.__scopeScrollArea),[s,c]=v.useState(),l=v.useRef(null),u=Pt(e,l,o.onScrollbarYChange);return v.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),a.jsx(mG,{"data-orientation":"vertical",...i,ref:u,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":sw(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollTop+d.deltaY;t.onWheelScroll(h),bG(h,f)&&d.preventDefault()}},onResize:()=>{l.current&&o.viewport&&s&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Hx(s.paddingTop),paddingEnd:Hx(s.paddingBottom)}})}})}),[vde,pG]=lG(Js),mG=v.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:o,onThumbPointerUp:s,onThumbPointerDown:c,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=t,p=Po(Js,n),[g,m]=v.useState(null),y=Pt(e,P=>m(P)),b=v.useRef(null),x=v.useRef(""),w=p.viewport,S=r.content-r.viewport,C=Cr(d),_=Cr(l),A=aw(f,10);function j(P){if(b.current){const k=P.clientX-b.current.left,O=P.clientY-b.current.top;u({x:k,y:O})}}return v.useEffect(()=>{const P=k=>{const O=k.target;(g==null?void 0:g.contains(O))&&C(k,S)};return document.addEventListener("wheel",P,{passive:!1}),()=>document.removeEventListener("wheel",P,{passive:!1})},[w,g,S,C]),v.useEffect(_,[r,_]),nf(g,A),nf(p.content,A),a.jsx(vde,{scope:n,scrollbar:g,hasThumb:i,onThumbChange:Cr(o),onThumbPointerUp:Cr(s),onThumbPositionChange:_,onThumbPointerDown:Cr(c),children:a.jsx(it.div,{...h,ref:y,style:{position:"absolute",...h.style},onPointerDown:Te(t.onPointerDown,P=>{P.button===0&&(P.target.setPointerCapture(P.pointerId),b.current=g.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),j(P))}),onPointerMove:Te(t.onPointerMove,j),onPointerUp:Te(t.onPointerUp,P=>{const k=P.target;k.hasPointerCapture(P.pointerId)&&k.releasePointerCapture(P.pointerId),document.body.style.webkitUserSelect=x.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),Ux="ScrollAreaThumb",gG=v.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=pG(Ux,t.__scopeScrollArea);return a.jsx(Wr,{present:n||i.hasThumb,children:a.jsx(yde,{ref:e,...r})})}),yde=v.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...i}=t,o=Po(Ux,n),s=pG(Ux,n),{onThumbPositionChange:c}=s,l=Pt(e,f=>s.onThumbChange(f)),u=v.useRef(),d=aw(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const f=o.viewport;if(f){const h=()=>{if(d(),!u.current){const p=wde(f,c);u.current=p,c()}};return c(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[o.viewport,d,c]),a.jsx(it.div,{"data-state":s.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Te(t.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),g=f.clientX-p.left,m=f.clientY-p.top;s.onThumbPointerDown({x:g,y:m})}),onPointerUp:Te(t.onPointerUp,s.onThumbPointerUp)})});gG.displayName=Ux;var qN="ScrollAreaCorner",vG=v.forwardRef((t,e)=>{const n=Po(qN,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(xde,{...t,ref:e}):null});vG.displayName=qN;var xde=v.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,i=Po(qN,n),[o,s]=v.useState(0),[c,l]=v.useState(0),u=!!(o&&c);return nf(i.scrollbarX,()=>{var f;const d=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(d),l(d)}),nf(i.scrollbarY,()=>{var f;const d=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(d),s(d)}),u?a.jsx(it.div,{...r,ref:e,style:{width:o,height:c,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Hx(t){return t?parseInt(t,10):0}function yG(t,e){const n=t/e;return isNaN(n)?0:n}function sw(t){const e=yG(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function bde(t,e,n,r="ltr"){const i=sw(n),o=i/2,s=e||o,c=i-s,l=n.scrollbar.paddingStart+s,u=n.scrollbar.size-n.scrollbar.paddingEnd-c,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return xG([l,u],f)(t)}function jR(t,e,n="ltr"){const r=sw(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-i,s=e.content-e.viewport,c=o-r,l=n==="ltr"?[0,s]:[s*-1,0],u=vm(t,l);return xG([0,s],[0,c])(u)}function xG(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function bG(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return function i(){const o={left:t.scrollLeft,top:t.scrollTop},s=n.left!==o.left,c=n.top!==o.top;(s||c)&&e(),n=o,r=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(r)};function aw(t,e){const n=Cr(t),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function nf(t,e){const n=Cr(e);Kr(()=>{let r=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(t),()=>{window.cancelAnimationFrame(r),i.unobserve(t)}}},[t,n])}function Sde(t,e){const{asChild:n,children:r}=t;if(!n)return typeof e=="function"?e(r):e;const i=v.Children.only(r);return v.cloneElement(i,{children:typeof e=="function"?e(i.props.children):e})}var wG=uG,Cde=fG,_de=vG;const cw=v.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(wG,{ref:r,className:Ne("relative overflow-hidden",t),...n,children:[a.jsx(Cde,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(SG,{}),a.jsx(_de,{})]}));cw.displayName=wG.displayName;const SG=v.forwardRef(({className:t,orientation:e="vertical",...n},r)=>a.jsx(KN,{ref:r,orientation:e,className:Ne("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:a.jsx(gG,{className:"relative flex-1 rounded-full bg-border"})}));SG.displayName=KN.displayName;const Ade=({participants:t,isVisible:e,selectedIndex:n,onSelect:r,onClose:i,position:o})=>{const s=v.useRef(null);return v.useEffect(()=>{const c=l=>{s.current&&!s.current.contains(l.target)&&i()};if(e)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[e,i]),v.useEffect(()=>{if(e&&n>=0&&s.current){const c=s.current.children[n];c&&c.scrollIntoView({block:"nearest",behavior:"smooth"})}},[n,e]),!e||t.length===0?null:a.jsxs("div",{ref:s,className:"absolute z-50 w-64 max-h-48 overflow-y-auto bg-white border border-slate-200 rounded-lg shadow-lg",style:{top:o.top,left:o.left},children:[t.map((c,l)=>{const u=c.id||c._id,d=l===n;return a.jsxs("div",{className:`flex items-center p-3 cursor-pointer transition-colors ${d?"bg-blue-50 border-l-4 border-blue-500":"hover:bg-slate-50"}`,onClick:()=>r(c),children:[a.jsx("img",{src:Cg(c),alt:c.name,className:"h-8 w-8 rounded-full object-cover mr-3 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:`font-medium truncate ${d?"text-blue-900":"text-slate-900"}`,children:c.name}),a.jsx("p",{className:`text-sm truncate ${d?"text-blue-600":"text-slate-500"}`,children:c.occupation})]})]},u)}),t.length===0&&a.jsx("div",{className:"p-3 text-center text-slate-500 text-sm",children:"No participants found"})]})};function RA(t,e){const n=[],r=[],i=/@(\w+(?:\s+\w+)*)/g;let o;for(;(o=i.exec(t))!==null;){const s=o[1],c=o.index,l=o.index+o[0].length,u=e.find(d=>d.name.toLowerCase()===s.toLowerCase());if(u){const d=u.id||u._id;d&&(n.push({id:d,name:u.name,startIndex:c,endIndex:l}),r.includes(d)||r.push(d))}}return{text:t,mentions:n,mentionedParticipantIds:r}}function jde(t,e){if(e.length===0)return[t];const n=[];let r=0;return[...e].sort((o,s)=>o.startIndex-s.startIndex).forEach((o,s)=>{o.startIndex>r&&n.push(t.slice(r,o.startIndex)),n.push(N.createElement("span",{key:`mention-${s}`,className:"text-blue-600 bg-blue-50 px-1 rounded font-medium"},`@${o.name}`)),r=o.endIndex}),r=0;n--){const r=t[n];if(r==="@"){if(n===0||/\s/.test(t[n-1]))return n}else if(/\s/.test(r))break}return null}function Nde(t,e,n){return t.slice(e+1,n).toLowerCase()}function Pde(t,e){return e?t.filter(n=>n.name.toLowerCase().includes(e)):t}const CG=v.forwardRef(({value:t,onChange:e,participants:n,placeholder:r="Ask a question or provide guidance...",className:i="",disabled:o=!1},s)=>{const[c,l]=v.useState(!1),[u,d]=v.useState(0),[f,h]=v.useState({top:0,left:0}),[p,g]=v.useState(null),[m,y]=v.useState([]),b=v.useRef(null),x=v.useRef(null);v.useEffect(()=>{s&&b.current&&(typeof s=="function"?s(b.current):s.current=b.current)},[s]);const w=()=>{if(b.current&&x.current&&p!==null){const j=b.current,P=x.current,k=document.createElement("div");k.style.position="absolute",k.style.visibility="hidden",k.style.whiteSpace="pre",k.style.font=window.getComputedStyle(j).font,k.textContent=t.slice(0,p),document.body.appendChild(k);const O=k.offsetWidth;document.body.removeChild(k);const E=P.getBoundingClientRect(),I=j.getBoundingClientRect();h({top:I.height+4,left:Math.min(O,E.width-280)})}},S=j=>{const P=j.target.value,k=j.target.selectionStart||0,O=Tde(P,k);if(O!==null&&n.length>0){const I=Nde(P,O,k),D=Pde(n,I);g(O),y(D),d(0),l(!0)}else l(!1),g(null);const E=RA(P,n);e(P,E)},C=j=>{if(c&&m.length>0)switch(j.key){case"ArrowDown":j.preventDefault(),d(P=>PP>0?P-1:m.length-1);break;case"Enter":case"Tab":j.preventDefault(),m[u]&&_(m[u]);break;case"Escape":j.preventDefault(),l(!1);break}},_=j=>{if(p!==null&&b.current){const P=b.current.selectionStart||0,{newText:k,newCursorPosition:O}=Ede(t,P,j,p),E=RA(k,n);e(k,E),setTimeout(()=>{b.current&&(b.current.focus(),b.current.setSelectionRange(O,O))},0),l(!1),g(null)}},A=()=>{l(!1),g(null)};return v.useEffect(()=>{c&&p!==null&&w()},[c,p,t]),a.jsxs("div",{ref:x,className:`relative ${i}`,children:[a.jsx("input",{ref:b,type:"text",value:t,onChange:S,onKeyDown:C,placeholder:r,disabled:o,className:"flex h-10 w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm ring-offset-white file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx(Ade,{participants:m,isVisible:c,selectedIndex:u,onSelect:_,onClose:A,position:f})]})});CG.displayName="MentionInput";const kde=({message:t,persona:e,toggleHighlight:n,participants:r=[],focusGroupId:i})=>{const[o,s]=v.useState(!1),c=t.senderId==="moderator",l=t.senderId==="facilitator",u=RA(t.text,r),d=jde(t.text,u.mentions),h=(m=>{const y=[/titled\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/asset\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/image\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/['"]([a-zA-Z0-9_\-]+\.(jpg|jpeg|png))['\"]/i,/(fg-[a-f0-9]+-[a-f0-9]{32}\.(jpg|jpeg|png))/i];for(const b of y){const x=m.match(b);if(x)return x[1]}return null})(t.text),p=(c||l)&&h&&i,g=()=>{n()};return a.jsxs("div",{id:`message-${t.id}`,className:Ne("flex items-start p-3 rounded-lg transition-colors",t.highlighted?"bg-amber-50 border border-amber-200":"hover:bg-slate-50",c?"border-l-4 border-l-primary pl-4":"",l?"border-l-4 border-l-green-500 pl-4":""),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),"data-highlighted":t.highlighted?"true":"false",children:[a.jsx("div",{className:"flex-shrink-0 mr-3",children:c?a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:a.jsx(ya,{className:"h-6 w-6 text-primary"})}):l?a.jsx("div",{className:"bg-green-100 p-2 rounded-full",children:a.jsx(qp,{className:"h-6 w-6 text-green-600"})}):e?a.jsx("div",{className:"bg-slate-100 p-2 rounded-full",children:a.jsx("img",{src:Cg(e),alt:`${e.name} avatar`,className:"h-6 w-6 rounded-full object-cover"})}):a.jsx("div",{className:"bg-slate-100 p-2 rounded-full",children:a.jsx(WJ,{className:"h-6 w-6 text-slate-600"})})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center mb-1",children:[a.jsx("span",{className:"font-medium mr-2",children:c?"AI Moderator":l?"Human Facilitator":(e==null?void 0:e.name)||"Unknown"}),!c&&!l&&e&&a.jsx(Sr,{variant:"outline",className:"text-xs font-normal",children:e.occupation}),a.jsx("span",{className:"text-xs text-slate-500 ml-auto",children:t.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("p",{className:"text-slate-700",children:d}),p&&a.jsxs("div",{className:"mt-3 p-3 border rounded-lg bg-slate-50",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Yv,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Creative Asset"})]}),a.jsx("img",{src:Ot.getAssetUrl(i,h),alt:"Creative asset for review",className:"max-w-full h-auto rounded border shadow-sm",style:{maxHeight:"300px"},onError:m=>{var b;console.error("Failed to load creative asset:",Ot.getAssetUrl(i,h)),m.currentTarget.style.display="none";const y=document.createElement("div");y.className="text-xs text-slate-500 italic p-2 border rounded bg-slate-100",y.textContent=`Creative asset not found: ${h}`,(b=m.currentTarget.parentNode)==null||b.appendChild(y)}})]}),a.jsx("div",{className:Ne("flex mt-2 space-x-2",!o&&!t.highlighted&&"hidden"),children:a.jsxs(J,{variant:"ghost",size:"sm",onClick:g,className:"h-8 px-2 text-xs",children:[a.jsx(fZ,{className:Ne("h-3 w-3 mr-1",t.highlighted?"fill-amber-400 text-amber-400":"text-slate-400")}),t.highlighted?"Highlighted":"Highlight"]})})]})]})},Ode=({action:t})=>{switch(t){case"moderator_speak":return a.jsx(Vs,{className:"h-4 w-4 text-blue-500"});case"participant_respond":return a.jsx(Dr,{className:"h-4 w-4 text-green-500"});case"participant_interaction":return a.jsx(Dr,{className:"h-4 w-4 text-purple-500"});case"probe_trigger":return a.jsx(p5,{className:"h-4 w-4 text-orange-500"});case"end_session":return a.jsx(mZ,{className:"h-4 w-4 text-red-500"});default:return a.jsx(au,{className:"h-4 w-4 text-gray-500"})}},Ide=({status:t})=>{switch(t){case"success":return a.jsx(IE,{className:"h-3 w-3 text-green-500"});case"error":return a.jsx(qJ,{className:"h-3 w-3 text-red-500"});case"pending":return a.jsx(Wp,{className:"h-3 w-3 text-yellow-500 animate-pulse"});default:return null}},Rde=({action:t})=>({moderator_speak:"Moderator",participant_respond:"Participant Response",participant_interaction:"Participant Interaction",probe_trigger:"Probe Question",end_session:"End Session"})[t]||t,Mde=t=>{try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return t}},Dde=({entry:t,isLatest:e})=>{const[n,r]=v.useState(e);return a.jsx(gt,{className:`mb-2 ${e?"ring-2 ring-blue-200 bg-blue-50/50":""}`,children:a.jsxs(_g,{open:n,onOpenChange:r,children:[a.jsx(Ag,{asChild:!0,children:a.jsx(ji,{className:"pb-2 cursor-pointer hover:bg-gray-50/50 transition-colors",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ode,{action:t.action}),a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium text-sm",children:a.jsx(Rde,{action:t.action})}),a.jsx(Ide,{status:t.execution_status})]}),a.jsx("span",{className:"text-xs text-gray-500",children:Mde(t.timestamp)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[e&&a.jsx(Sr,{variant:"secondary",className:"text-xs",children:"Latest"}),n?a.jsx(cu,{className:"h-4 w-4 text-gray-400"}):a.jsx(Ma,{className:"h-4 w-4 text-gray-400"})]})]})})}),a.jsx(jg,{children:a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"AI Reasoning:"}),a.jsxs("p",{className:"text-sm text-gray-600 bg-gray-50 p-2 rounded italic",children:['"',t.reasoning,'"']})]}),t.details&&Object.keys(t.details).length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"Details:"}),a.jsx("div",{className:"text-xs text-gray-600 bg-gray-50 p-2 rounded font-mono",children:JSON.stringify(t.details,null,2)})]}),t.execution_result&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"Execution Result:"}),a.jsx("div",{className:"text-xs text-gray-600 bg-gray-50 p-2 rounded",children:t.execution_result.error?a.jsxs("span",{className:"text-red-600",children:["Error: ",t.execution_result.error]}):a.jsx("span",{className:"text-green-600",children:t.execution_result.message||"Success"})})]})]})})})]})})},$de=({reasoningHistory:t,isVisible:e,onToggle:n,isAiMode:r=!1})=>{const[i,o]=v.useState(!0);return v.useEffect(()=>{if(i&&t.length>0){const s=document.getElementById("reasoning-panel-content");s&&(s.scrollTop=0)}},[t.length,i]),a.jsx("div",{className:"border-t border-gray-200 bg-white",children:a.jsxs(_g,{open:e,onOpenChange:n,children:[a.jsx(Ag,{asChild:!0,children:a.jsxs("div",{className:"flex items-center justify-between p-3 cursor-pointer hover:bg-gray-50 transition-colors",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(au,{className:"h-4 w-4 text-purple-600"}),a.jsx("span",{className:"font-medium text-sm",children:r?"AI Decision Reasoning":"AI Moderator Logic"}),r&&t.length>0&&a.jsx(Sr,{variant:"outline",className:"text-xs",children:t.length}),!r&&a.jsx(Sr,{variant:"secondary",className:"text-xs",children:"Manual Mode"})]}),e?a.jsx(cu,{className:"h-4 w-4 text-gray-400"}):a.jsx(Ma,{className:"h-4 w-4 text-gray-400"})]})}),a.jsx(jg,{children:a.jsx("div",{className:"border-t border-gray-100",children:r?t.length===0?a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(au,{className:"h-8 w-8 mx-auto mb-2 text-gray-300"}),a.jsx("p",{className:"text-sm",children:"No AI decisions yet"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Reasoning will appear here when the AI makes decisions"})]}):a.jsx(cw,{id:"reasoning-panel-content",className:"h-[25vh] p-3",children:a.jsx("div",{className:"space-y-2",children:t.map((s,c)=>a.jsx(Dde,{entry:s,isLatest:c===0},`${s.timestamp}-${c}`))})}):a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(LE,{className:"h-8 w-8 mx-auto mb-2 text-gray-400"}),a.jsx("p",{className:"text-sm font-medium text-gray-700",children:"Manual Moderation Mode"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"You are currently moderating the discussion manually."}),a.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"Switch to AI Mode to see automated reasoning and decisions."})]})})})]})})},Lde=({modeEvent:t})=>{const e=i=>i.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=i=>{switch(i){case"ai_mode_started":return"AI Mode Started";case"manual_mode_started":return"Manual Moderation Enabled";case"ai_session_concluded":return"AI Discussion Concluded";default:return"Mode Changed"}},r=i=>{switch(i){case"ai_mode_started":return"text-blue-600";case"manual_mode_started":return"text-slate-600";case"ai_session_concluded":return"text-green-600";default:return"text-gray-600"}};return a.jsxs("div",{className:"flex items-center my-6 px-4",children:[a.jsx("div",{className:"flex-1 border-t border-gray-200"}),a.jsx("div",{className:`mx-4 px-3 py-1 bg-white border border-gray-200 rounded-full ${r(t.event_type)}`,children:a.jsxs("div",{className:"flex items-center space-x-2 text-xs font-medium",children:[a.jsx("span",{children:n(t.event_type)}),a.jsx("span",{className:"text-gray-400",children:"at"}),a.jsx("span",{children:e(t.timestamp)})]})}),a.jsx("div",{className:"flex-1 border-t border-gray-200"})]})},Fde=({messages:t,modeEvents:e,personas:n,isSpeaking:r,focusGroupId:i,isAiModeActive:o=!1,selectedParticipantIds:s,onToggleHighlight:c,onAdvanceDiscussion:l,onNewMessage:u,onStatusChange:d,isEditingDiscussionGuide:f=!1})=>{const[h,p]=v.useState(""),[g,m]=v.useState(null),[y,b]=v.useState(!1),[x,w]=v.useState(null),S=v.useRef(null),[C,_]=v.useState(-1),[A,j]=v.useState(!1),P=v.useRef(0),k=v.useRef(null),O=v.useRef(1e4),E=v.useRef(null),[I,D]=v.useState(!1),[z,$]=v.useState(!1),[G,R]=v.useState(!1),[L,W]=v.useState(null),Y=L!==null?L:o,[te,me]=v.useState([]),[F,se]=v.useState(!1),ne=F;v.useEffect(()=>{o&&i&&ae()},[o,i]);const ae=async()=>{if(i)try{o&&De()}catch(B){console.error("Error checking autonomous status:",B)}},De=async()=>{if(i)try{const B=await Xn.getReasoningHistory(i);me(B.data.reasoning_history||[])}catch(B){console.error("Error fetching reasoning history:",B)}};v.useEffect(()=>{I&&Z()},[t,I]),v.useEffect(()=>{let B;return o&&i&&(B=setInterval(()=>{De(),ae()},5e3)),()=>{B&&clearInterval(B)}},[o,i]),v.useEffect(()=>{P.current=t.length},[]),v.useEffect(()=>{const B=t.length,X=P.current;if(A&&B>X){const ge=Date.now(),xe=k.current;if(xe&&ge-xe>=O.current)b(!1),j(!1),k.current=null;else if(xe){const Re=O.current-(ge-xe);setTimeout(()=>{b(!1),j(!1),k.current=null},Math.max(0,Re))}else b(!1),j(!1)}P.current=B},[t.length,A]);const de=B=>n.find(X=>X.id===B||X._id===B),ye=s.length===0?t:t.filter(B=>B.senderId==="moderator"||B.senderId==="facilitator"||s.includes(B.senderId)),Ee=()=>{const B=[];return ye.forEach(X=>{B.push({type:"message",data:X,timestamp:X.timestamp})}),e.forEach(X=>{B.push({type:"mode_event",data:X,timestamp:X.timestamp})}),B.sort((X,ge)=>X.timestamp.getTime()-ge.timestamp.getTime())},Z=()=>{if(!f&&E.current){const B=E.current.closest("[data-radix-scroll-area-viewport]");if(B){const X=E.current.offsetTop-B.clientHeight+50,ge=B.scrollTop,xe=X-ge,Re=300;let be=null;const Ve=st=>{be||(be=st);const kt=st-be,Ke=Math.min(kt/Re,1),tt=1-Math.pow(1-Ke,3);B.scrollTop=ge+xe*tt,Ke<1&&window.requestAnimationFrame(Ve)};window.requestAnimationFrame(Ve)}else E.current.scrollIntoView({behavior:"smooth",block:"end"})}},ct=async B=>{var Re,be;if(B.preventDefault(),!h.trim())return;let X=h,ge=null;const xe=g;p(""),m(null),b(!0),j(!0),k.current=Date.now();try{if(x){try{re.info("Uploading creative asset...",{description:"Please wait while we upload your image."});const kt=new FormData;kt.append("assets",x);const Ke=await Ot.uploadAssets(i,kt);console.log("Upload response:",Ke==null?void 0:Ke.data);const tt=Ke==null?void 0:Ke.data;tt&&tt.assets&&tt.assets.length>0?(ge=tt.assets[0].filename,console.log("Successfully got filename from upload response:",ge)):console.error("Invalid upload response structure:",tt),ge&&(X=`Please review this creative asset titled '${ge}'. ${h}`,re.success("Creative asset uploaded successfully",{description:"The image has been attached to your message."}))}catch(kt){console.error("Error uploading file:",kt),console.error("Upload error details:",(Re=kt.response)==null?void 0:Re.data),re.error("Failed to upload creative asset",{description:"Your message will be sent without the attachment."})}U()}const Ve={id:`msg-${Date.now()}`,senderId:"facilitator",text:X,timestamp:new Date,type:"question"},st=await Ot.sendMessage(i,{text:X,type:"question",senderId:"facilitator"});console.log("Message sent to API:",st),(be=st==null?void 0:st.data)!=null&&be.message_id&&(Ve.id=st.data.message_id),u(Ve),setTimeout(()=>{Z()},100),xe&&xe.mentionedParticipantIds.length>0&&setTimeout(()=>{V(xe.mentionedParticipantIds,Ve.text)},500)}catch(Ve){console.error("Error sending message:",Ve),b(!1),j(!1),k.current=null;const st={id:`msg-${Date.now()}`,senderId:"facilitator",text:h,timestamp:new Date,type:"question"};u(st),setTimeout(()=>{Z()},100),re.error("Failed to send message to server",{description:"Message will be shown locally but not saved."})}},Le=()=>{for(let B=t.length-1;B>=0;B--)if(t[B].senderId==="moderator"&&t[B].type==="question")return t[B].text;for(let B=t.length-1;B>=0;B--)if(t[B].senderId==="moderator")return t[B].text;return"What are your thoughts on this topic?"},At=(B,X)=>{if(!B||!B.sections||!X)return null;const{section_index:ge,subsection_index:xe,item_index:Re,item_type:be}=X,Ve=B.sections,st=Ke=>{const tt=[];return Ke.questions&&Ke.questions.forEach((Nt,sn)=>{tt.push({...Nt,type:"question",index:sn})}),Ke.activities&&Ke.activities.forEach((Nt,sn)=>{tt.push({...Nt,type:"activity",index:sn})}),tt.sort((Nt,sn)=>Nt.type!==sn.type?Nt.type==="question"?-1:1:Nt.index-sn.index)};if(ge>=Ve.length)return{completed:!0};const kt=Ve[ge];if(xe!==void 0&&kt.subsections){if(xe>=kt.subsections.length)return At(B,{section_index:ge+1,subsection_index:void 0,item_index:0,item_type:"question"});const Ke=kt.subsections[xe],tt=st(Ke),Nt=tt.findIndex(sn=>sn.type===be&&sn.index===Re);if(Nt0){const tt=Ke.findIndex(Nt=>Nt.type===be&&Nt.index===Re);if(tt0?At(B,{section_index:ge,subsection_index:0,item_index:0,item_type:"question"}):At(B,{section_index:ge+1,subsection_index:void 0,item_index:0,item_type:"question"})}},lt=async()=>{var B,X,ge;if(i)try{b(!0),j(!0),k.current=Date.now(),re.info("Advancing discussion...",{description:"Moving to the next question in the discussion guide."});const[xe,Re]=await Promise.all([Xn.getModeratorStatus(i),Ot.getById(i)]);if(!((B=xe==null?void 0:xe.data)!=null&&B.status)||!((X=Re==null?void 0:Re.data)!=null&&X.discussionGuide))throw new Error("Could not fetch moderator status or discussion guide");const be=xe.data.status,Ve=Re.data.discussionGuide;if(!Ve.sections)throw new Error("Discussion guide does not have a structured format");const st=At(Ve,be.moderator_position);if(!st)throw new Error("Could not determine next discussion item");if(st.completed){re.success("Discussion guide completed",{description:"All sections of the discussion guide have been covered."});const Ke={id:`msg-${Date.now()}`,senderId:"moderator",text:"We have covered all the questions in our discussion guide. Thank you all for your valuable insights and participation in this focus group session.",timestamp:new Date,type:"system"};u(Ke);return}await Xn.setModeratorPosition(i,st.sectionId,st.itemId);const kt={id:`msg-${Date.now()}`,senderId:"moderator",text:st.content,timestamp:new Date,type:"question"};try{const Ke=await Ot.sendMessage(i,{senderId:"moderator",text:kt.text,type:"question"});(ge=Ke==null?void 0:Ke.data)!=null&&ge.message_id&&(kt.id=Ke.data.message_id)}catch(Ke){console.warn("Failed to save message to API, showing locally:",Ke)}u(kt),setTimeout(()=>{Z()},100),re.success("Discussion advanced",{description:`Moved to: ${st.section.title}${st.subsection?` > ${st.subsection.title}`:""}`}),d&&setTimeout(()=>d(),500)}catch(xe){console.error("Error advancing discussion:",xe),re.error("Failed to advance discussion",{description:xe.message||"There was a problem advancing to the next question."}),b(!1),j(!1),k.current=null}},Jt=async()=>{var B,X,ge,xe;if(i){console.log("Starting AI Mode: setting autonomousLoading to true"),R(!0);try{console.log("Starting AI Mode: calling API...");const be=await Promise.race([Xn.startAutonomousConversation(i),new Promise((Ve,st)=>setTimeout(()=>st(new Error("API call timeout after 30 seconds")),3e4))]);if(console.log("Starting AI Mode: API response received:",be),be.data.error){re.error("Failed to start autonomous conversation",{description:be.data.error}),R(!1);return}re.success("Autonomous conversation started",{description:"The AI is now managing the focus group conversation"}),W(!0);try{console.log("Starting AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Starting AI Mode: onStatusChange completed successfully"))}catch(Ve){console.error("Starting AI Mode: onStatusChange failed:",Ve)}console.log("Starting AI Mode: resetting autonomousLoading to false"),R(!1),De()}catch(Re){console.error("Error starting autonomous conversation:",Re),Re.response&&Re.response.data&&console.error("Backend error details:",Re.response.data);const be=((X=(B=Re.response)==null?void 0:B.data)==null?void 0:X.message)||((xe=(ge=Re.response)==null?void 0:ge.data)==null?void 0:xe.error)||"Please check your connection and try again";re.error("Failed to start autonomous conversation",{description:be}),R(!1)}}},T=async()=>{if(i){console.log("Stopping AI Mode: setting autonomousLoading to true"),R(!0);try{const B=await Xn.stopAutonomousConversation(i,"manual_stop");if(B.data.error){re.error("Failed to stop autonomous conversation",{description:B.data.error}),R(!1);return}me([]),re.success("Autonomous conversation stopped",{description:"You can now moderate the discussion manually"}),W(!1);try{console.log("Stopping AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Stopping AI Mode: onStatusChange completed successfully"))}catch(X){console.error("Stopping AI Mode: onStatusChange failed:",X)}console.log("Stopping AI Mode: resetting autonomousLoading to false"),R(!1)}catch(B){console.error("Error stopping autonomous conversation:",B),re.error("Failed to stop autonomous conversation"),R(!1)}}},M=B=>{var ge;const X=(ge=B.target.files)==null?void 0:ge[0];if(X){if(!X.type.startsWith("image/")){re.error("Please select an image file",{description:"Only image files (JPG, PNG, etc.) are supported for creative review."});return}if(X.size>10*1024*1024){re.error("File too large",{description:"Please select an image smaller than 10MB."});return}w(X),re.success(`Image selected: ${X.name}`,{description:"The image will be attached to your next message."})}},U=()=>{w(null),S.current&&(S.current.value="")},V=async(B,X)=>{var ge;if(!(!i||B.length===0))try{b(!0),j(!0),k.current=Date.now(),re.info("Generating responses from mentioned participants...",{description:`Generating responses from ${B.length} mentioned participant(s).`});for(const xe of B){const Re=n.find(be=>(be._id||be.id)===xe);if(!Re){console.warn(`Mentioned participant ${xe} not found in focus group`);continue}try{const be=await Xn.generateResponse(i,xe,X||"Continue the conversation based on the latest moderator message.");if((ge=be==null?void 0:be.data)!=null&&ge.response){console.log("Generated response from mentioned participant:",be.data);const Ve={id:be.data.message_id||`msg-${Date.now()}-${xe}`,senderId:xe,text:be.data.response,timestamp:new Date,type:"response"};u(Ve),re.success(`Response generated from ${Re.name}`,{description:be.data.response.substring(0,100)+"..."})}}catch(be){console.error(`Error generating response from ${Re.name}:`,be),re.error(`Failed to generate response from ${Re.name}`)}}}catch(xe){console.error("Error generating mentioned responses:",xe),re.error("Failed to generate responses from mentioned participants"),b(!1),j(!1),k.current=null}},Q=async()=>{var B,X,ge,xe;if(i){if(n.length===0){re.error("No participants available",{description:"Add participants to the focus group before generating responses."});return}try{b(!0),j(!0),k.current=Date.now(),re.info("AI is selecting participant...",{description:"Analyzing the conversation to choose the best respondent."});const Re=await Xn.makeConversationDecision(i,.7,"manual");if(!Re||!Re.data||!Re.data.decision)throw new Error("Empty decision response from AI");const be=Re.data.decision;if(be.action==="participant_respond"){const Ve=be.details.participant_id,st=be.details.topic_context,kt=be.reasoning,Ke=n.find(Nt=>(Nt._id||Nt.id)===Ve);if(!Ke)throw new Error(`Selected participant ${Ve} not found in focus group`);re.info("Generating response...",{description:`AI selected ${Ke.name}: ${kt.substring(0,100)}${kt.length>100?"...":""}`});const tt=await Xn.generateResponse(i,Ve,st);if(!tt||!tt.data)throw new Error("Empty response from API");if((B=tt==null?void 0:tt.data)!=null&&B.message_id&&((X=tt==null?void 0:tt.data)!=null&&X.response)){const Nt={id:tt.data.message_id,senderId:Ve,text:tt.data.response,timestamp:new Date,type:"response",highlighted:!1};u(Nt),setTimeout(()=>{Z()},100)}else throw new Error("Failed to generate or save AI response")}else{if(console.log("AI suggested different action:",be.action),be.action==="moderator_speak"){re.info("AI suggests moderator intervention",{description:`AI reasoning: ${be.reasoning.substring(0,100)}${be.reasoning.length>100?"...":""}`});return}re.warning("Using fallback participant selection",{description:`AI suggested "${be.action}" but generating participant response anyway.`});const Ve=(C+1)%n.length,st=n[Ve],kt=Le(),Ke=st._id||st.id,tt=await Xn.generateResponse(i,Ke,kt);if((ge=tt==null?void 0:tt.data)!=null&&ge.message_id&&((xe=tt==null?void 0:tt.data)!=null&&xe.response)){const Nt={id:tt.data.message_id,senderId:Ke,text:tt.data.response,timestamp:new Date,type:"response",highlighted:!1};u(Nt),setTimeout(()=>{Z()},100),_(Ve)}}}catch(Re){console.error("Error generating AI response:",Re),re.error("Failed to generate AI response",{description:"There was a problem connecting to the server."}),b(!1),j(!1),k.current=null}}};return a.jsxs("div",{className:"glass-panel rounded-xl p-4 flex flex-col h-full",children:[a.jsx("div",{className:"flex-1 min-h-0 mb-4",children:a.jsxs(cw,{className:"h-full pr-4",children:[a.jsxs("div",{className:"space-y-4",children:[Ee().map(B=>B.type==="message"?a.jsx(kde,{message:B.data,persona:B.data.senderId!=="moderator"&&B.data.senderId!=="facilitator"?de(B.data.senderId):null,toggleHighlight:()=>c(B.data.id),participants:n,focusGroupId:i},B.data.id):a.jsx(Lde,{modeEvent:B.data},B.data.id)),(y||o)&&a.jsxs("div",{className:"flex items-center space-x-2 text-sm text-slate-500 animate-pulse",children:[a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:o?a.jsx(ya,{className:"h-4 w-4 text-primary animate-spin"}):a.jsx(As,{className:"h-4 w-4 text-primary"})}),a.jsx("span",{children:o?"AI is generating next response...":"Generating AI response..."})]}),a.jsx("div",{className:"h-8"}),a.jsx("div",{ref:E,className:"h-1"})]}),!I&&ye.length>6&&a.jsx("div",{className:"sticky bottom-5 ml-auto mr-5 z-10 w-fit",children:a.jsx(J,{size:"sm",className:"rounded-full shadow-md h-10 w-10 p-0",onClick:Z,title:"Scroll to bottom",children:a.jsx(qO,{className:"h-4 w-4"})})})]})}),a.jsx($de,{reasoningHistory:te,isVisible:ne,onToggle:()=>se(!F),isAiMode:o}),a.jsxs("div",{className:"pt-4 border-t border-slate-200 w-full",children:[x&&a.jsxs("div",{className:"mb-2 p-2 bg-blue-50 border border-blue-200 rounded-md flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ZO,{className:"h-4 w-4 text-blue-600"}),a.jsx("span",{className:"text-sm text-blue-700",children:x.name}),a.jsxs("span",{className:"text-xs text-blue-500",children:["(",(x.size/1024/1024).toFixed(1)," MB)"]})]}),a.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:U,className:"h-6 w-6 p-0 text-blue-600 hover:text-blue-800",children:"Ɨ"})]}),a.jsxs("form",{onSubmit:ct,className:"flex items-center gap-2 w-full",children:[a.jsx("input",{ref:S,type:"file",accept:"image/*",onChange:M,className:"hidden"}),a.jsx(CG,{value:h,onChange:(B,X)=>{p(B),m(X||null)},participants:n,placeholder:"Ask a question or provide guidance...",className:"flex-1 min-w-0",disabled:!1}),a.jsx(J,{type:"button",variant:"outline",size:"sm",onClick:()=>{var B;return(B=S.current)==null?void 0:B.click()},className:"hover-transition shrink-0 px-3",disabled:!1,title:"Attach image for creative review",children:a.jsx(ZO,{className:"h-4 w-4"})}),a.jsxs(J,{type:"submit",variant:"default",className:"hover-transition shrink-0",disabled:!1,children:[a.jsx(Vs,{className:"mr-2 h-4 w-4"}),"Send"]})]}),a.jsxs("div",{className:"flex justify-between items-center mt-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("p",{className:"text-sm text-slate-500",children:r?"Speaking...":o?"AI mode active":"Manual moderation mode"}),a.jsx(J,{variant:"outline",size:"sm",onClick:Y?T:Jt,disabled:G,className:`hover-transition ${Y?"bg-red-50 text-red-600 hover:bg-red-100":"bg-blue-50 text-blue-600 hover:bg-blue-100"}`,title:Y?"Stop AI mode and return to manual":"Start autonomous AI conversation",children:G?a.jsxs(a.Fragment,{children:[a.jsx(ya,{className:"mr-1 h-3 w-3 animate-spin"}),o?"Stopping...":"Starting..."]}):Y?a.jsxs(a.Fragment,{children:[a.jsx(ya,{className:"mr-1 h-3 w-3"}),"Stop AI Mode"]}):a.jsxs(a.Fragment,{children:[a.jsx(ya,{className:"mr-1 h-3 w-3"}),"Start AI Mode"]})}),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>{D(!I),I||Z()},className:`hover-transition ${I?"bg-blue-50 text-blue-600 hover:bg-blue-100":""}`,title:I?"Disable auto-scroll":"Enable auto-scroll",children:[a.jsx(qO,{className:"h-3 w-3 mr-1"}),"Auto-scroll"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!o&&a.jsxs(a.Fragment,{children:[a.jsxs(J,{variant:"outline",onClick:lt,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:y,title:n.length===0?"Add participants to the focus group first":"Advance to the next part of the discussion guide",children:[a.jsx(Vs,{className:"mr-2 h-4 w-4"}),n.length===0?"No Participants":"Advance Discussion"]}),a.jsxs(J,{variant:"ghost",size:"sm",onClick:Q,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:y||n.length===0,title:"Generate a participant response to the current topic",children:[a.jsx(As,{className:"mr-1 h-3 w-3"}),"Get Response"]})]}),o&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1 text-sm text-slate-600",children:[a.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),a.jsx("span",{children:"AI Active"})]}),a.jsx(J,{variant:"outline",size:"sm",onClick:()=>$(!z),className:"hover-transition",title:"Show autonomous conversation controls",children:a.jsx(LE,{className:"h-3 w-3"})})]})]})]})]})]})},Bde=({themes:t,messages:e,personas:n=[],onThemeDelete:r,onQuoteClick:i})=>{const o=(d,f)=>{d.stopPropagation(),r&&(r(f),re.success("Theme deleted successfully"))},s=d=>n.find(f=>f.id===d||f._id===d),c=d=>{let f=d;const h=d.match(/^\[MSG_ID:[^\]]+\]\s*(.*)$/);h&&(f=h[1]);const p=f.match(/^\[([^\]]+)\]:\s*(.*)$/);if(p)return{persona:p[1],text:p[2]};const g=f.match(/^([^:]+):\s*(.*)$/);return g&&g[1].trim()!==f.trim()?{persona:g[1].trim(),text:g[2]}:{persona:null,text:f}},l=t.filter(d=>"source"in d?d.source==="highlight":!0),u=t.filter(d=>"source"in d&&d.source==="generated");return a.jsxs("div",{className:"glass-panel rounded-xl p-6 h-[70vh] flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(uu,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Key Themes"})]}),a.jsxs("div",{className:"overflow-auto",children:[u.length>0&&a.jsxs("div",{className:"mb-8",children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(au,{className:"h-4 w-4 text-primary mr-2"}),a.jsx("h3",{className:"font-medium",children:"AI-Generated Themes"})]}),a.jsx("div",{className:"grid grid-cols-1 gap-4 mb-4",children:u.map(d=>a.jsxs(gt,{className:"hover:shadow-md transition-shadow relative group",children:[r&&a.jsx("button",{className:"absolute top-2 right-2 p-1 rounded-full bg-slate-200 opacity-0 group-hover:opacity-100 transition-opacity",onClick:f=>o(f,d.id),children:a.jsx(Jo,{className:"h-3 w-3 text-slate-700"})}),a.jsx(ji,{className:"pb-2",children:a.jsx(Wi,{className:"text-base",children:d.title})}),a.jsxs(Rt,{children:[a.jsx("p",{className:"text-sm text-slate-600 mb-2",children:d.description}),d.quotes&&d.quotes.length>0&&a.jsxs("div",{className:"mt-3",children:[a.jsx("h4",{className:"text-xs font-medium text-slate-700 mb-2",children:"Supporting Quotes:"}),a.jsx("div",{className:"space-y-2",children:d.quotes.map((f,h)=>{const p=typeof f=="object"&&f!==null,g=p?f.text:f,m=p?f.speaker:c(f).persona,y=p?f.message_id:void 0,b=p?f.original:f;return a.jsxs("div",{className:"bg-slate-50 p-2 rounded text-xs text-slate-600 border-l-2 border-slate-200 cursor-pointer hover:bg-slate-100 transition-colors",onClick:x=>{x.stopPropagation(),i&&i(p?f:b,y)},title:y?`Message ID: ${y}`:"Click to find original message",children:[m&&a.jsxs("span",{className:"font-semibold text-slate-700 mr-1",children:[m,":"]}),'"',g,'"',y&&a.jsx("span",{className:"ml-2 text-xs text-green-600 opacity-70",children:"āœ“"})]},h)})})]})]})]},d.id))})]}),l.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(oZ,{className:"h-4 w-4 text-primary mr-2"}),a.jsx("h3",{className:"font-medium",children:"Highlighted Comments"})]}),a.jsx("div",{className:"grid grid-cols-1 gap-4 mb-4",children:l.map(d=>{const f=d.messages.length>0?e.find(y=>y.id===d.messages[0]):null,h=(f==null?void 0:f.text)||d.text,p=h.length>200?h.substring(0,200)+"...":h,g=f==null?void 0:f.senderId;let m="";if(g==="moderator")m="AI Moderator";else if(g==="facilitator")m="Human Facilitator";else if(g){const y=s(g);m=(y==null?void 0:y.name)||"Unknown Participant"}return a.jsxs(gt,{className:"hover:shadow-md hover:bg-slate-50 transition-all cursor-pointer relative group",onClick:y=>{y.stopPropagation(),i&&f&&i(f.text,f.id)},title:"Click to view in discussion",children:[r&&a.jsx("button",{className:"absolute top-2 right-2 p-1 rounded-full bg-slate-200 opacity-0 group-hover:opacity-100 transition-opacity z-10",onClick:y=>o(y,d.id),children:a.jsx(Jo,{className:"h-3 w-3 text-slate-700"})}),a.jsx(ji,{className:"pb-2",children:a.jsx(Wi,{className:"text-sm font-medium text-slate-800 line-clamp-2",children:m&&a.jsx("span",{className:"text-primary font-semibold",children:m})})}),a.jsxs(Rt,{className:"pt-0",children:[a.jsxs("p",{className:"text-sm text-slate-600 leading-relaxed",children:['"',p,'"']}),a.jsxs("div",{className:"mt-2 flex items-center text-xs text-slate-400",children:[a.jsx(As,{className:"h-3 w-3 mr-1"}),"Click to view in discussion"]})]})]},d.id)})})]}),t.length===0&&a.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center bg-slate-50 rounded-lg",children:[a.jsx(uu,{className:"h-8 w-8 text-slate-400 mb-3"}),a.jsx("p",{className:"text-slate-600",children:"No themes have been identified yet."}),a.jsx("p",{className:"text-sm text-slate-500 mt-2",children:"Highlight important messages in the discussion or generate themes automatically."})]})]})]})},Ude=({themes:t,messages:e,personas:n,focusGroupId:r,onThemesGenerated:i,onThemeDelete:o,onQuoteClick:s,onGenerateKeyThemes:c})=>{const l=()=>{if(!t||t.length===0){re.warning("No themes to export",{description:"Generate some themes first before exporting."});return}let u=`# Key Themes Analysis - -`;const d=t.filter(g=>"source"in g&&g.source==="generated");if(d.length===0){re.warning("No AI-generated themes to export",{description:"Only AI-generated themes are included in the export."});return}d.forEach((g,m)=>{u+=`## ${m+1}. ${g.title} - -`,u+=`${g.description} - -`,g.quotes&&g.quotes.length>0&&(u+=`**Supporting Quotes:** - -`,g.quotes.forEach(y=>{if(typeof y=="string")u+=`> ${y} - -`;else{let b="";y.speaker&&(b+=`**${y.speaker}:** `),b+=y.text,u+=`> ${b} - -`}})),u+=`--- - -`});const f=new Blob([u],{type:"text/markdown"}),h=URL.createObjectURL(f),p=document.createElement("a");p.href=h,p.download=`key-themes-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(h),re.success("Themes exported successfully",{description:`Downloaded ${d.length} themes as markdown file.`})};return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"mb-4 space-y-2",children:[a.jsxs(J,{onClick:c,className:"w-full",children:[a.jsx(gZ,{className:"mr-2 h-4 w-4"}),"Analyze Discussion for Key Themes"]}),a.jsxs(J,{onClick:l,disabled:!t||t.length===0,variant:"outline",className:"w-full",children:[a.jsx(lu,{className:"mr-2 h-4 w-4"}),"Export Themes"]})]}),a.jsx("div",{className:"flex-grow overflow-hidden",children:a.jsx(Bde,{themes:t,messages:e,personas:n,onThemeDelete:o,focusGroupId:r,onQuoteClick:s})})]})};var Hde=Array.isArray,Bi=Hde,zde=typeof Bg=="object"&&Bg&&Bg.Object===Object&&Bg,_G=zde,Gde=_G,Vde=typeof self=="object"&&self&&self.Object===Object&&self,Kde=Gde||Vde||Function("return this")(),Zs=Kde,Wde=Zs,qde=Wde.Symbol,Ng=qde,ER=Ng,AG=Object.prototype,Yde=AG.hasOwnProperty,Qde=AG.toString,Th=ER?ER.toStringTag:void 0;function Xde(t){var e=Yde.call(t,Th),n=t[Th];try{t[Th]=void 0;var r=!0}catch{}var i=Qde.call(t);return r&&(e?t[Th]=n:delete t[Th]),i}var Jde=Xde,Zde=Object.prototype,efe=Zde.toString;function tfe(t){return efe.call(t)}var nfe=tfe,TR=Ng,rfe=Jde,ife=nfe,ofe="[object Null]",sfe="[object Undefined]",NR=TR?TR.toStringTag:void 0;function afe(t){return t==null?t===void 0?sfe:ofe:NR&&NR in Object(t)?rfe(t):ife(t)}var Wa=afe;function cfe(t){return t!=null&&typeof t=="object"}var qa=cfe,lfe=Wa,ufe=qa,dfe="[object Symbol]";function ffe(t){return typeof t=="symbol"||ufe(t)&&lfe(t)==dfe}var Yf=ffe,hfe=Bi,pfe=Yf,mfe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gfe=/^\w*$/;function vfe(t,e){if(hfe(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||pfe(t)?!0:gfe.test(t)||!mfe.test(t)||e!=null&&t in Object(e)}var YN=vfe;function yfe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var fl=yfe;const Qf=dn(fl);var xfe=Wa,bfe=fl,wfe="[object AsyncFunction]",Sfe="[object Function]",Cfe="[object GeneratorFunction]",_fe="[object Proxy]";function Afe(t){if(!bfe(t))return!1;var e=xfe(t);return e==Sfe||e==Cfe||e==wfe||e==_fe}var QN=Afe;const Ct=dn(QN);var jfe=Zs,Efe=jfe["__core-js_shared__"],Tfe=Efe,nC=Tfe,PR=function(){var t=/[^.]+$/.exec(nC&&nC.keys&&nC.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Nfe(t){return!!PR&&PR in t}var Pfe=Nfe,kfe=Function.prototype,Ofe=kfe.toString;function Ife(t){if(t!=null){try{return Ofe.call(t)}catch{}try{return t+""}catch{}}return""}var jG=Ife,Rfe=QN,Mfe=Pfe,Dfe=fl,$fe=jG,Lfe=/[\\^$.*+?()[\]{}|]/g,Ffe=/^\[object .+?Constructor\]$/,Bfe=Function.prototype,Ufe=Object.prototype,Hfe=Bfe.toString,zfe=Ufe.hasOwnProperty,Gfe=RegExp("^"+Hfe.call(zfe).replace(Lfe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Vfe(t){if(!Dfe(t)||Mfe(t))return!1;var e=Rfe(t)?Gfe:Ffe;return e.test($fe(t))}var Kfe=Vfe;function Wfe(t,e){return t==null?void 0:t[e]}var qfe=Wfe,Yfe=Kfe,Qfe=qfe;function Xfe(t,e){var n=Qfe(t,e);return Yfe(n)?n:void 0}var Ou=Xfe,Jfe=Ou,Zfe=Jfe(Object,"create"),lw=Zfe,kR=lw;function ehe(){this.__data__=kR?kR(null):{},this.size=0}var the=ehe;function nhe(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var rhe=nhe,ihe=lw,ohe="__lodash_hash_undefined__",she=Object.prototype,ahe=she.hasOwnProperty;function che(t){var e=this.__data__;if(ihe){var n=e[t];return n===ohe?void 0:n}return ahe.call(e,t)?e[t]:void 0}var lhe=che,uhe=lw,dhe=Object.prototype,fhe=dhe.hasOwnProperty;function hhe(t){var e=this.__data__;return uhe?e[t]!==void 0:fhe.call(e,t)}var phe=hhe,mhe=lw,ghe="__lodash_hash_undefined__";function vhe(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=mhe&&e===void 0?ghe:e,this}var yhe=vhe,xhe=the,bhe=rhe,whe=lhe,She=phe,Che=yhe;function Xf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var Bhe=Fhe,Uhe=uw;function Hhe(t,e){var n=this.__data__,r=Uhe(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var zhe=Hhe,Ghe=jhe,Vhe=Rhe,Khe=$he,Whe=Bhe,qhe=zhe;function Jf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e0?1:-1},$l=function(e){return Pg(e)&&e.indexOf("%")===e.length-1},Ae=function(e){return mme(e)&&!eh(e)},Er=function(e){return Ae(e)||Pg(e)},xme=0,th=function(e){var n=++xme;return"".concat(e||"").concat(n)},gi=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Ae(e)&&!Pg(e))return r;var o;if($l(e)){var s=e.indexOf("%");o=n*parseFloat(e.slice(0,s))/100}else o=+e;return eh(o)&&(o=r),i&&o>n&&(o=n),o},fc=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},bme=function(e){if(!Array.isArray(e))return!1;for(var n=e.length,r={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function jme(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function DA(t){"@babel/helpers - typeof";return DA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},DA(t)}var LR={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"},ja=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},FR=null,iC=null,sP=function t(e){if(e===FR&&Array.isArray(iC))return iC;var n=[];return v.Children.forEach(e,function(r){Dt(r)||(MG.isFragment(r)?n=n.concat(t(r.props.children)):n.push(r))}),iC=n,FR=e,n};function jo(t,e){var n=[],r=[];return Array.isArray(e)?r=e.map(function(i){return ja(i)}):r=[ja(e)],sP(t).forEach(function(i){var o=to(i,"type.displayName")||to(i,"type.name");r.indexOf(o)!==-1&&n.push(i)}),n}function Ki(t,e){var n=jo(t,e);return n&&n[0]}var BR=function(e){if(!e||!e.props)return!1;var n=e.props,r=n.width,i=n.height;return!(!Ae(r)||r<=0||!Ae(i)||i<=0)},Eme=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],Tme=function(e){return e&&e.type&&Pg(e.type)&&Eme.indexOf(e.type)>=0},Nme=function(e){return e&&DA(e)==="object"&&"clipDot"in e},Pme=function(e,n,r,i){var o,s=(o=rC==null?void 0:rC[i])!==null&&o!==void 0?o:[];return!Ct(e)&&(i&&s.includes(n)||Sme.includes(n))||r&&oP.includes(n)},rt=function(e,n,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(v.isValidElement(e)&&(i=e.props),!Qf(i))return null;var o={};return Object.keys(i).forEach(function(s){var c;Pme((c=i)===null||c===void 0?void 0:c[s],s,n,r)&&(o[s]=i[s])}),o},$A=function t(e,n){if(e===n)return!0;var r=v.Children.count(e);if(r!==v.Children.count(n))return!1;if(r===0)return!0;if(r===1)return UR(Array.isArray(e)?e[0]:e,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Mme(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function FA(t){var e=t.children,n=t.width,r=t.height,i=t.viewBox,o=t.className,s=t.style,c=t.title,l=t.desc,u=Rme(t,Ime),d=i||{width:n,height:r,x:0,y:0},f=Mt("recharts-surface",o);return N.createElement("svg",LA({},rt(u,!0,"svg"),{className:f,width:n,height:r,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),N.createElement("title",null,c),N.createElement("desc",null,l),e)}var Dme=["children","className"];function BA(){return BA=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Lme(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var Yt=N.forwardRef(function(t,e){var n=t.children,r=t.className,i=$me(t,Dme),o=Mt("recharts-layer",r);return N.createElement("g",BA({className:o},rt(i,!0),{ref:e}),n)}),ts=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;oi?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r=r?t:Ume(t,e,n)}var zme=Hme,Gme="\\ud800-\\udfff",Vme="\\u0300-\\u036f",Kme="\\ufe20-\\ufe2f",Wme="\\u20d0-\\u20ff",qme=Vme+Kme+Wme,Yme="\\ufe0e\\ufe0f",Qme="\\u200d",Xme=RegExp("["+Qme+Gme+qme+Yme+"]");function Jme(t){return Xme.test(t)}var $G=Jme;function Zme(t){return t.split("")}var ege=Zme,LG="\\ud800-\\udfff",tge="\\u0300-\\u036f",nge="\\ufe20-\\ufe2f",rge="\\u20d0-\\u20ff",ige=tge+nge+rge,oge="\\ufe0e\\ufe0f",sge="["+LG+"]",UA="["+ige+"]",HA="\\ud83c[\\udffb-\\udfff]",age="(?:"+UA+"|"+HA+")",FG="[^"+LG+"]",BG="(?:\\ud83c[\\udde6-\\uddff]){2}",UG="[\\ud800-\\udbff][\\udc00-\\udfff]",cge="\\u200d",HG=age+"?",zG="["+oge+"]?",lge="(?:"+cge+"(?:"+[FG,BG,UG].join("|")+")"+zG+HG+")*",uge=zG+HG+lge,dge="(?:"+[FG+UA+"?",UA,BG,UG,sge].join("|")+")",fge=RegExp(HA+"(?="+HA+")|"+dge+uge,"g");function hge(t){return t.match(fge)||[]}var pge=hge,mge=ege,gge=$G,vge=pge;function yge(t){return gge(t)?vge(t):mge(t)}var xge=yge,bge=zme,wge=$G,Sge=xge,Cge=PG;function _ge(t){return function(e){e=Cge(e);var n=wge(e)?Sge(e):void 0,r=n?n[0]:e.charAt(0),i=n?bge(n,1).join(""):e.slice(1);return r[t]()+i}}var Age=_ge,jge=Age,Ege=jge("toUpperCase"),Tge=Ege;const _w=dn(Tge);function Pn(t){return function(){return t}}const GG=Math.cos,Vx=Math.sin,ms=Math.sqrt,Kx=Math.PI,Aw=2*Kx,zA=Math.PI,GA=2*zA,_l=1e-6,Nge=GA-_l;function VG(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return VG;const n=10**e;return function(r){this._+=r[0];for(let i=1,o=r.length;i_l)if(!(Math.abs(f*l-u*d)>_l)||!o)this._append`L${this._x1=e},${this._y1=n}`;else{let p=r-s,g=i-c,m=l*l+u*u,y=p*p+g*g,b=Math.sqrt(m),x=Math.sqrt(h),w=o*Math.tan((zA-Math.acos((m+h-y)/(2*b*x)))/2),S=w/x,C=w/b;Math.abs(S-1)>_l&&this._append`L${e+S*d},${n+S*f}`,this._append`A${o},${o},0,0,${+(f*p>d*g)},${this._x1=e+C*l},${this._y1=n+C*u}`}}arc(e,n,r,i,o,s){if(e=+e,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let c=r*Math.cos(i),l=r*Math.sin(i),u=e+c,d=n+l,f=1^s,h=s?i-o:o-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>_l||Math.abs(this._y1-d)>_l)&&this._append`L${u},${d}`,r&&(h<0&&(h=h%GA+GA),h>Nge?this._append`A${r},${r},0,1,${f},${e-c},${n-l}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:h>_l&&this._append`A${r},${r},0,${+(h>=zA)},${f},${this._x1=e+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function aP(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new kge(e)}function cP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function KG(t){this._context=t}KG.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function jw(t){return new KG(t)}function WG(t){return t[0]}function qG(t){return t[1]}function YG(t,e){var n=Pn(!0),r=null,i=jw,o=null,s=aP(c);t=typeof t=="function"?t:t===void 0?WG:Pn(t),e=typeof e=="function"?e:e===void 0?qG:Pn(e);function c(l){var u,d=(l=cP(l)).length,f,h=!1,p;for(r==null&&(o=i(p=s())),u=0;u<=d;++u)!(u=p;--g)c.point(w[g],S[g]);c.lineEnd(),c.areaEnd()}b&&(w[h]=+t(y,h,f),S[h]=+e(y,h,f),c.point(r?+r(y,h,f):w[h],n?+n(y,h,f):S[h]))}if(x)return c=null,x+""||null}function d(){return YG().defined(i).curve(s).context(o)}return u.x=function(f){return arguments.length?(t=typeof f=="function"?f:Pn(+f),r=null,u):t},u.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Pn(+f),u):t},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Pn(+f),u):r},u.y=function(f){return arguments.length?(e=typeof f=="function"?f:Pn(+f),n=null,u):e},u.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Pn(+f),u):e},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Pn(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(t).y(e)},u.lineY1=function(){return d().x(t).y(n)},u.lineX1=function(){return d().x(r).y(e)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Pn(!!f),u):i},u.curve=function(f){return arguments.length?(s=f,o!=null&&(c=s(o)),u):s},u.context=function(f){return arguments.length?(f==null?o=c=null:c=s(o=f),u):o},u}class QG{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function Oge(t){return new QG(t,!0)}function Ige(t){return new QG(t,!1)}const lP={draw(t,e){const n=ms(e/Kx);t.moveTo(n,0),t.arc(0,0,n,0,Aw)}},Rge={draw(t,e){const n=ms(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},XG=ms(1/3),Mge=XG*2,Dge={draw(t,e){const n=ms(e/Mge),r=n*XG;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},$ge={draw(t,e){const n=ms(e),r=-n/2;t.rect(r,r,n,n)}},Lge=.8908130915292852,JG=Vx(Kx/10)/Vx(7*Kx/10),Fge=Vx(Aw/10)*JG,Bge=-GG(Aw/10)*JG,Uge={draw(t,e){const n=ms(e*Lge),r=Fge*n,i=Bge*n;t.moveTo(0,-n),t.lineTo(r,i);for(let o=1;o<5;++o){const s=Aw*o/5,c=GG(s),l=Vx(s);t.lineTo(l*n,-c*n),t.lineTo(c*r-l*i,l*r+c*i)}t.closePath()}},oC=ms(3),Hge={draw(t,e){const n=-ms(e/(oC*3));t.moveTo(0,n*2),t.lineTo(-oC*n,-n),t.lineTo(oC*n,-n),t.closePath()}},ao=-.5,co=ms(3)/2,VA=1/ms(12),zge=(VA/2+1)*3,Gge={draw(t,e){const n=ms(e/zge),r=n/2,i=n*VA,o=r,s=n*VA+n,c=-o,l=s;t.moveTo(r,i),t.lineTo(o,s),t.lineTo(c,l),t.lineTo(ao*r-co*i,co*r+ao*i),t.lineTo(ao*o-co*s,co*o+ao*s),t.lineTo(ao*c-co*l,co*c+ao*l),t.lineTo(ao*r+co*i,ao*i-co*r),t.lineTo(ao*o+co*s,ao*s-co*o),t.lineTo(ao*c+co*l,ao*l-co*c),t.closePath()}};function Vge(t,e){let n=null,r=aP(i);t=typeof t=="function"?t:Pn(t||lP),e=typeof e=="function"?e:Pn(e===void 0?64:+e);function i(){let o;if(n||(n=o=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),o)return n=null,o+""||null}return i.type=function(o){return arguments.length?(t=typeof o=="function"?o:Pn(o),i):t},i.size=function(o){return arguments.length?(e=typeof o=="function"?o:Pn(+o),i):e},i.context=function(o){return arguments.length?(n=o??null,i):n},i}function Wx(){}function qx(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function ZG(t){this._context=t}ZG.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:qx(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:qx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Kge(t){return new ZG(t)}function eV(t){this._context=t}eV.prototype={areaStart:Wx,areaEnd:Wx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:qx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Wge(t){return new eV(t)}function tV(t){this._context=t}tV.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:qx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function qge(t){return new tV(t)}function nV(t){this._context=t}nV.prototype={areaStart:Wx,areaEnd:Wx,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Yge(t){return new nV(t)}function zR(t){return t<0?-1:1}function GR(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),s=(n-t._y1)/(i||r<0&&-0),c=(o*i+s*r)/(r+i);return(zR(o)+zR(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(c))||0}function VR(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function sC(t,e,n){var r=t._x0,i=t._y0,o=t._x1,s=t._y1,c=(o-r)/3;t._context.bezierCurveTo(r+c,i+c*e,o-c,s-c*n,o,s)}function Yx(t){this._context=t}Yx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:sC(this,this._t0,VR(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,sC(this,VR(this,n=GR(this,t,e)),n);break;default:sC(this,this._t0,n=GR(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function rV(t){this._context=new iV(t)}(rV.prototype=Object.create(Yx.prototype)).point=function(t,e){Yx.prototype.point.call(this,e,t)};function iV(t){this._context=t}iV.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,o){this._context.bezierCurveTo(e,t,r,n,o,i)}};function Qge(t){return new Yx(t)}function Xge(t){return new rV(t)}function oV(t){this._context=t}oV.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=KR(t),i=KR(e),o=0,s=1;s=0;--e)i[e]=(s[e]-i[e+1])/o[e];for(o[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function Zge(t){return new Ew(t,.5)}function eve(t){return new Ew(t,0)}function tve(t){return new Ew(t,1)}function rf(t,e){if((s=t.length)>1)for(var n=1,r,i,o=t[e[0]],s,c=o.length;n=0;)n[e]=e;return n}function nve(t,e){return t[e]}function rve(t){const e=[];return e.key=t,e}function ive(){var t=Pn([]),e=KA,n=rf,r=nve;function i(o){var s=Array.from(t.apply(this,arguments),rve),c,l=s.length,u=-1,d;for(const f of o)for(c=0,++u;c0){for(var n,r,i=0,o=t[0].length,s;i0){for(var n=0,r=t[e[0]],i,o=r.length;n0)||!((o=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,o,s;r=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function hve(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var sV={symbolCircle:lP,symbolCross:Rge,symbolDiamond:Dge,symbolSquare:$ge,symbolStar:Uge,symbolTriangle:Hge,symbolWye:Gge},pve=Math.PI/180,mve=function(e){var n="symbol".concat(_w(e));return sV[n]||lP},gve=function(e,n,r){if(n==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var i=18*pve;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},vve=function(e,n){sV["symbol".concat(_w(e))]=n},uP=function(e){var n=e.type,r=n===void 0?"circle":n,i=e.size,o=i===void 0?64:i,s=e.sizeType,c=s===void 0?"area":s,l=fve(e,cve),u=qR(qR({},l),{},{type:r,size:o,sizeType:c}),d=function(){var y=mve(r),b=Vge().type(y).size(gve(o,c,r));return b()},f=u.className,h=u.cx,p=u.cy,g=rt(u,!0);return h===+h&&p===+p&&o===+o?N.createElement("path",WA({},g,{className:Mt("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};uP.registerSymbol=vve;function of(t){"@babel/helpers - typeof";return of=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},of(t)}function qA(){return qA=Object.assign?Object.assign.bind():function(t){for(var e=1;e`);var x=p.inactive?u:p.color;return N.createElement("li",qA({className:y,style:f,key:"legend-item-".concat(g)},bu(r.props,p,g)),N.createElement(FA,{width:s,height:s,viewBox:d,style:h},r.renderIcon(p)),N.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},m?m(b,p,g):b))})}},{key:"render",value:function(){var r=this.props,i=r.payload,o=r.layout,s=r.align;if(!i||!i.length)return null;var c={padding:0,margin:0,textAlign:o==="horizontal"?s:"left"};return N.createElement("ul",{className:"recharts-default-legend",style:c},this.renderItems())}}])}(v.PureComponent);Sm(dP,"displayName","Legend");Sm(dP,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Eve=dw;function Tve(){this.__data__=new Eve,this.size=0}var Nve=Tve;function Pve(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var kve=Pve;function Ove(t){return this.__data__.get(t)}var Ive=Ove;function Rve(t){return this.__data__.has(t)}var Mve=Rve,Dve=dw,$ve=JN,Lve=ZN,Fve=200;function Bve(t,e){var n=this.__data__;if(n instanceof Dve){var r=n.__data__;if(!$ve||r.lengthc))return!1;var u=o.get(t),d=o.get(e);if(u&&d)return u==e&&d==t;var f=-1,h=!0,p=n&cye?new iye:void 0;for(o.set(t,e),o.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=fxe}var mP=hxe,pxe=Wa,mxe=mP,gxe=qa,vxe="[object Arguments]",yxe="[object Array]",xxe="[object Boolean]",bxe="[object Date]",wxe="[object Error]",Sxe="[object Function]",Cxe="[object Map]",_xe="[object Number]",Axe="[object Object]",jxe="[object RegExp]",Exe="[object Set]",Txe="[object String]",Nxe="[object WeakMap]",Pxe="[object ArrayBuffer]",kxe="[object DataView]",Oxe="[object Float32Array]",Ixe="[object Float64Array]",Rxe="[object Int8Array]",Mxe="[object Int16Array]",Dxe="[object Int32Array]",$xe="[object Uint8Array]",Lxe="[object Uint8ClampedArray]",Fxe="[object Uint16Array]",Bxe="[object Uint32Array]",Mn={};Mn[Oxe]=Mn[Ixe]=Mn[Rxe]=Mn[Mxe]=Mn[Dxe]=Mn[$xe]=Mn[Lxe]=Mn[Fxe]=Mn[Bxe]=!0;Mn[vxe]=Mn[yxe]=Mn[Pxe]=Mn[xxe]=Mn[kxe]=Mn[bxe]=Mn[wxe]=Mn[Sxe]=Mn[Cxe]=Mn[_xe]=Mn[Axe]=Mn[jxe]=Mn[Exe]=Mn[Txe]=Mn[Nxe]=!1;function Uxe(t){return gxe(t)&&mxe(t.length)&&!!Mn[pxe(t)]}var Hxe=Uxe;function zxe(t){return function(e){return t(e)}}var vV=zxe,Zx={exports:{}};Zx.exports;(function(t,e){var n=_G,r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===r,s=o&&n.process,c=function(){try{var l=i&&i.require&&i.require("util").types;return l||s&&s.binding&&s.binding("util")}catch{}}();t.exports=c})(Zx,Zx.exports);var Gxe=Zx.exports,Vxe=Hxe,Kxe=vV,t2=Gxe,n2=t2&&t2.isTypedArray,Wxe=n2?Kxe(n2):Vxe,yV=Wxe,qxe=Xye,Yxe=hP,Qxe=Bi,Xxe=gV,Jxe=pP,Zxe=yV,ebe=Object.prototype,tbe=ebe.hasOwnProperty;function nbe(t,e){var n=Qxe(t),r=!n&&Yxe(t),i=!n&&!r&&Xxe(t),o=!n&&!r&&!i&&Zxe(t),s=n||r||i||o,c=s?qxe(t.length,String):[],l=c.length;for(var u in t)(e||tbe.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Jxe(u,l)))&&c.push(u);return c}var rbe=nbe,ibe=Object.prototype;function obe(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||ibe;return t===n}var sbe=obe;function abe(t,e){return function(n){return t(e(n))}}var xV=abe,cbe=xV,lbe=cbe(Object.keys,Object),ube=lbe,dbe=sbe,fbe=ube,hbe=Object.prototype,pbe=hbe.hasOwnProperty;function mbe(t){if(!dbe(t))return fbe(t);var e=[];for(var n in Object(t))pbe.call(t,n)&&n!="constructor"&&e.push(n);return e}var gbe=mbe,vbe=QN,ybe=mP;function xbe(t){return t!=null&&ybe(t.length)&&!vbe(t)}var kg=xbe,bbe=rbe,wbe=gbe,Sbe=kg;function Cbe(t){return Sbe(t)?bbe(t):wbe(t)}var Tw=Cbe,_be=Fye,Abe=Yye,jbe=Tw;function Ebe(t){return _be(t,jbe,Abe)}var Tbe=Ebe,r2=Tbe,Nbe=1,Pbe=Object.prototype,kbe=Pbe.hasOwnProperty;function Obe(t,e,n,r,i,o){var s=n&Nbe,c=r2(t),l=c.length,u=r2(e),d=u.length;if(l!=d&&!s)return!1;for(var f=l;f--;){var h=c[f];if(!(s?h in e:kbe.call(e,h)))return!1}var p=o.get(t),g=o.get(e);if(p&&g)return p==e&&g==t;var m=!0;o.set(t,e),o.set(e,t);for(var y=s;++f-1}var Pwe=Nwe;function kwe(t,e,n){for(var r=-1,i=t==null?0:t.length;++r=Kwe){var u=e?null:Gwe(t);if(u)return Vwe(u);s=!1,i=zwe,l=new Bwe}else l=e?[]:c;e:for(;++r=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function cSe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function lSe(t){return t.value}function uSe(t,e){if(N.isValidElement(t))return N.cloneElement(t,e);if(typeof t=="function")return N.createElement(t,e);e.ref;var n=aSe(e,Zwe);return N.createElement(dP,n)}var x2=1,Ea=function(t){function e(){var n;eSe(this,e);for(var r=arguments.length,i=new Array(r),o=0;ox2||Math.abs(i.height-this.lastBoundingBox.height)>x2)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,r&&r(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?sa({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var i=this.props,o=i.layout,s=i.align,c=i.verticalAlign,l=i.margin,u=i.chartWidth,d=i.chartHeight,f,h;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(s==="center"&&o==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=s==="right"?{right:l&&l.right||0}:{left:l&&l.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(c==="middle"){var g=this.getBBoxSnapshot();h={top:((d||0)-g.height)/2}}else h=c==="bottom"?{bottom:l&&l.bottom||0}:{top:l&&l.top||0};return sa(sa({},f),h)}},{key:"render",value:function(){var r=this,i=this.props,o=i.content,s=i.width,c=i.height,l=i.wrapperStyle,u=i.payloadUniqBy,d=i.payload,f=sa(sa({position:"absolute",width:s||"auto",height:c||"auto"},this.getDefaultPosition(l)),l);return N.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){r.wrapperNode=p}},uSe(o,sa(sa({},this.props),{},{payload:jV(d,u,lSe)})))}}],[{key:"getWithHeight",value:function(r,i){var o=sa(sa({},this.defaultProps),r.props),s=o.layout;return s==="vertical"&&Ae(r.props.height)?{height:r.props.height}:s==="horizontal"?{width:r.props.width||i}:null}}])}(v.PureComponent);Nw(Ea,"displayName","Legend");Nw(Ea,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var b2=Ng,dSe=hP,fSe=Bi,w2=b2?b2.isConcatSpreadable:void 0;function hSe(t){return fSe(t)||dSe(t)||!!(w2&&t&&t[w2])}var pSe=hSe,mSe=pV,gSe=pSe;function NV(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=gSe),i||(i=[]);++o0&&n(c)?e>1?NV(c,e-1,n,r,i):mSe(i,c):r||(i[i.length]=c)}return i}var PV=NV;function vSe(t){return function(e,n,r){for(var i=-1,o=Object(e),s=r(e),c=s.length;c--;){var l=s[t?c:++i];if(n(o[l],l,o)===!1)break}return e}}var ySe=vSe,xSe=ySe,bSe=xSe(),wSe=bSe,SSe=wSe,CSe=Tw;function _Se(t,e){return t&&SSe(t,e,CSe)}var kV=_Se,ASe=kg;function jSe(t,e){return function(n,r){if(n==null)return n;if(!ASe(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=Object(n);(e?o--:++oe||o&&s&&l&&!c&&!u||r&&s&&l||!n&&l||!i)return 1;if(!r&&!o&&!u&&t=c)return l;var u=n[r];return l*(u=="desc"?-1:1)}}return t.index-e.index}var BSe=FSe,uC=tP,USe=nP,HSe=ea,zSe=OV,GSe=MSe,VSe=vV,KSe=BSe,WSe=ih,qSe=Bi;function YSe(t,e,n){e.length?e=uC(e,function(o){return qSe(o)?function(s){return USe(s,o.length===1?o[0]:o)}:o}):e=[WSe];var r=-1;e=uC(e,VSe(HSe));var i=zSe(t,function(o,s,c){var l=uC(e,function(u){return u(o)});return{criteria:l,index:++r,value:o}});return GSe(i,function(o,s){return KSe(o,s,n)})}var QSe=YSe;function XSe(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var JSe=XSe,ZSe=JSe,C2=Math.max;function eCe(t,e,n){return e=C2(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=C2(r.length-e,0),s=Array(o);++i0){if(++e>=uCe)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var pCe=hCe,mCe=lCe,gCe=pCe,vCe=gCe(mCe),yCe=vCe,xCe=ih,bCe=tCe,wCe=yCe;function SCe(t,e){return wCe(bCe(t,e,xCe),t+"")}var CCe=SCe,_Ce=XN,ACe=kg,jCe=pP,ECe=fl;function TCe(t,e,n){if(!ECe(n))return!1;var r=typeof e;return(r=="number"?ACe(n)&&jCe(e,n.length):r=="string"&&e in n)?_Ce(n[e],t):!1}var Pw=TCe,NCe=PV,PCe=QSe,kCe=CCe,A2=Pw,OCe=kCe(function(t,e){if(t==null)return[];var n=e.length;return n>1&&A2(t,e[0],e[1])?e=[]:n>2&&A2(e[0],e[1],e[2])&&(e=[e[0]]),PCe(t,NCe(e,1),[])}),ICe=OCe;const yP=dn(ICe);function Cm(t){"@babel/helpers - typeof";return Cm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cm(t)}function n1(){return n1=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=e.x),"".concat(Nh,"-left"),Ae(n)&&e&&Ae(e.x)&&n=e.y),"".concat(Nh,"-top"),Ae(r)&&e&&Ae(e.y)&&rm?Math.max(d,l[r]):Math.max(f,l[r])}function qCe(t){var e=t.translateX,n=t.translateY,r=t.useTranslate3d;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function YCe(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTopLeft,i=t.position,o=t.reverseDirection,s=t.tooltipBox,c=t.useTranslate3d,l=t.viewBox,u,d,f;return s.height>0&&s.width>0&&n?(d=T2({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=T2({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=qCe({translateX:d,translateY:f,useTranslate3d:c})):u=KCe,{cssProperties:u,cssClasses:WCe({translateX:d,translateY:f,coordinate:n})}}function af(t){"@babel/helpers - typeof";return af=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},af(t)}function N2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function P2(t){for(var e=1;ek2||Math.abs(r.height-this.state.lastBoundingBox.height)>k2)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,i=this.props,o=i.active,s=i.allowEscapeViewBox,c=i.animationDuration,l=i.animationEasing,u=i.children,d=i.coordinate,f=i.hasPayload,h=i.isAnimationActive,p=i.offset,g=i.position,m=i.reverseDirection,y=i.useTranslate3d,b=i.viewBox,x=i.wrapperStyle,w=YCe({allowEscapeViewBox:s,coordinate:d,offsetTopLeft:p,position:g,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:y,viewBox:b}),S=w.cssClasses,C=w.cssProperties,_=P2(P2({transition:h&&o?"transform ".concat(c,"ms ").concat(l):void 0},C),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&f?"visible":"hidden",position:"absolute",top:0,left:0},x);return N.createElement("div",{tabIndex:-1,className:S,style:_,ref:function(j){r.wrapperNode=j}},u)}}])}(v.PureComponent),o_e=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},ns={isSsr:o_e(),get:function(e){return ns[e]},set:function(e,n){if(typeof e=="string")ns[e]=n;else{var r=Object.keys(e);r&&r.length&&r.forEach(function(i){ns[i]=e[i]})}}};function cf(t){"@babel/helpers - typeof";return cf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cf(t)}function O2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function I2(t){for(var e=1;e0;return N.createElement(i_e,{allowEscapeViewBox:s,animationDuration:c,animationEasing:l,isAnimationActive:h,active:o,coordinate:d,hasPayload:_,offset:p,position:y,reverseDirection:b,useTranslate3d:x,viewBox:w,wrapperStyle:S},m_e(u,I2(I2({},this.props),{},{payload:C})))}}])}(v.PureComponent);xP(ei,"displayName","Tooltip");xP(ei,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!ns.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var g_e=Zs,v_e=function(){return g_e.Date.now()},y_e=v_e,x_e=/\s/;function b_e(t){for(var e=t.length;e--&&x_e.test(t.charAt(e)););return e}var w_e=b_e,S_e=w_e,C_e=/^\s+/;function __e(t){return t&&t.slice(0,S_e(t)+1).replace(C_e,"")}var A_e=__e,j_e=A_e,R2=fl,E_e=Yf,M2=NaN,T_e=/^[-+]0x[0-9a-f]+$/i,N_e=/^0b[01]+$/i,P_e=/^0o[0-7]+$/i,k_e=parseInt;function O_e(t){if(typeof t=="number")return t;if(E_e(t))return M2;if(R2(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=R2(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=j_e(t);var n=N_e.test(t);return n||P_e.test(t)?k_e(t.slice(2),n?2:8):T_e.test(t)?M2:+t}var LV=O_e,I_e=fl,fC=y_e,D2=LV,R_e="Expected a function",M_e=Math.max,D_e=Math.min;function $_e(t,e,n){var r,i,o,s,c,l,u=0,d=!1,f=!1,h=!0;if(typeof t!="function")throw new TypeError(R_e);e=D2(e)||0,I_e(n)&&(d=!!n.leading,f="maxWait"in n,o=f?M_e(D2(n.maxWait)||0,e):o,h="trailing"in n?!!n.trailing:h);function p(_){var A=r,j=i;return r=i=void 0,u=_,s=t.apply(j,A),s}function g(_){return u=_,c=setTimeout(b,e),d?p(_):s}function m(_){var A=_-l,j=_-u,P=e-A;return f?D_e(P,o-j):P}function y(_){var A=_-l,j=_-u;return l===void 0||A>=e||A<0||f&&j>=o}function b(){var _=fC();if(y(_))return x(_);c=setTimeout(b,m(_))}function x(_){return c=void 0,h&&r?p(_):(r=i=void 0,s)}function w(){c!==void 0&&clearTimeout(c),u=0,r=l=i=c=void 0}function S(){return c===void 0?s:x(fC())}function C(){var _=fC(),A=y(_);if(r=arguments,i=this,l=_,A){if(c===void 0)return g(l);if(f)return clearTimeout(c),c=setTimeout(b,e),p(l)}return c===void 0&&(c=setTimeout(b,e)),s}return C.cancel=w,C.flush=S,C}var L_e=$_e,F_e=L_e,B_e=fl,U_e="Expected a function";function H_e(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError(U_e);return B_e(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),F_e(t,e,{leading:r,maxWait:e,trailing:i})}var z_e=H_e;const FV=dn(z_e);function Am(t){"@babel/helpers - typeof";return Am=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Am(t)}function $2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Cv(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&(I=FV(I,m,{trailing:!0,leading:!1}));var D=new ResizeObserver(I),z=C.current.getBoundingClientRect(),$=z.width,G=z.height;return O($,G),D.observe(C.current),function(){D.disconnect()}},[O,m]);var E=v.useMemo(function(){var I=P.containerWidth,D=P.containerHeight;if(I<0||D<0)return null;ts($l(s)||$l(l),`The width(%s) and height(%s) are both fixed numbers, - maybe you don't need to use a ResponsiveContainer.`,s,l),ts(!n||n>0,"The aspect(%s) must be greater than zero.",n);var z=$l(s)?I:s,$=$l(l)?D:l;n&&n>0&&(z?$=z/n:$&&(z=$*n),h&&$>h&&($=h)),ts(z>0||$>0,`The width(%s) and height(%s) of chart should be greater than 0, - please check the style of container, or the props width(%s) and height(%s), - or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the - height and width.`,z,$,s,l,d,f,n);var G=!Array.isArray(p)&&ja(p.type).endsWith("Chart");return N.Children.map(p,function(R){return MG.isElement(R)?v.cloneElement(R,Cv({width:z,height:$},G?{style:Cv({height:"100%",width:"100%",maxHeight:$,maxWidth:z},R.props.style)}:{})):R})},[n,p,l,h,f,d,P,s]);return N.createElement("div",{id:y?"".concat(y):void 0,className:Mt("recharts-responsive-container",b),style:Cv(Cv({},S),{},{width:s,height:l,minWidth:d,minHeight:f,maxHeight:h}),ref:C},E)}),Og=function(e){return null};Og.displayName="Cell";function jm(t){"@babel/helpers - typeof";return jm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jm(t)}function F2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function s1(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||ns.isSsr)return{width:0,height:0};var r=rAe(n),i=JSON.stringify({text:e,copyStyle:r});if(zu.widthCache[i])return zu.widthCache[i];try{var o=document.getElementById(B2);o||(o=document.createElement("span"),o.setAttribute("id",B2),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var s=s1(s1({},nAe),r);Object.assign(o.style,s),o.textContent="".concat(e);var c=o.getBoundingClientRect(),l={width:c.width,height:c.height};return zu.widthCache[i]=l,++zu.cacheCount>tAe&&(zu.cacheCount=0,zu.widthCache={}),l}catch{return{width:0,height:0}}},iAe=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function Em(t){"@babel/helpers - typeof";return Em=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Em(t)}function rb(t,e){return cAe(t)||aAe(t,e)||sAe(t,e)||oAe()}function oAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sAe(t,e){if(t){if(typeof t=="string")return U2(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return U2(t,e)}}function U2(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function SAe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function W2(t,e){return jAe(t)||AAe(t,e)||_Ae(t,e)||CAe()}function CAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _Ae(t,e){if(t){if(typeof t=="string")return q2(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return q2(t,e)}}function q2(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[];return z.reduce(function($,G){var R=G.word,L=G.width,W=$[$.length-1];if(W&&(i==null||o||W.width+L+rG.width?$:G})};if(!d)return p;for(var m="…",y=function(z){var $=f.slice(0,z),G=zV({breakAll:u,style:l,children:$+m}).wordsWithComputedWidth,R=h(G),L=R.length>s||g(R).width>Number(i);return[L,R]},b=0,x=f.length-1,w=0,S;b<=x&&w<=f.length-1;){var C=Math.floor((b+x)/2),_=C-1,A=y(_),j=W2(A,2),P=j[0],k=j[1],O=y(C),E=W2(O,1),I=E[0];if(!P&&!I&&(b=C+1),P&&I&&(x=C-1),!P&&I){S=k;break}w++}return S||p},Y2=function(e){var n=Dt(e)?[]:e.toString().split(HV);return[{words:n}]},TAe=function(e){var n=e.width,r=e.scaleToFit,i=e.children,o=e.style,s=e.breakAll,c=e.maxLines;if((n||r)&&!ns.isSsr){var l,u,d=zV({breakAll:s,children:i,style:o});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;l=f,u=h}else return Y2(i);return EAe({breakAll:s,children:i,maxLines:c,style:o},l,u,n,r)}return Y2(i)},Q2="#808080",wu=function(e){var n=e.x,r=n===void 0?0:n,i=e.y,o=i===void 0?0:i,s=e.lineHeight,c=s===void 0?"1em":s,l=e.capHeight,u=l===void 0?"0.71em":l,d=e.scaleToFit,f=d===void 0?!1:d,h=e.textAnchor,p=h===void 0?"start":h,g=e.verticalAnchor,m=g===void 0?"end":g,y=e.fill,b=y===void 0?Q2:y,x=K2(e,bAe),w=v.useMemo(function(){return TAe({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:f,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,f,x.style,x.width]),S=x.dx,C=x.dy,_=x.angle,A=x.className,j=x.breakAll,P=K2(x,wAe);if(!Er(r)||!Er(o))return null;var k=r+(Ae(S)?S:0),O=o+(Ae(C)?C:0),E;switch(m){case"start":E=hC("calc(".concat(u,")"));break;case"middle":E=hC("calc(".concat((w.length-1)/2," * -").concat(c," + (").concat(u," / 2))"));break;default:E=hC("calc(".concat(w.length-1," * -").concat(c,")"));break}var I=[];if(f){var D=w[0].width,z=x.width;I.push("scale(".concat((Ae(z)?z/D:1)/D,")"))}return _&&I.push("rotate(".concat(_,", ").concat(k,", ").concat(O,")")),I.length&&(P.transform=I.join(" ")),N.createElement("text",a1({},rt(P,!0),{x:k,y:O,className:Mt("recharts-text",A),textAnchor:p,fill:b.includes("url")?Q2:b}),w.map(function($,G){var R=$.words.join(j?"":" ");return N.createElement("tspan",{x:k,dy:G===0?E:c,key:"".concat(R,"-").concat(G)},R)}))};function zc(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function NAe(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function bP(t){let e,n,r;t.length!==2?(e=zc,n=(c,l)=>zc(t(c),l),r=(c,l)=>t(c)-l):(e=t===zc||t===NAe?t:PAe,n=t,r=t);function i(c,l,u=0,d=c.length){if(u>>1;n(c[f],l)<0?u=f+1:d=f}while(u>>1;n(c[f],l)<=0?u=f+1:d=f}while(uu&&r(c[f-1],l)>-r(c[f],l)?f-1:f}return{left:i,center:s,right:o}}function PAe(){return 0}function GV(t){return t===null?NaN:+t}function*kAe(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const OAe=bP(zc),Ig=OAe.right;bP(GV).center;class X2 extends Map{constructor(e,n=MAe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,i]of e)this.set(r,i)}get(e){return super.get(J2(this,e))}has(e){return super.has(J2(this,e))}set(e,n){return super.set(IAe(this,e),n)}delete(e){return super.delete(RAe(this,e))}}function J2({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function IAe({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function RAe({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function MAe(t){return t!==null&&typeof t=="object"?t.valueOf():t}function DAe(t=zc){if(t===zc)return VV;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function VV(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const $Ae=Math.sqrt(50),LAe=Math.sqrt(10),FAe=Math.sqrt(2);function ib(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=$Ae?10:o>=LAe?5:o>=FAe?2:1;let c,l,u;return i<0?(u=Math.pow(10,-i)/s,c=Math.round(t*u),l=Math.round(e*u),c/ue&&--l,u=-u):(u=Math.pow(10,i)*s,c=Math.round(t/u),l=Math.round(e/u),c*ue&&--l),l0))return[];if(t===e)return[t];const r=e=i))return[];const c=o-i+1,l=new Array(c);if(r)if(s<0)for(let u=0;u=r)&&(n=r);return n}function eM(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function KV(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=i===void 0?VV:DAe(i);r>n;){if(r-n>600){const l=r-n+1,u=e-n+1,d=Math.log(l),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(l-f)/l)*(u-l/2<0?-1:1),p=Math.max(n,Math.floor(e-u*f/l+h)),g=Math.min(r,Math.floor(e+(l-u)*f/l+h));KV(t,e,p,g,i)}const o=t[e];let s=n,c=r;for(Ph(t,n,e),i(t[r],o)>0&&Ph(t,n,r);s0;)--c}i(t[n],o)===0?Ph(t,n,c):(++c,Ph(t,c,r)),c<=e&&(n=c+1),e<=c&&(r=c-1)}return t}function Ph(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function BAe(t,e,n){if(t=Float64Array.from(kAe(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return eM(t);if(e>=1)return Z2(t);var r,i=(r-1)*e,o=Math.floor(i),s=Z2(KV(t,o).subarray(0,o+1)),c=eM(t.subarray(o+1));return s+(c-s)*(i-o)}}function UAe(t,e,n=GV){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,o=Math.floor(i),s=+n(t[o],o,t),c=+n(t[o+1],o+1,t);return s+(c-s)*(i-o)}}function HAe(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(i);++r>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Av(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Av(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=GAe.exec(t))?new Pi(e[1],e[2],e[3],1):(e=VAe.exec(t))?new Pi(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=KAe.exec(t))?Av(e[1],e[2],e[3],e[4]):(e=WAe.exec(t))?Av(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=qAe.exec(t))?aM(e[1],e[2]/100,e[3]/100,1):(e=YAe.exec(t))?aM(e[1],e[2]/100,e[3]/100,e[4]):tM.hasOwnProperty(t)?iM(tM[t]):t==="transparent"?new Pi(NaN,NaN,NaN,0):null}function iM(t){return new Pi(t>>16&255,t>>8&255,t&255,1)}function Av(t,e,n,r){return r<=0&&(t=e=n=NaN),new Pi(t,e,n,r)}function JAe(t){return t instanceof Rg||(t=km(t)),t?(t=t.rgb(),new Pi(t.r,t.g,t.b,t.opacity)):new Pi}function f1(t,e,n,r){return arguments.length===1?JAe(t):new Pi(t,e,n,r??1)}function Pi(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}SP(Pi,f1,qV(Rg,{brighter(t){return t=t==null?ob:Math.pow(ob,t),new Pi(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Nm:Math.pow(Nm,t),new Pi(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Pi(Jl(this.r),Jl(this.g),Jl(this.b),sb(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:oM,formatHex:oM,formatHex8:ZAe,formatRgb:sM,toString:sM}));function oM(){return`#${Ll(this.r)}${Ll(this.g)}${Ll(this.b)}`}function ZAe(){return`#${Ll(this.r)}${Ll(this.g)}${Ll(this.b)}${Ll((isNaN(this.opacity)?1:this.opacity)*255)}`}function sM(){const t=sb(this.opacity);return`${t===1?"rgb(":"rgba("}${Jl(this.r)}, ${Jl(this.g)}, ${Jl(this.b)}${t===1?")":`, ${t})`}`}function sb(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Jl(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ll(t){return t=Jl(t),(t<16?"0":"")+t.toString(16)}function aM(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ko(t,e,n,r)}function YV(t){if(t instanceof Ko)return new Ko(t.h,t.s,t.l,t.opacity);if(t instanceof Rg||(t=km(t)),!t)return new Ko;if(t instanceof Ko)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),s=NaN,c=o-i,l=(o+i)/2;return c?(e===o?s=(n-r)/c+(n0&&l<1?0:s,new Ko(s,c,l,t.opacity)}function e1e(t,e,n,r){return arguments.length===1?YV(t):new Ko(t,e,n,r??1)}function Ko(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}SP(Ko,e1e,qV(Rg,{brighter(t){return t=t==null?ob:Math.pow(ob,t),new Ko(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Nm:Math.pow(Nm,t),new Ko(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Pi(pC(t>=240?t-240:t+120,i,r),pC(t,i,r),pC(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Ko(cM(this.h),jv(this.s),jv(this.l),sb(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=sb(this.opacity);return`${t===1?"hsl(":"hsla("}${cM(this.h)}, ${jv(this.s)*100}%, ${jv(this.l)*100}%${t===1?")":`, ${t})`}`}}));function cM(t){return t=(t||0)%360,t<0?t+360:t}function jv(t){return Math.max(0,Math.min(1,t||0))}function pC(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const CP=t=>()=>t;function t1e(t,e){return function(n){return t+n*e}}function n1e(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function r1e(t){return(t=+t)==1?QV:function(e,n){return n-e?n1e(e,n,t):CP(isNaN(e)?n:e)}}function QV(t,e){var n=e-t;return n?t1e(t,n):CP(isNaN(t)?e:t)}const lM=function t(e){var n=r1e(e);function r(i,o){var s=n((i=f1(i)).r,(o=f1(o)).r),c=n(i.g,o.g),l=n(i.b,o.b),u=QV(i.opacity,o.opacity);return function(d){return i.r=s(d),i.g=c(d),i.b=l(d),i.opacity=u(d),i+""}}return r.gamma=t,r}(1);function i1e(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(o){for(i=0;in&&(o=e.slice(n,o),c[s]?c[s]+=o:c[++s]=o),(r=r[0])===(i=i[0])?c[s]?c[s]+=i:c[++s]=i:(c[++s]=null,l.push({i:s,x:ab(r,i)})),n=mC.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function m1e(t,e,n){var r=t[0],i=t[1],o=e[0],s=e[1];return i2?g1e:m1e,l=u=null,f}function f(h){return h==null||isNaN(h=+h)?o:(l||(l=c(t.map(r),e,n)))(r(s(h)))}return f.invert=function(h){return s(i((u||(u=c(e,t.map(r),ab)))(h)))},f.domain=function(h){return arguments.length?(t=Array.from(h,cb),d()):t.slice()},f.range=function(h){return arguments.length?(e=Array.from(h),d()):e.slice()},f.rangeRound=function(h){return e=Array.from(h),n=_P,d()},f.clamp=function(h){return arguments.length?(s=h?!0:vi,d()):s!==vi},f.interpolate=function(h){return arguments.length?(n=h,d()):n},f.unknown=function(h){return arguments.length?(o=h,f):o},function(h,p){return r=h,i=p,d()}}function AP(){return kw()(vi,vi)}function v1e(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function lb(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function lf(t){return t=lb(Math.abs(t)),t?t[1]:NaN}function y1e(t,e){return function(n,r){for(var i=n.length,o=[],s=0,c=t[0],l=0;i>0&&c>0&&(l+c+1>r&&(c=Math.max(1,r-l)),o.push(n.substring(i-=c,i+c)),!((l+=c+1)>r));)c=t[s=(s+1)%t.length];return o.reverse().join(e)}}function x1e(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var b1e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Om(t){if(!(e=b1e.exec(t)))throw new Error("invalid format: "+t);var e;return new jP({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Om.prototype=jP.prototype;function jP(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}jP.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function w1e(t){e:for(var e=t.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var XV;function S1e(t,e){var n=lb(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(XV=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+lb(t,Math.max(0,e+o-1))[0]}function dM(t,e){var n=lb(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const fM={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:v1e,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>dM(t*100,e),r:dM,s:S1e,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function hM(t){return t}var pM=Array.prototype.map,mM=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function C1e(t){var e=t.grouping===void 0||t.thousands===void 0?hM:y1e(pM.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?hM:x1e(pM.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",c=t.minus===void 0?"āˆ’":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function u(f){f=Om(f);var h=f.fill,p=f.align,g=f.sign,m=f.symbol,y=f.zero,b=f.width,x=f.comma,w=f.precision,S=f.trim,C=f.type;C==="n"?(x=!0,C="g"):fM[C]||(w===void 0&&(w=12),S=!0,C="g"),(y||h==="0"&&p==="=")&&(y=!0,h="0",p="=");var _=m==="$"?n:m==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():"",A=m==="$"?r:/[%p]/.test(C)?s:"",j=fM[C],P=/[defgprs%]/.test(C);w=w===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function k(O){var E=_,I=A,D,z,$;if(C==="c")I=j(O)+I,O="";else{O=+O;var G=O<0||1/O<0;if(O=isNaN(O)?l:j(Math.abs(O),w),S&&(O=w1e(O)),G&&+O==0&&g!=="+"&&(G=!1),E=(G?g==="("?g:c:g==="-"||g==="("?"":g)+E,I=(C==="s"?mM[8+XV/3]:"")+I+(G&&g==="("?")":""),P){for(D=-1,z=O.length;++D$||$>57){I=($===46?i+O.slice(D+1):O.slice(D))+I,O=O.slice(0,D);break}}}x&&!y&&(O=e(O,1/0));var R=E.length+O.length+I.length,L=R>1)+E+O+I+L.slice(R);break;default:O=L+E+O+I;break}return o(O)}return k.toString=function(){return f+""},k}function d(f,h){var p=u((f=Om(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(lf(h)/3)))*3,m=Math.pow(10,-g),y=mM[8+g/3];return function(b){return p(m*b)+y}}return{format:u,formatPrefix:d}}var Ev,EP,JV;_1e({thousands:",",grouping:[3],currency:["$",""]});function _1e(t){return Ev=C1e(t),EP=Ev.format,JV=Ev.formatPrefix,Ev}function A1e(t){return Math.max(0,-lf(Math.abs(t)))}function j1e(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(lf(e)/3)))*3-lf(Math.abs(t)))}function E1e(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,lf(e)-lf(t))+1}function ZV(t,e,n,r){var i=u1(t,e,n),o;switch(r=Om(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(o=j1e(i,s))&&(r.precision=o),JV(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=E1e(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=A1e(i))&&(r.precision=o-(r.type==="%")*2);break}}return EP(r)}function hl(t){var e=t.domain;return t.ticks=function(n){var r=e();return c1(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return ZV(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,o=r.length-1,s=r[i],c=r[o],l,u,d=10;for(c0;){if(u=l1(s,c,n),u===l)return r[i]=s,r[o]=c,e(r);if(u>0)s=Math.floor(s/u)*u,c=Math.ceil(c/u)*u;else if(u<0)s=Math.ceil(s*u)/u,c=Math.floor(c*u)/u;else break;l=u}return t},t}function ub(){var t=AP();return t.copy=function(){return Mg(t,ub())},Oo.apply(t,arguments),hl(t)}function e8(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,cb),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return e8(t).unknown(e)},t=arguments.length?Array.from(t,cb):[0,1],hl(n)}function t8(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],o=t[r],s;return oMath.pow(t,e)}function O1e(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function yM(t){return(e,n)=>-t(-e,n)}function TP(t){const e=t(gM,vM),n=e.domain;let r=10,i,o;function s(){return i=O1e(r),o=k1e(r),n()[0]<0?(i=yM(i),o=yM(o),t(T1e,N1e)):t(gM,vM),e}return e.base=function(c){return arguments.length?(r=+c,s()):r},e.domain=function(c){return arguments.length?(n(c),s()):n()},e.ticks=c=>{const l=n();let u=l[0],d=l[l.length-1];const f=d0){for(;h<=p;++h)for(g=1;gd)break;b.push(m)}}else for(;h<=p;++h)for(g=r-1;g>=1;--g)if(m=h>0?g/o(-h):g*o(h),!(md)break;b.push(m)}b.length*2{if(c==null&&(c=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=Om(l)).precision==null&&(l.trim=!0),l=EP(l)),c===1/0)return l;const u=Math.max(1,r*c/e.ticks().length);return d=>{let f=d/o(Math.round(i(d)));return f*rn(t8(n(),{floor:c=>o(Math.floor(i(c))),ceil:c=>o(Math.ceil(i(c)))})),e}function n8(){const t=TP(kw()).domain([1,10]);return t.copy=()=>Mg(t,n8()).base(t.base()),Oo.apply(t,arguments),t}function xM(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function bM(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function NP(t){var e=1,n=t(xM(e),bM(e));return n.constant=function(r){return arguments.length?t(xM(e=+r),bM(e)):e},hl(n)}function r8(){var t=NP(kw());return t.copy=function(){return Mg(t,r8()).constant(t.constant())},Oo.apply(t,arguments)}function wM(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function I1e(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function R1e(t){return t<0?-t*t:t*t}function PP(t){var e=t(vi,vi),n=1;function r(){return n===1?t(vi,vi):n===.5?t(I1e,R1e):t(wM(n),wM(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},hl(e)}function kP(){var t=PP(kw());return t.copy=function(){return Mg(t,kP()).exponent(t.exponent())},Oo.apply(t,arguments),t}function M1e(){return kP.apply(null,arguments).exponent(.5)}function SM(t){return Math.sign(t)*t*t}function D1e(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function i8(){var t=AP(),e=[0,1],n=!1,r;function i(o){var s=D1e(t(o));return isNaN(s)?r:n?Math.round(s):s}return i.invert=function(o){return t.invert(SM(o))},i.domain=function(o){return arguments.length?(t.domain(o),i):t.domain()},i.range=function(o){return arguments.length?(t.range((e=Array.from(o,cb)).map(SM)),i):e.slice()},i.rangeRound=function(o){return i.range(o).round(!0)},i.round=function(o){return arguments.length?(n=!!o,i):n},i.clamp=function(o){return arguments.length?(t.clamp(o),i):t.clamp()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return i8(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},Oo.apply(i,arguments),hl(i)}function o8(){var t=[],e=[],n=[],r;function i(){var s=0,c=Math.max(1,e.length);for(n=new Array(c-1);++s0?n[c-1]:t[0],c=n?[r[n-1],e]:[r[u-1],r[u]]},s.unknown=function(l){return arguments.length&&(o=l),s},s.thresholds=function(){return r.slice()},s.copy=function(){return s8().domain([t,e]).range(i).unknown(o)},Oo.apply(hl(s),arguments)}function a8(){var t=[.5],e=[0,1],n,r=1;function i(o){return o!=null&&o<=o?e[Ig(t,o,0,r)]:n}return i.domain=function(o){return arguments.length?(t=Array.from(o),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(o){return arguments.length?(e=Array.from(o),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(o){var s=e.indexOf(o);return[t[s-1],t[s]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return a8().domain(t).range(e).unknown(n)},Oo.apply(i,arguments)}const gC=new Date,vC=new Date;function Tr(t,e,n,r){function i(o){return t(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(t(o=new Date(+o)),o),i.ceil=o=>(t(o=new Date(o-1)),e(o,1),t(o),o),i.round=o=>{const s=i(o),c=i.ceil(o);return o-s(e(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,c)=>{const l=[];if(o=i.ceil(o),c=c==null?1:Math.floor(c),!(o0))return l;let u;do l.push(u=new Date(+o)),e(o,c),t(o);while(uTr(s=>{if(s>=s)for(;t(s),!o(s);)s.setTime(s-1)},(s,c)=>{if(s>=s)if(c<0)for(;++c<=0;)for(;e(s,-1),!o(s););else for(;--c>=0;)for(;e(s,1),!o(s););}),n&&(i.count=(o,s)=>(gC.setTime(+o),vC.setTime(+s),t(gC),t(vC),Math.floor(n(gC,vC))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?s=>r(s)%o===0:s=>i.count(0,s)%o===0):i)),i}const db=Tr(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);db.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Tr(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):db);db.range;const wa=1e3,Co=wa*60,Sa=Co*60,Fa=Sa*24,OP=Fa*7,CM=Fa*30,yC=Fa*365,Fl=Tr(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*wa)},(t,e)=>(e-t)/wa,t=>t.getUTCSeconds());Fl.range;const IP=Tr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*wa)},(t,e)=>{t.setTime(+t+e*Co)},(t,e)=>(e-t)/Co,t=>t.getMinutes());IP.range;const RP=Tr(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Co)},(t,e)=>(e-t)/Co,t=>t.getUTCMinutes());RP.range;const MP=Tr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*wa-t.getMinutes()*Co)},(t,e)=>{t.setTime(+t+e*Sa)},(t,e)=>(e-t)/Sa,t=>t.getHours());MP.range;const DP=Tr(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Sa)},(t,e)=>(e-t)/Sa,t=>t.getUTCHours());DP.range;const Dg=Tr(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Co)/Fa,t=>t.getDate()-1);Dg.range;const Ow=Tr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Fa,t=>t.getUTCDate()-1);Ow.range;const c8=Tr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Fa,t=>Math.floor(t/Fa));c8.range;function Iu(t){return Tr(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Co)/OP)}const Iw=Iu(0),fb=Iu(1),$1e=Iu(2),L1e=Iu(3),uf=Iu(4),F1e=Iu(5),B1e=Iu(6);Iw.range;fb.range;$1e.range;L1e.range;uf.range;F1e.range;B1e.range;function Ru(t){return Tr(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/OP)}const Rw=Ru(0),hb=Ru(1),U1e=Ru(2),H1e=Ru(3),df=Ru(4),z1e=Ru(5),G1e=Ru(6);Rw.range;hb.range;U1e.range;H1e.range;df.range;z1e.range;G1e.range;const $P=Tr(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());$P.range;const LP=Tr(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());LP.range;const Ba=Tr(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Ba.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Tr(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Ba.range;const Ua=Tr(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Ua.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Tr(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Ua.range;function l8(t,e,n,r,i,o){const s=[[Fl,1,wa],[Fl,5,5*wa],[Fl,15,15*wa],[Fl,30,30*wa],[o,1,Co],[o,5,5*Co],[o,15,15*Co],[o,30,30*Co],[i,1,Sa],[i,3,3*Sa],[i,6,6*Sa],[i,12,12*Sa],[r,1,Fa],[r,2,2*Fa],[n,1,OP],[e,1,CM],[e,3,3*CM],[t,1,yC]];function c(u,d,f){const h=dy).right(s,h);if(p===s.length)return t.every(u1(u/yC,d/yC,f));if(p===0)return db.every(Math.max(u1(u,d,f),1));const[g,m]=s[h/s[p-1][2]53)return null;"w"in Z||(Z.w=1),"Z"in Z?(Le=bC(kh(Z.y,0,1)),At=Le.getUTCDay(),Le=At>4||At===0?hb.ceil(Le):hb(Le),Le=Ow.offset(Le,(Z.V-1)*7),Z.y=Le.getUTCFullYear(),Z.m=Le.getUTCMonth(),Z.d=Le.getUTCDate()+(Z.w+6)%7):(Le=xC(kh(Z.y,0,1)),At=Le.getDay(),Le=At>4||At===0?fb.ceil(Le):fb(Le),Le=Dg.offset(Le,(Z.V-1)*7),Z.y=Le.getFullYear(),Z.m=Le.getMonth(),Z.d=Le.getDate()+(Z.w+6)%7)}else("W"in Z||"U"in Z)&&("w"in Z||(Z.w="u"in Z?Z.u%7:"W"in Z?1:0),At="Z"in Z?bC(kh(Z.y,0,1)).getUTCDay():xC(kh(Z.y,0,1)).getDay(),Z.m=0,Z.d="W"in Z?(Z.w+6)%7+Z.W*7-(At+5)%7:Z.w+Z.U*7-(At+6)%7);return"Z"in Z?(Z.H+=Z.Z/100|0,Z.M+=Z.Z%100,bC(Z)):xC(Z)}}function j(de,ye,Ee,Z){for(var ct=0,Le=ye.length,At=Ee.length,lt,Jt;ct=At)return-1;if(lt=ye.charCodeAt(ct++),lt===37){if(lt=ye.charAt(ct++),Jt=C[lt in _M?ye.charAt(ct++):lt],!Jt||(Z=Jt(de,Ee,Z))<0)return-1}else if(lt!=Ee.charCodeAt(Z++))return-1}return Z}function P(de,ye,Ee){var Z=u.exec(ye.slice(Ee));return Z?(de.p=d.get(Z[0].toLowerCase()),Ee+Z[0].length):-1}function k(de,ye,Ee){var Z=p.exec(ye.slice(Ee));return Z?(de.w=g.get(Z[0].toLowerCase()),Ee+Z[0].length):-1}function O(de,ye,Ee){var Z=f.exec(ye.slice(Ee));return Z?(de.w=h.get(Z[0].toLowerCase()),Ee+Z[0].length):-1}function E(de,ye,Ee){var Z=b.exec(ye.slice(Ee));return Z?(de.m=x.get(Z[0].toLowerCase()),Ee+Z[0].length):-1}function I(de,ye,Ee){var Z=m.exec(ye.slice(Ee));return Z?(de.m=y.get(Z[0].toLowerCase()),Ee+Z[0].length):-1}function D(de,ye,Ee){return j(de,e,ye,Ee)}function z(de,ye,Ee){return j(de,n,ye,Ee)}function $(de,ye,Ee){return j(de,r,ye,Ee)}function G(de){return s[de.getDay()]}function R(de){return o[de.getDay()]}function L(de){return l[de.getMonth()]}function W(de){return c[de.getMonth()]}function Y(de){return i[+(de.getHours()>=12)]}function te(de){return 1+~~(de.getMonth()/3)}function me(de){return s[de.getUTCDay()]}function F(de){return o[de.getUTCDay()]}function se(de){return l[de.getUTCMonth()]}function ne(de){return c[de.getUTCMonth()]}function ae(de){return i[+(de.getUTCHours()>=12)]}function De(de){return 1+~~(de.getUTCMonth()/3)}return{format:function(de){var ye=_(de+="",w);return ye.toString=function(){return de},ye},parse:function(de){var ye=A(de+="",!1);return ye.toString=function(){return de},ye},utcFormat:function(de){var ye=_(de+="",S);return ye.toString=function(){return de},ye},utcParse:function(de){var ye=A(de+="",!0);return ye.toString=function(){return de},ye}}}var _M={"-":"",_:" ",0:"0"},$r=/^\s*\d+/,Q1e=/^%/,X1e=/[\\^$*+?|[\]().{}]/g;function cn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[e.toLowerCase(),n]))}function Z1e(t,e,n){var r=$r.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function eje(t,e,n){var r=$r.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function tje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function nje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function rje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function AM(t,e,n){var r=$r.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function jM(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function ije(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function oje(t,e,n){var r=$r.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function sje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function EM(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function aje(t,e,n){var r=$r.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function TM(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function cje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function lje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function uje(t,e,n){var r=$r.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function dje(t,e,n){var r=$r.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function fje(t,e,n){var r=Q1e.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function hje(t,e,n){var r=$r.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function pje(t,e,n){var r=$r.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function NM(t,e){return cn(t.getDate(),e,2)}function mje(t,e){return cn(t.getHours(),e,2)}function gje(t,e){return cn(t.getHours()%12||12,e,2)}function vje(t,e){return cn(1+Dg.count(Ba(t),t),e,3)}function u8(t,e){return cn(t.getMilliseconds(),e,3)}function yje(t,e){return u8(t,e)+"000"}function xje(t,e){return cn(t.getMonth()+1,e,2)}function bje(t,e){return cn(t.getMinutes(),e,2)}function wje(t,e){return cn(t.getSeconds(),e,2)}function Sje(t){var e=t.getDay();return e===0?7:e}function Cje(t,e){return cn(Iw.count(Ba(t)-1,t),e,2)}function d8(t){var e=t.getDay();return e>=4||e===0?uf(t):uf.ceil(t)}function _je(t,e){return t=d8(t),cn(uf.count(Ba(t),t)+(Ba(t).getDay()===4),e,2)}function Aje(t){return t.getDay()}function jje(t,e){return cn(fb.count(Ba(t)-1,t),e,2)}function Eje(t,e){return cn(t.getFullYear()%100,e,2)}function Tje(t,e){return t=d8(t),cn(t.getFullYear()%100,e,2)}function Nje(t,e){return cn(t.getFullYear()%1e4,e,4)}function Pje(t,e){var n=t.getDay();return t=n>=4||n===0?uf(t):uf.ceil(t),cn(t.getFullYear()%1e4,e,4)}function kje(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+cn(e/60|0,"0",2)+cn(e%60,"0",2)}function PM(t,e){return cn(t.getUTCDate(),e,2)}function Oje(t,e){return cn(t.getUTCHours(),e,2)}function Ije(t,e){return cn(t.getUTCHours()%12||12,e,2)}function Rje(t,e){return cn(1+Ow.count(Ua(t),t),e,3)}function f8(t,e){return cn(t.getUTCMilliseconds(),e,3)}function Mje(t,e){return f8(t,e)+"000"}function Dje(t,e){return cn(t.getUTCMonth()+1,e,2)}function $je(t,e){return cn(t.getUTCMinutes(),e,2)}function Lje(t,e){return cn(t.getUTCSeconds(),e,2)}function Fje(t){var e=t.getUTCDay();return e===0?7:e}function Bje(t,e){return cn(Rw.count(Ua(t)-1,t),e,2)}function h8(t){var e=t.getUTCDay();return e>=4||e===0?df(t):df.ceil(t)}function Uje(t,e){return t=h8(t),cn(df.count(Ua(t),t)+(Ua(t).getUTCDay()===4),e,2)}function Hje(t){return t.getUTCDay()}function zje(t,e){return cn(hb.count(Ua(t)-1,t),e,2)}function Gje(t,e){return cn(t.getUTCFullYear()%100,e,2)}function Vje(t,e){return t=h8(t),cn(t.getUTCFullYear()%100,e,2)}function Kje(t,e){return cn(t.getUTCFullYear()%1e4,e,4)}function Wje(t,e){var n=t.getUTCDay();return t=n>=4||n===0?df(t):df.ceil(t),cn(t.getUTCFullYear()%1e4,e,4)}function qje(){return"+0000"}function kM(){return"%"}function OM(t){return+t}function IM(t){return Math.floor(+t/1e3)}var Gu,p8,m8;Yje({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Yje(t){return Gu=Y1e(t),p8=Gu.format,Gu.parse,m8=Gu.utcFormat,Gu.utcParse,Gu}function Qje(t){return new Date(t)}function Xje(t){return t instanceof Date?+t:+new Date(+t)}function FP(t,e,n,r,i,o,s,c,l,u){var d=AP(),f=d.invert,h=d.domain,p=u(".%L"),g=u(":%S"),m=u("%I:%M"),y=u("%I %p"),b=u("%a %d"),x=u("%b %d"),w=u("%B"),S=u("%Y");function C(_){return(l(_)<_?p:c(_)<_?g:s(_)<_?m:o(_)<_?y:r(_)<_?i(_)<_?b:x:n(_)<_?w:S)(_)}return d.invert=function(_){return new Date(f(_))},d.domain=function(_){return arguments.length?h(Array.from(_,Xje)):h().map(Qje)},d.ticks=function(_){var A=h();return t(A[0],A[A.length-1],_??10)},d.tickFormat=function(_,A){return A==null?C:u(A)},d.nice=function(_){var A=h();return(!_||typeof _.range!="function")&&(_=e(A[0],A[A.length-1],_??10)),_?h(t8(A,_)):d},d.copy=function(){return Mg(d,FP(t,e,n,r,i,o,s,c,l,u))},d}function Jje(){return Oo.apply(FP(W1e,q1e,Ba,$P,Iw,Dg,MP,IP,Fl,p8).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Zje(){return Oo.apply(FP(V1e,K1e,Ua,LP,Rw,Ow,DP,RP,Fl,m8).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Mw(){var t=0,e=1,n,r,i,o,s=vi,c=!1,l;function u(f){return f==null||isNaN(f=+f)?l:s(i===0?.5:(f=(o(f)-n)*i,c?Math.max(0,Math.min(1,f)):f))}u.domain=function(f){return arguments.length?([t,e]=f,n=o(t=+t),r=o(e=+e),i=n===r?0:1/(r-n),u):[t,e]},u.clamp=function(f){return arguments.length?(c=!!f,u):c},u.interpolator=function(f){return arguments.length?(s=f,u):s};function d(f){return function(h){var p,g;return arguments.length?([p,g]=h,s=f(p,g),u):[s(0),s(1)]}}return u.range=d(oh),u.rangeRound=d(_P),u.unknown=function(f){return arguments.length?(l=f,u):l},function(f){return o=f,n=f(t),r=f(e),i=n===r?0:1/(r-n),u}}function pl(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function g8(){var t=hl(Mw()(vi));return t.copy=function(){return pl(t,g8())},Ya.apply(t,arguments)}function v8(){var t=TP(Mw()).domain([1,10]);return t.copy=function(){return pl(t,v8()).base(t.base())},Ya.apply(t,arguments)}function y8(){var t=NP(Mw());return t.copy=function(){return pl(t,y8()).constant(t.constant())},Ya.apply(t,arguments)}function BP(){var t=PP(Mw());return t.copy=function(){return pl(t,BP()).exponent(t.exponent())},Ya.apply(t,arguments)}function eEe(){return BP.apply(null,arguments).exponent(.5)}function x8(){var t=[],e=vi;function n(r){if(r!=null&&!isNaN(r=+r))return e((Ig(t,r,1)-1)/(t.length-1))}return n.domain=function(r){if(!arguments.length)return t.slice();t=[];for(let i of r)i!=null&&!isNaN(i=+i)&&t.push(i);return t.sort(zc),n},n.interpolator=function(r){return arguments.length?(e=r,n):e},n.range=function(){return t.map((r,i)=>e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,o)=>BAe(t,o/r))},n.copy=function(){return x8(e).domain(t)},Ya.apply(n,arguments)}function Dw(){var t=0,e=.5,n=1,r=1,i,o,s,c,l,u=vi,d,f=!1,h;function p(m){return isNaN(m=+m)?h:(m=.5+((m=+d(m))-o)*(r*me}var C8=iEe,oEe=$w,sEe=C8,aEe=ih;function cEe(t){return t&&t.length?oEe(t,aEe,sEe):void 0}var lEe=cEe;const Sc=dn(lEe);function uEe(t,e){return tt.e^o.s<0?1:-1;for(r=o.d.length,i=t.d.length,e=0,n=rt.d[e]^o.s<0?1:-1;return r===i?0:r>i^o.s<0?1:-1};Je.decimalPlaces=Je.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*$n;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Je.dividedBy=Je.div=function(t){return Ta(this,new this.constructor(t))};Je.dividedToIntegerBy=Je.idiv=function(t){var e=this,n=e.constructor;return En(Ta(e,new n(t),0,1),n.precision)};Je.equals=Je.eq=function(t){return!this.cmp(t)};Je.exponent=function(){return pr(this)};Je.greaterThan=Je.gt=function(t){return this.cmp(t)>0};Je.greaterThanOrEqualTo=Je.gte=function(t){return this.cmp(t)>=0};Je.isInteger=Je.isint=function(){return this.e>this.d.length-2};Je.isNegative=Je.isneg=function(){return this.s<0};Je.isPositive=Je.ispos=function(){return this.s>0};Je.isZero=function(){return this.s===0};Je.lessThan=Je.lt=function(t){return this.cmp(t)<0};Je.lessThanOrEqualTo=Je.lte=function(t){return this.cmp(t)<1};Je.logarithm=Je.log=function(t){var e,n=this,r=n.constructor,i=r.precision,o=i+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq(Yi))throw Error(No+"NaN");if(n.s<1)throw Error(No+(n.s?"NaN":"-Infinity"));return n.eq(Yi)?new r(0):(Gn=!1,e=Ta(Im(n,o),Im(t,o),o),Gn=!0,En(e,i))};Je.minus=Je.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?T8(e,t):j8(e,(t.s=-t.s,t))};Je.modulo=Je.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(No+"NaN");return n.s?(Gn=!1,e=Ta(n,t,0,1).times(t),Gn=!0,n.minus(e)):En(new r(n),i)};Je.naturalExponential=Je.exp=function(){return E8(this)};Je.naturalLogarithm=Je.ln=function(){return Im(this)};Je.negated=Je.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Je.plus=Je.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?j8(e,t):T8(e,(t.s=-t.s,t))};Je.precision=Je.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Zl+t);if(e=pr(i)+1,r=i.d.length-1,n=r*$n+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};Je.squareRoot=Je.sqrt=function(){var t,e,n,r,i,o,s,c=this,l=c.constructor;if(c.s<1){if(!c.s)return new l(0);throw Error(No+"NaN")}for(t=pr(c),Gn=!1,i=Math.sqrt(+c),i==0||i==1/0?(e=Os(c.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=ah((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new l(e)):r=new l(i.toString()),n=l.precision,i=s=n+3;;)if(o=r,r=o.plus(Ta(c,o,s+2)).times(.5),Os(o.d).slice(0,s)===(e=Os(r.d)).slice(0,s)){if(e=e.slice(s-3,s+1),i==s&&e=="4999"){if(En(o,n+1,0),o.times(o).eq(c)){r=o;break}}else if(e!="9999")break;s+=4}return Gn=!0,En(r,n)};Je.times=Je.mul=function(t){var e,n,r,i,o,s,c,l,u,d=this,f=d.constructor,h=d.d,p=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,l=h.length,u=p.length,l=0;){for(e=0,i=l+r;i>r;)c=o[i]+p[r]*h[i-r-1]+e,o[i--]=c%kr|0,e=c/kr|0;o[i]=(o[i]+e)%kr|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=n,Gn?En(t,f.precision):t};Je.toDecimalPlaces=Je.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(qs(t,0,sh),e===void 0?e=r.rounding:qs(e,0,8),En(n,t+pr(n)+1,e))};Je.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Cu(r,!0):(qs(t,0,sh),e===void 0?e=i.rounding:qs(e,0,8),r=En(new i(r),t+1,e),n=Cu(r,!0,t+1)),n};Je.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?Cu(i):(qs(t,0,sh),e===void 0?e=o.rounding:qs(e,0,8),r=En(new o(i),t+pr(i)+1,e),n=Cu(r.abs(),!1,t+pr(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Je.toInteger=Je.toint=function(){var t=this,e=t.constructor;return En(new e(t),pr(t)+1,e.rounding)};Je.toNumber=function(){return+this};Je.toPower=Je.pow=function(t){var e,n,r,i,o,s,c=this,l=c.constructor,u=12,d=+(t=new l(t));if(!t.s)return new l(Yi);if(c=new l(c),!c.s){if(t.s<1)throw Error(No+"Infinity");return c}if(c.eq(Yi))return c;if(r=l.precision,t.eq(Yi))return En(c,r);if(e=t.e,n=t.d.length-1,s=e>=n,o=c.s,s){if((n=d<0?-d:d)<=A8){for(i=new l(Yi),e=Math.ceil(r/$n+4),Gn=!1;n%2&&(i=i.times(c),DM(i.d,e)),n=ah(n/2),n!==0;)c=c.times(c),DM(c.d,e);return Gn=!0,t.s<0?new l(Yi).div(i):En(i,r)}}else if(o<0)throw Error(No+"NaN");return o=o<0&&t.d[Math.max(e,n)]&1?-1:1,c.s=1,Gn=!1,i=t.times(Im(c,r+u)),Gn=!0,i=E8(i),i.s=o,i};Je.toPrecision=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?(n=pr(i),r=Cu(i,n<=o.toExpNeg||n>=o.toExpPos)):(qs(t,1,sh),e===void 0?e=o.rounding:qs(e,0,8),i=En(new o(i),t,e),n=pr(i),r=Cu(i,t<=n||n<=o.toExpNeg,t)),r};Je.toSignificantDigits=Je.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(qs(t,1,sh),e===void 0?e=r.rounding:qs(e,0,8)),En(new r(n),t,e)};Je.toString=Je.valueOf=Je.val=Je.toJSON=Je[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=pr(t),n=t.constructor;return Cu(t,e<=n.toExpNeg||e>=n.toExpPos)};function j8(t,e){var n,r,i,o,s,c,l,u,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),Gn?En(e,f):e;if(l=t.d,u=e.d,s=t.e,i=e.e,l=l.slice(),o=s-i,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,i=s,c=l.length),s=Math.ceil(f/$n),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/kr|0,l[o]%=kr;for(n&&(l.unshift(n),++i),c=l.length;l[--c]==0;)l.pop();return e.d=l,e.e=i,Gn?En(e,f):e}function qs(t,e,n){if(t!==~~t||tn)throw Error(Zl+t)}function Os(t){var e,n,r,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;es?1:-1;else for(c=l=0;ci[c]?1:-1;break}return l}function n(r,i,o){for(var s=0;o--;)r[o]-=s,s=r[o]1;)r.shift()}return function(r,i,o,s){var c,l,u,d,f,h,p,g,m,y,b,x,w,S,C,_,A,j,P=r.constructor,k=r.s==i.s?1:-1,O=r.d,E=i.d;if(!r.s)return new P(r);if(!i.s)throw Error(No+"Division by zero");for(l=r.e-i.e,A=E.length,C=O.length,p=new P(k),g=p.d=[],u=0;E[u]==(O[u]||0);)++u;if(E[u]>(O[u]||0)&&--l,o==null?x=o=P.precision:s?x=o+(pr(r)-pr(i))+1:x=o,x<0)return new P(0);if(x=x/$n+2|0,u=0,A==1)for(d=0,E=E[0],x++;(u1&&(E=t(E,d),O=t(O,d),A=E.length,C=O.length),S=A,m=O.slice(0,A),y=m.length;y=kr/2&&++_;do d=0,c=e(E,m,A,y),c<0?(b=m[0],A!=y&&(b=b*kr+(m[1]||0)),d=b/_|0,d>1?(d>=kr&&(d=kr-1),f=t(E,d),h=f.length,y=m.length,c=e(f,m,h,y),c==1&&(d--,n(f,A16)throw Error(HP+pr(t));if(!t.s)return new d(Yi);for(e==null?(Gn=!1,c=f):c=e,s=new d(.03125);t.abs().gte(.1);)t=t.times(s),u+=5;for(r=Math.log(jl(2,u))/Math.LN10*2+5|0,c+=r,n=i=o=new d(Yi),d.precision=c;;){if(i=En(i.times(t),c),n=n.times(++l),s=o.plus(Ta(i,n,c)),Os(s.d).slice(0,c)===Os(o.d).slice(0,c)){for(;u--;)o=En(o.times(o),c);return d.precision=f,e==null?(Gn=!0,En(o,f)):o}o=s}}function pr(t){for(var e=t.e*$n,n=t.d[0];n>=10;n/=10)e++;return e}function wC(t,e,n){if(e>t.LN10.sd())throw Gn=!0,n&&(t.precision=n),Error(No+"LN10 precision limit exceeded");return En(new t(t.LN10),e)}function sc(t){for(var e="";t--;)e+="0";return e}function Im(t,e){var n,r,i,o,s,c,l,u,d,f=1,h=10,p=t,g=p.d,m=p.constructor,y=m.precision;if(p.s<1)throw Error(No+(p.s?"NaN":"-Infinity"));if(p.eq(Yi))return new m(0);if(e==null?(Gn=!1,u=y):u=e,p.eq(10))return e==null&&(Gn=!0),wC(m,u);if(u+=h,m.precision=u,n=Os(g),r=n.charAt(0),o=pr(p),Math.abs(o)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(t),n=Os(p.d),r=n.charAt(0),f++;o=pr(p),r>1?(p=new m("0."+n),o++):p=new m(r+"."+n.slice(1))}else return l=wC(m,u+2,y).times(o+""),p=Im(new m(r+"."+n.slice(1)),u-h).plus(l),m.precision=y,e==null?(Gn=!0,En(p,y)):p;for(c=s=p=Ta(p.minus(Yi),p.plus(Yi),u),d=En(p.times(p),u),i=3;;){if(s=En(s.times(d),u),l=c.plus(Ta(s,new m(i),u)),Os(l.d).slice(0,u)===Os(c.d).slice(0,u))return c=c.times(2),o!==0&&(c=c.plus(wC(m,u+2,y).times(o+""))),c=Ta(c,new m(f),u),m.precision=y,e==null?(Gn=!0,En(c,y)):c;c=l,i+=2}}function MM(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(r,i),e){if(i-=r,n=n-r-1,t.e=ah(n/$n),t.d=[],r=(n+1)%$n,n<0&&(r+=$n),rpb||t.e<-pb))throw Error(HP+n)}else t.s=0,t.e=0,t.d=[0];return t}function En(t,e,n){var r,i,o,s,c,l,u,d,f=t.d;for(s=1,o=f[0];o>=10;o/=10)s++;if(r=e-s,r<0)r+=$n,i=e,u=f[d=0];else{if(d=Math.ceil((r+1)/$n),o=f.length,d>=o)return t;for(u=o=f[d],s=1;o>=10;o/=10)s++;r%=$n,i=r-$n+s}if(n!==void 0&&(o=jl(10,s-i-1),c=u/o%10|0,l=e<0||f[d+1]!==void 0||u%o,l=n<4?(c||l)&&(n==0||n==(t.s<0?3:2)):c>5||c==5&&(n==4||l||n==6&&(r>0?i>0?u/jl(10,s-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(o=pr(t),f.length=1,e=e-o-1,f[0]=jl(10,($n-e%$n)%$n),t.e=ah(-e/$n)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(r==0?(f.length=d,o=1,d--):(f.length=d+1,o=jl(10,$n-r),f[d]=i>0?(u/jl(10,s-i)%jl(10,i)|0)*o:0),l)for(;;)if(d==0){(f[0]+=o)==kr&&(f[0]=1,++t.e);break}else{if(f[d]+=o,f[d]!=kr)break;f[d--]=0,o=1}for(r=f.length;f[--r]===0;)f.pop();if(Gn&&(t.e>pb||t.e<-pb))throw Error(HP+pr(t));return t}function T8(t,e){var n,r,i,o,s,c,l,u,d,f,h=t.constructor,p=h.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new h(t),Gn?En(e,p):e;if(l=t.d,f=e.d,r=e.e,u=t.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=f.length):(n=f,r=u,c=l.length),i=Math.max(Math.ceil(p/$n),c)+2,s>i&&(s=i,n.length=1),n.reverse(),i=s;i--;)n.push(0);n.reverse()}else{for(i=l.length,c=f.length,d=i0;--i)l[c++]=0;for(i=f.length;i>s;){if(l[--i]0?o=o.charAt(0)+"."+o.slice(1)+sc(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+sc(-i-1)+o,n&&(r=n-s)>0&&(o+=sc(r))):i>=s?(o+=sc(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+sc(r))):((r=i+1)0&&(i+1===s&&(o+="."),o+=sc(r))),t.s<0?"-"+o:o}function DM(t,e){if(t.length>e)return t.length=e,!0}function N8(t){var e,n,r;function i(o){var s=this;if(!(s instanceof i))return new i(o);if(s.constructor=i,o instanceof i){s.s=o.s,s.e=o.e,s.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(Zl+o);if(o>0)s.s=1;else if(o<0)o=-o,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(o===~~o&&o<1e7){s.e=0,s.d=[o];return}return MM(s,o.toString())}else if(typeof o!="string")throw Error(Zl+o);if(o.charCodeAt(0)===45?(o=o.slice(1),s.s=-1):s.s=1,kEe.test(o))MM(s,o);else throw Error(Zl+o)}if(i.prototype=Je,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=N8,i.config=i.set=OEe,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=i[e+1]&&r<=i[e+2])this[n]=r;else throw Error(Zl+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Zl+n+": "+r);return this}var zP=N8(PEe);Yi=new zP(1);const Sn=zP;function IEe(t){return $Ee(t)||DEe(t)||MEe(t)||REe()}function REe(){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 MEe(t,e){if(t){if(typeof t=="string")return m1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m1(t,e)}}function DEe(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function $Ee(t){if(Array.isArray(t))return m1(t)}function m1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=e?n.apply(void 0,i):t(e-s,$M(function(){for(var c=arguments.length,l=new Array(c),u=0;ut.length)&&(e=t.length);for(var n=0,r=new Array(e);n"u"||!(Symbol.iterator in Object(t)))){var n=[],r=!0,i=!1,o=void 0;try{for(var s=t[Symbol.iterator](),c;!(r=(c=s.next()).done)&&(n.push(c.value),!(e&&n.length===e));r=!0);}catch(l){i=!0,o=l}finally{try{!r&&s.return!=null&&s.return()}finally{if(i)throw o}}return n}}function JEe(t){if(Array.isArray(t))return t}function R8(t){var e=Rm(t,2),n=e[0],r=e[1],i=n,o=r;return n>r&&(i=r,o=n),[i,o]}function M8(t,e,n){if(t.lte(0))return new Sn(0);var r=Bw.getDigitCount(t.toNumber()),i=new Sn(10).pow(r),o=t.div(i),s=r!==1?.05:.1,c=new Sn(Math.ceil(o.div(s).toNumber())).add(n).mul(s),l=c.mul(i);return e?l:new Sn(Math.ceil(l))}function ZEe(t,e,n){var r=1,i=new Sn(t);if(!i.isint()&&n){var o=Math.abs(t);o<1?(r=new Sn(10).pow(Bw.getDigitCount(t)-1),i=new Sn(Math.floor(i.div(r).toNumber())).mul(r)):o>1&&(i=new Sn(Math.floor(t)))}else t===0?i=new Sn(Math.floor((e-1)/2)):n||(i=new Sn(Math.floor(t)));var s=Math.floor((e-1)/2),c=UEe(BEe(function(l){return i.add(new Sn(l-s).mul(r)).toNumber()}),g1);return c(0,e)}function D8(t,e,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(n-1)))return{step:new Sn(0),tickMin:new Sn(0),tickMax:new Sn(0)};var o=M8(new Sn(e).sub(t).div(n-1),r,i),s;t<=0&&e>=0?s=new Sn(0):(s=new Sn(t).add(e).div(2),s=s.sub(new Sn(s).mod(o)));var c=Math.ceil(s.sub(t).div(o).toNumber()),l=Math.ceil(new Sn(e).sub(s).div(o).toNumber()),u=c+l+1;return u>n?D8(t,e,n,r,i+1):(u0?l+(n-u):l,c=e>0?c:c+(n-u)),{step:o,tickMin:s.sub(new Sn(c).mul(o)),tickMax:s.add(new Sn(l).mul(o))})}function eTe(t){var e=Rm(t,2),n=e[0],r=e[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(i,2),c=R8([n,r]),l=Rm(c,2),u=l[0],d=l[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(y1(g1(0,i-1).map(function(){return 1/0}))):[].concat(y1(g1(0,i-1).map(function(){return-1/0})),[d]);return n>r?v1(f):f}if(u===d)return ZEe(u,i,o);var h=D8(u,d,s,o),p=h.step,g=h.tickMin,m=h.tickMax,y=Bw.rangeStep(g,m.add(new Sn(.1).mul(p)),p);return n>r?v1(y):y}function tTe(t,e){var n=Rm(t,2),r=n[0],i=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=R8([r,i]),c=Rm(s,2),l=c[0],u=c[1];if(l===-1/0||u===1/0)return[r,i];if(l===u)return[l];var d=Math.max(e,2),f=M8(new Sn(u).sub(l).div(d-1),o,0),h=[].concat(y1(Bw.rangeStep(new Sn(l),new Sn(u).sub(new Sn(.99).mul(f)),f)),[u]);return r>i?v1(h):h}var nTe=O8(eTe),rTe=O8(tTe),iTe="Invariant failed";function _u(t,e){throw new Error(iTe)}var oTe=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function ff(t){"@babel/helpers - typeof";return ff=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ff(t)}function mb(){return mb=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function fTe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function hTe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pTe(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,s=-1,c=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(c<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var l=o.range,u=0;u0?i[u-1].coordinate:i[c-1].coordinate,f=i[u].coordinate,h=u>=c-1?i[0].coordinate:i[u+1].coordinate,p=void 0;if(mi(f-d)!==mi(h-f)){var g=[];if(mi(h-f)===mi(l[1]-l[0])){p=h;var m=f+l[1]-l[0];g[0]=Math.min(m,(m+d)/2),g[1]=Math.max(m,(m+d)/2)}else{p=d;var y=h+l[1]-l[0];g[0]=Math.min(f,(y+f)/2),g[1]=Math.max(f,(y+f)/2)}var b=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(e>b[0]&&e<=b[1]||e>=g[0]&&e<=g[1]){s=i[u].index;break}}else{var x=Math.min(d,h),w=Math.max(d,h);if(e>(x+f)/2&&e<=(w+f)/2){s=i[u].index;break}}}else for(var S=0;S0&&S(r[S].coordinate+r[S-1].coordinate)/2&&e<=(r[S].coordinate+r[S+1].coordinate)/2||S===c-1&&e>(r[S].coordinate+r[S-1].coordinate)/2){s=r[S].index;break}return s},GP=function(e){var n,r=e,i=r.type.displayName,o=(n=e.type)!==null&&n!==void 0&&n.defaultProps?Zn(Zn({},e.type.defaultProps),e.props):e.props,s=o.stroke,c=o.fill,l;switch(i){case"Line":l=s;break;case"Area":case"Radar":l=s&&s!=="none"?s:c;break;default:l=c;break}return l},kTe=function(e){var n=e.barSize,r=e.totalSize,i=e.stackGroups,o=i===void 0?{}:i;if(!o)return{};for(var s={},c=Object.keys(o),l=0,u=c.length;l=0});if(b&&b.length){var x=b[0].type.defaultProps,w=x!==void 0?Zn(Zn({},x),b[0].props):b[0].props,S=w.barSize,C=w[y];s[C]||(s[C]=[]);var _=Dt(S)?n:S;s[C].push({item:b[0],stackList:b.slice(1),barSize:Dt(_)?void 0:gi(_,r,0)})}}return s},OTe=function(e){var n=e.barGap,r=e.barCategoryGap,i=e.bandSize,o=e.sizeList,s=o===void 0?[]:o,c=e.maxBarSize,l=s.length;if(l<1)return null;var u=gi(n,i,0,!0),d,f=[];if(s[0].barSize===+s[0].barSize){var h=!1,p=i/l,g=s.reduce(function(S,C){return S+C.barSize||0},0);g+=(l-1)*u,g>=i&&(g-=(l-1)*u,u=0),g>=i&&p>0&&(h=!0,p*=.9,g=l*p);var m=(i-g)/2>>0,y={offset:m-u,size:0};d=s.reduce(function(S,C){var _={item:C.item,position:{offset:y.offset+y.size+u,size:h?p:C.barSize}},A=[].concat(BM(S),[_]);return y=A[A.length-1].position,C.stackList&&C.stackList.length&&C.stackList.forEach(function(j){A.push({item:j,position:y})}),A},f)}else{var b=gi(r,i,0,!0);i-2*b-(l-1)*u<=0&&(u=0);var x=(i-2*b-(l-1)*u)/l;x>1&&(x>>=0);var w=c===+c?Math.min(x,c):x;d=s.reduce(function(S,C,_){var A=[].concat(BM(S),[{item:C.item,position:{offset:b+(x+u)*_+(x-w)/2,size:w}}]);return C.stackList&&C.stackList.length&&C.stackList.forEach(function(j){A.push({item:j,position:A[A.length-1].position})}),A},f)}return d},ITe=function(e,n,r,i){var o=r.children,s=r.width,c=r.margin,l=s-(c.left||0)-(c.right||0),u=B8({children:o,legendWidth:l});if(u){var d=i||{},f=d.width,h=d.height,p=u.align,g=u.verticalAlign,m=u.layout;if((m==="vertical"||m==="horizontal"&&g==="middle")&&p!=="center"&&Ae(e[p]))return Zn(Zn({},e),{},Pd({},p,e[p]+(f||0)));if((m==="horizontal"||m==="vertical"&&p==="center")&&g!=="middle"&&Ae(e[g]))return Zn(Zn({},e),{},Pd({},g,e[g]+(h||0)))}return e},RTe=function(e,n,r){return Dt(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},U8=function(e,n,r,i,o){var s=n.props.children,c=jo(s,Uw).filter(function(u){return RTe(i,o,u.props.direction)});if(c&&c.length){var l=c.map(function(u){return u.props.dataKey});return e.reduce(function(u,d){var f=ir(d,r);if(Dt(f))return u;var h=Array.isArray(f)?[Lw(f),Sc(f)]:[f,f],p=l.reduce(function(g,m){var y=ir(d,m,0),b=h[0]-Math.abs(Array.isArray(y)?y[0]:y),x=h[1]+Math.abs(Array.isArray(y)?y[1]:y);return[Math.min(b,g[0]),Math.max(x,g[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},MTe=function(e,n,r,i,o){var s=n.map(function(c){return U8(e,c,r,o,i)}).filter(function(c){return!Dt(c)});return s&&s.length?s.reduce(function(c,l){return[Math.min(c[0],l[0]),Math.max(c[1],l[1])]},[1/0,-1/0]):null},H8=function(e,n,r,i,o){var s=n.map(function(l){var u=l.props.dataKey;return r==="number"&&u&&U8(e,l,u,i)||yp(e,u,r,o)});if(r==="number")return s.reduce(function(l,u){return[Math.min(l[0],u[0]),Math.max(l[1],u[1])]},[1/0,-1/0]);var c={};return s.reduce(function(l,u){for(var d=0,f=u.length;d=2?mi(c[0]-c[1])*2*u:u,n&&(e.ticks||e.niceTicks)){var d=(e.ticks||e.niceTicks).map(function(f){var h=o?o.indexOf(f):f;return{coordinate:i(h)+u,value:f,offset:u}});return d.filter(function(f){return!eh(f.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(f,h){return{coordinate:i(f)+u,value:f,index:h,offset:u}}):i.ticks&&!r?i.ticks(e.tickCount).map(function(f){return{coordinate:i(f)+u,value:f,offset:u}}):i.domain().map(function(f,h){return{coordinate:i(f)+u,value:o?o[f]:f,index:h,offset:u}})},SC=new WeakMap,Tv=function(e,n){if(typeof n!="function")return e;SC.has(e)||SC.set(e,new WeakMap);var r=SC.get(e);if(r.has(n))return r.get(n);var i=function(){e.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,i),i},V8=function(e,n,r){var i=e.scale,o=e.type,s=e.layout,c=e.axisType;if(i==="auto")return s==="radial"&&c==="radiusAxis"?{scale:Tm(),realScaleType:"band"}:s==="radial"&&c==="angleAxis"?{scale:ub(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:vp(),realScaleType:"point"}:o==="category"?{scale:Tm(),realScaleType:"band"}:{scale:ub(),realScaleType:"linear"};if(Pg(i)){var l="scale".concat(_w(i));return{scale:(RM[l]||vp)(),realScaleType:RM[l]?l:"point"}}return Ct(i)?{scale:i}:{scale:vp(),realScaleType:"point"}},HM=1e-4,K8=function(e){var n=e.domain();if(!(!n||n.length<=2)){var r=n.length,i=e.range(),o=Math.min(i[0],i[1])-HM,s=Math.max(i[0],i[1])+HM,c=e(n[0]),l=e(n[r-1]);(cs||ls)&&e.domain([n[0],n[r-1]])}},DTe=function(e,n){if(!e)return null;for(var r=0,i=e.length;ri)&&(o[1]=i),o[0]>i&&(o[0]=i),o[1]=0?(e[c][r][0]=o,e[c][r][1]=o+l,o=e[c][r][1]):(e[c][r][0]=s,e[c][r][1]=s+l,s=e[c][r][1])}},FTe=function(e){var n=e.length;if(!(n<=0))for(var r=0,i=e[0].length;r=0?(e[s][r][0]=o,e[s][r][1]=o+c,o=e[s][r][1]):(e[s][r][0]=0,e[s][r][1]=0)}},BTe={sign:LTe,expand:ove,none:rf,silhouette:sve,wiggle:ave,positive:FTe},UTe=function(e,n,r){var i=n.map(function(c){return c.props.dataKey}),o=BTe[r],s=ive().keys(i).value(function(c,l){return+ir(c,l,0)}).order(KA).offset(o);return s(e)},HTe=function(e,n,r,i,o,s){if(!e)return null;var c=s?n.reverse():n,l={},u=c.reduce(function(f,h){var p,g=(p=h.type)!==null&&p!==void 0&&p.defaultProps?Zn(Zn({},h.type.defaultProps),h.props):h.props,m=g.stackId,y=g.hide;if(y)return f;var b=g[r],x=f[b]||{hasStack:!1,stackGroups:{}};if(Er(m)){var w=x.stackGroups[m]||{numericAxisId:r,cateAxisId:i,items:[]};w.items.push(h),x.hasStack=!0,x.stackGroups[m]=w}else x.stackGroups[th("_stackId_")]={numericAxisId:r,cateAxisId:i,items:[h]};return Zn(Zn({},f),{},Pd({},b,x))},l),d={};return Object.keys(u).reduce(function(f,h){var p=u[h];if(p.hasStack){var g={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(m,y){var b=p.stackGroups[y];return Zn(Zn({},m),{},Pd({},y,{numericAxisId:r,cateAxisId:i,items:b.items,stackedData:UTe(e,b.items,o)}))},g)}return Zn(Zn({},f),{},Pd({},h,p))},d)},W8=function(e,n){var r=n.realScaleType,i=n.type,o=n.tickCount,s=n.originalDomain,c=n.allowDecimals,l=r||n.scale;if(l!=="auto"&&l!=="linear")return null;if(o&&i==="number"&&s&&(s[0]==="auto"||s[1]==="auto")){var u=e.domain();if(!u.length)return null;var d=nTe(u,o,c);return e.domain([Lw(d),Sc(d)]),{niceTicks:d}}if(o&&i==="number"){var f=e.domain(),h=rTe(f,o,c);return{niceTicks:h}}return null};function zM(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,o=t.index,s=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Dt(i[e.dataKey])){var c=zx(n,"value",i[e.dataKey]);if(c)return c.coordinate+r/2}return n[o]?n[o].coordinate+r/2:null}var l=ir(i,Dt(s)?e.dataKey:s);return Dt(l)?null:e.scale(l)}var GM=function(e){var n=e.axis,r=e.ticks,i=e.offset,o=e.bandSize,s=e.entry,c=e.index;if(n.type==="category")return r[c]?r[c].coordinate+i:null;var l=ir(s,n.dataKey,n.domain[c]);return Dt(l)?null:n.scale(l)-o/2+i},zTe=function(e){var n=e.numericAxis,r=n.scale.domain();if(n.type==="number"){var i=Math.min(r[0],r[1]),o=Math.max(r[0],r[1]);return i<=0&&o>=0?0:o<0?o:i}return r[0]},GTe=function(e,n){var r,i=(r=e.type)!==null&&r!==void 0&&r.defaultProps?Zn(Zn({},e.type.defaultProps),e.props):e.props,o=i.stackId;if(Er(o)){var s=n[o];if(s){var c=s.items.indexOf(e);return c>=0?s.stackedData[c]:null}}return null},VTe=function(e){return e.reduce(function(n,r){return[Lw(r.concat([n[0]]).filter(Ae)),Sc(r.concat([n[1]]).filter(Ae))]},[1/0,-1/0])},q8=function(e,n,r){return Object.keys(e).reduce(function(i,o){var s=e[o],c=s.stackedData,l=c.reduce(function(u,d){var f=VTe(d.slice(n,r+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],i[0]),Math.max(l[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},VM=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,KM=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,S1=function(e,n,r){if(Ct(e))return e(n,r);if(!Array.isArray(e))return n;var i=[];if(Ae(e[0]))i[0]=r?e[0]:Math.min(e[0],n[0]);else if(VM.test(e[0])){var o=+VM.exec(e[0])[1];i[0]=n[0]-o}else Ct(e[0])?i[0]=e[0](n[0]):i[0]=n[0];if(Ae(e[1]))i[1]=r?e[1]:Math.max(e[1],n[1]);else if(KM.test(e[1])){var s=+KM.exec(e[1])[1];i[1]=n[1]+s}else Ct(e[1])?i[1]=e[1](n[1]):i[1]=n[1];return i},vb=function(e,n,r){if(e&&e.scale&&e.scale.bandwidth){var i=e.scale.bandwidth();if(!r||i>0)return i}if(e&&n&&n.length>=2){for(var o=yP(n,function(f){return f.coordinate}),s=1/0,c=1,l=o.length;ct.length)&&(e=t.length);for(var n=0,r=new Array(e);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},J8=function(e,n,r,i,o){var s=e.width,c=e.height,l=e.startAngle,u=e.endAngle,d=gi(e.cx,s,s/2),f=gi(e.cy,c,c/2),h=X8(s,c,r),p=gi(e.innerRadius,h,0),g=gi(e.outerRadius,h,h*.8),m=Object.keys(n);return m.reduce(function(y,b){var x=n[b],w=x.domain,S=x.reversed,C;if(Dt(x.range))i==="angleAxis"?C=[l,u]:i==="radiusAxis"&&(C=[p,g]),S&&(C=[C[1],C[0]]);else{C=x.range;var _=C,A=qTe(_,2);l=A[0],u=A[1]}var j=V8(x,o),P=j.realScaleType,k=j.scale;k.domain(w).range(C),K8(k);var O=W8(k,fa(fa({},x),{},{realScaleType:P})),E=fa(fa(fa({},x),O),{},{range:C,radius:g,realScaleType:P,scale:k,cx:d,cy:f,innerRadius:p,outerRadius:g,startAngle:l,endAngle:u});return fa(fa({},y),{},Q8({},b,E))},{})},eNe=function(e,n){var r=e.x,i=e.y,o=n.x,s=n.y;return Math.sqrt(Math.pow(r-o,2)+Math.pow(i-s,2))},tNe=function(e,n){var r=e.x,i=e.y,o=n.cx,s=n.cy,c=eNe({x:r,y:i},{x:o,y:s});if(c<=0)return{radius:c};var l=(r-o)/c,u=Math.acos(l);return i>s&&(u=2*Math.PI-u),{radius:c,angle:ZTe(u),angleInRadian:u}},nNe=function(e){var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),o=Math.floor(r/360),s=Math.min(i,o);return{startAngle:n-s*360,endAngle:r-s*360}},rNe=function(e,n){var r=n.startAngle,i=n.endAngle,o=Math.floor(r/360),s=Math.floor(i/360),c=Math.min(o,s);return e+c*360},QM=function(e,n){var r=e.x,i=e.y,o=tNe({x:r,y:i},n),s=o.radius,c=o.angle,l=n.innerRadius,u=n.outerRadius;if(su)return!1;if(s===0)return!0;var d=nNe(n),f=d.startAngle,h=d.endAngle,p=c,g;if(f<=h){for(;p>h;)p-=360;for(;p=f&&p<=h}else{for(;p>f;)p-=360;for(;p=h&&p<=f}return g?fa(fa({},n),{},{radius:s,angle:rNe(p,n)}):null},Z8=function(e){return!v.isValidElement(e)&&!Ct(e)&&typeof e!="boolean"?e.className:""};function Lm(t){"@babel/helpers - typeof";return Lm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lm(t)}var iNe=["offset"];function oNe(t){return lNe(t)||cNe(t)||aNe(t)||sNe()}function sNe(){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 aNe(t,e){if(t){if(typeof t=="string")return C1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C1(t,e)}}function cNe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function lNe(t){if(Array.isArray(t))return C1(t)}function C1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function dNe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function XM(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function vr(t){for(var e=1;e=0?1:-1,w,S;i==="insideStart"?(w=p+x*s,S=m):i==="insideEnd"?(w=g-x*s,S=!m):i==="end"&&(w=g+x*s,S=m),S=b<=0?S:!S;var C=un(u,d,y,w),_=un(u,d,y,w+(S?1:-1)*359),A="M".concat(C.x,",").concat(C.y,` - A`).concat(y,",").concat(y,",0,1,").concat(S?0:1,`, - `).concat(_.x,",").concat(_.y),j=Dt(e.id)?th("recharts-radial-line-"):e.id;return N.createElement("text",Fm({},r,{dominantBaseline:"central",className:Mt("recharts-radial-bar-label",c)}),N.createElement("defs",null,N.createElement("path",{id:j,d:A})),N.createElement("textPath",{xlinkHref:"#".concat(j)},n))},yNe=function(e){var n=e.viewBox,r=e.offset,i=e.position,o=n,s=o.cx,c=o.cy,l=o.innerRadius,u=o.outerRadius,d=o.startAngle,f=o.endAngle,h=(d+f)/2;if(i==="outside"){var p=un(s,c,u+r,h),g=p.x,m=p.y;return{x:g,y:m,textAnchor:g>=s?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:s,y:c,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:s,y:c,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:s,y:c,textAnchor:"middle",verticalAnchor:"end"};var y=(l+u)/2,b=un(s,c,y,h),x=b.x,w=b.y;return{x,y:w,textAnchor:"middle",verticalAnchor:"middle"}},xNe=function(e){var n=e.viewBox,r=e.parentViewBox,i=e.offset,o=e.position,s=n,c=s.x,l=s.y,u=s.width,d=s.height,f=d>=0?1:-1,h=f*i,p=f>0?"end":"start",g=f>0?"start":"end",m=u>=0?1:-1,y=m*i,b=m>0?"end":"start",x=m>0?"start":"end";if(o==="top"){var w={x:c+u/2,y:l-f*i,textAnchor:"middle",verticalAnchor:p};return vr(vr({},w),r?{height:Math.max(l-r.y,0),width:u}:{})}if(o==="bottom"){var S={x:c+u/2,y:l+d+h,textAnchor:"middle",verticalAnchor:g};return vr(vr({},S),r?{height:Math.max(r.y+r.height-(l+d),0),width:u}:{})}if(o==="left"){var C={x:c-y,y:l+d/2,textAnchor:b,verticalAnchor:"middle"};return vr(vr({},C),r?{width:Math.max(C.x-r.x,0),height:d}:{})}if(o==="right"){var _={x:c+u+y,y:l+d/2,textAnchor:x,verticalAnchor:"middle"};return vr(vr({},_),r?{width:Math.max(r.x+r.width-_.x,0),height:d}:{})}var A=r?{width:u,height:d}:{};return o==="insideLeft"?vr({x:c+y,y:l+d/2,textAnchor:x,verticalAnchor:"middle"},A):o==="insideRight"?vr({x:c+u-y,y:l+d/2,textAnchor:b,verticalAnchor:"middle"},A):o==="insideTop"?vr({x:c+u/2,y:l+h,textAnchor:"middle",verticalAnchor:g},A):o==="insideBottom"?vr({x:c+u/2,y:l+d-h,textAnchor:"middle",verticalAnchor:p},A):o==="insideTopLeft"?vr({x:c+y,y:l+h,textAnchor:x,verticalAnchor:g},A):o==="insideTopRight"?vr({x:c+u-y,y:l+h,textAnchor:b,verticalAnchor:g},A):o==="insideBottomLeft"?vr({x:c+y,y:l+d-h,textAnchor:x,verticalAnchor:p},A):o==="insideBottomRight"?vr({x:c+u-y,y:l+d-h,textAnchor:b,verticalAnchor:p},A):Qf(o)&&(Ae(o.x)||$l(o.x))&&(Ae(o.y)||$l(o.y))?vr({x:c+gi(o.x,u),y:l+gi(o.y,d),textAnchor:"end",verticalAnchor:"end"},A):vr({x:c+u/2,y:l+d/2,textAnchor:"middle",verticalAnchor:"middle"},A)},bNe=function(e){return"cx"in e&&Ae(e.cx)};function Rr(t){var e=t.offset,n=e===void 0?5:e,r=uNe(t,iNe),i=vr({offset:n},r),o=i.viewBox,s=i.position,c=i.value,l=i.children,u=i.content,d=i.className,f=d===void 0?"":d,h=i.textBreakAll;if(!o||Dt(c)&&Dt(l)&&!v.isValidElement(u)&&!Ct(u))return null;if(v.isValidElement(u))return v.cloneElement(u,i);var p;if(Ct(u)){if(p=v.createElement(u,i),v.isValidElement(p))return p}else p=mNe(i);var g=bNe(o),m=rt(i,!0);if(g&&(s==="insideStart"||s==="insideEnd"||s==="end"))return vNe(i,p,m);var y=g?yNe(i):xNe(i);return N.createElement(wu,Fm({className:Mt("recharts-label",f)},m,y,{breakAll:h}),p)}Rr.displayName="Label";var eK=function(e){var n=e.cx,r=e.cy,i=e.angle,o=e.startAngle,s=e.endAngle,c=e.r,l=e.radius,u=e.innerRadius,d=e.outerRadius,f=e.x,h=e.y,p=e.top,g=e.left,m=e.width,y=e.height,b=e.clockWise,x=e.labelViewBox;if(x)return x;if(Ae(m)&&Ae(y)){if(Ae(f)&&Ae(h))return{x:f,y:h,width:m,height:y};if(Ae(p)&&Ae(g))return{x:p,y:g,width:m,height:y}}return Ae(f)&&Ae(h)?{x:f,y:h,width:0,height:0}:Ae(n)&&Ae(r)?{cx:n,cy:r,startAngle:o||i||0,endAngle:s||i||0,innerRadius:u||0,outerRadius:d||l||c||0,clockWise:b}:e.viewBox?e.viewBox:{}},wNe=function(e,n){return e?e===!0?N.createElement(Rr,{key:"label-implicit",viewBox:n}):Er(e)?N.createElement(Rr,{key:"label-implicit",viewBox:n,value:e}):v.isValidElement(e)?e.type===Rr?v.cloneElement(e,{key:"label-implicit",viewBox:n}):N.createElement(Rr,{key:"label-implicit",content:e,viewBox:n}):Ct(e)?N.createElement(Rr,{key:"label-implicit",content:e,viewBox:n}):Qf(e)?N.createElement(Rr,Fm({viewBox:n},e,{key:"label-implicit"})):null:null},SNe=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var i=e.children,o=eK(e),s=jo(i,Rr).map(function(l,u){return v.cloneElement(l,{viewBox:n||o,key:"label-".concat(u)})});if(!r)return s;var c=wNe(e.label,n||o);return[c].concat(oNe(s))};Rr.parseViewBox=eK;Rr.renderCallByParent=SNe;function CNe(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var _Ne=CNe;const tK=dn(_Ne);function Bm(t){"@babel/helpers - typeof";return Bm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bm(t)}var ANe=["valueAccessor"],jNe=["data","dataKey","clockWise","id","textBreakAll"];function ENe(t){return kNe(t)||PNe(t)||NNe(t)||TNe()}function TNe(){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 NNe(t,e){if(t){if(typeof t=="string")return _1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _1(t,e)}}function PNe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function kNe(t){if(Array.isArray(t))return _1(t)}function _1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function MNe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var DNe=function(e){return Array.isArray(e.value)?tK(e.value):e.value};function Bs(t){var e=t.valueAccessor,n=e===void 0?DNe:e,r=eD(t,ANe),i=r.data,o=r.dataKey,s=r.clockWise,c=r.id,l=r.textBreakAll,u=eD(r,jNe);return!i||!i.length?null:N.createElement(Yt,{className:"recharts-label-list"},i.map(function(d,f){var h=Dt(o)?n(d,f):ir(d&&d.payload,o),p=Dt(c)?{}:{id:"".concat(c,"-").concat(f)};return N.createElement(Rr,xb({},rt(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:l,viewBox:Rr.parseViewBox(Dt(s)?d:ZM(ZM({},d),{},{clockWise:s})),key:"label-".concat(f),index:f}))}))}Bs.displayName="LabelList";function $Ne(t,e){return t?t===!0?N.createElement(Bs,{key:"labelList-implicit",data:e}):N.isValidElement(t)||Ct(t)?N.createElement(Bs,{key:"labelList-implicit",data:e,content:t}):Qf(t)?N.createElement(Bs,xb({data:e},t,{key:"labelList-implicit"})):null:null}function LNe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var r=t.children,i=jo(r,Bs).map(function(s,c){return v.cloneElement(s,{data:e,key:"labelList-".concat(c)})});if(!n)return i;var o=$Ne(t.label,e);return[o].concat(ENe(i))}Bs.renderCallByParent=LNe;function Um(t){"@babel/helpers - typeof";return Um=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Um(t)}function A1(){return A1=Object.assign?Object.assign.bind():function(t){for(var e=1;e180),",").concat(+(s>u),`, - `).concat(f.x,",").concat(f.y,` - `);if(i>0){var p=un(n,r,i,s),g=un(n,r,i,u);h+="L ".concat(g.x,",").concat(g.y,` - A `).concat(i,",").concat(i,`,0, - `).concat(+(Math.abs(l)>180),",").concat(+(s<=u),`, - `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(n,",").concat(r," Z");return h},zNe=function(e){var n=e.cx,r=e.cy,i=e.innerRadius,o=e.outerRadius,s=e.cornerRadius,c=e.forceCornerRadius,l=e.cornerIsExternal,u=e.startAngle,d=e.endAngle,f=mi(d-u),h=Nv({cx:n,cy:r,radius:o,angle:u,sign:f,cornerRadius:s,cornerIsExternal:l}),p=h.circleTangency,g=h.lineTangency,m=h.theta,y=Nv({cx:n,cy:r,radius:o,angle:d,sign:-f,cornerRadius:s,cornerIsExternal:l}),b=y.circleTangency,x=y.lineTangency,w=y.theta,S=l?Math.abs(u-d):Math.abs(u-d)-m-w;if(S<0)return c?"M ".concat(g.x,",").concat(g.y,` - a`).concat(s,",").concat(s,",0,0,1,").concat(s*2,`,0 - a`).concat(s,",").concat(s,",0,0,1,").concat(-s*2,`,0 - `):nK({cx:n,cy:r,innerRadius:i,outerRadius:o,startAngle:u,endAngle:d});var C="M ".concat(g.x,",").concat(g.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,` - A`).concat(o,",").concat(o,",0,").concat(+(S>180),",").concat(+(f<0),",").concat(b.x,",").concat(b.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(x.x,",").concat(x.y,` - `);if(i>0){var _=Nv({cx:n,cy:r,radius:i,angle:u,sign:f,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),A=_.circleTangency,j=_.lineTangency,P=_.theta,k=Nv({cx:n,cy:r,radius:i,angle:d,sign:-f,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),O=k.circleTangency,E=k.lineTangency,I=k.theta,D=l?Math.abs(u-d):Math.abs(u-d)-P-I;if(D<0&&s===0)return"".concat(C,"L").concat(n,",").concat(r,"Z");C+="L".concat(E.x,",").concat(E.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(O.x,",").concat(O.y,` - A`).concat(i,",").concat(i,",0,").concat(+(D>180),",").concat(+(f>0),",").concat(A.x,",").concat(A.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(j.x,",").concat(j.y,"Z")}else C+="L".concat(n,",").concat(r,"Z");return C},GNe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},rK=function(e){var n=nD(nD({},GNe),e),r=n.cx,i=n.cy,o=n.innerRadius,s=n.outerRadius,c=n.cornerRadius,l=n.forceCornerRadius,u=n.cornerIsExternal,d=n.startAngle,f=n.endAngle,h=n.className;if(s0&&Math.abs(d-f)<360?y=zNe({cx:r,cy:i,innerRadius:o,outerRadius:s,cornerRadius:Math.min(m,g/2),forceCornerRadius:l,cornerIsExternal:u,startAngle:d,endAngle:f}):y=nK({cx:r,cy:i,innerRadius:o,outerRadius:s,startAngle:d,endAngle:f}),N.createElement("path",A1({},rt(n,!0),{className:p,d:y,role:"img"}))};function Hm(t){"@babel/helpers - typeof";return Hm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hm(t)}function j1(){return j1=Object.assign?Object.assign.bind():function(t){for(var e=1;e0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function oPe(t,e){return ch(t.getTime(),e.getTime())}function uD(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.entries(),o=0,s,c;(s=i.next())&&!s.done;){for(var l=e.entries(),u=!1,d=0;(c=l.next())&&!c.done;){var f=s.value,h=f[0],p=f[1],g=c.value,m=g[0],y=g[1];!u&&!r[d]&&(u=n.equals(h,m,o,d,t,e,n)&&n.equals(p,y,h,m,t,e,n))&&(r[d]=!0),d++}if(!u)return!1;o++}return!0}function sPe(t,e,n){var r=lD(t),i=r.length;if(lD(e).length!==i)return!1;for(var o;i-- >0;)if(o=r[i],o===cK&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!aK(e,o)||!n.equals(t[o],e[o],o,o,t,e,n))return!1;return!0}function Dh(t,e,n){var r=aD(t),i=r.length;if(aD(e).length!==i)return!1;for(var o,s,c;i-- >0;)if(o=r[i],o===cK&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!aK(e,o)||!n.equals(t[o],e[o],o,o,t,e,n)||(s=cD(t,o),c=cD(e,o),(s||c)&&(!s||!c||s.configurable!==c.configurable||s.enumerable!==c.enumerable||s.writable!==c.writable)))return!1;return!0}function aPe(t,e){return ch(t.valueOf(),e.valueOf())}function cPe(t,e){return t.source===e.source&&t.flags===e.flags}function dD(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.values(),o,s;(o=i.next())&&!o.done;){for(var c=e.values(),l=!1,u=0;(s=c.next())&&!s.done;)!l&&!r[u]&&(l=n.equals(o.value,s.value,o.value,s.value,t,e,n))&&(r[u]=!0),u++;if(!l)return!1}return!0}function lPe(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}var uPe="[object Arguments]",dPe="[object Boolean]",fPe="[object Date]",hPe="[object Map]",pPe="[object Number]",mPe="[object Object]",gPe="[object RegExp]",vPe="[object Set]",yPe="[object String]",xPe=Array.isArray,fD=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,hD=Object.assign,bPe=Object.prototype.toString.call.bind(Object.prototype.toString);function wPe(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,o=t.arePrimitiveWrappersEqual,s=t.areRegExpsEqual,c=t.areSetsEqual,l=t.areTypedArraysEqual;return function(d,f,h){if(d===f)return!0;if(d==null||f==null||typeof d!="object"||typeof f!="object")return d!==d&&f!==f;var p=d.constructor;if(p!==f.constructor)return!1;if(p===Object)return i(d,f,h);if(xPe(d))return e(d,f,h);if(fD!=null&&fD(d))return l(d,f,h);if(p===Date)return n(d,f,h);if(p===RegExp)return s(d,f,h);if(p===Map)return r(d,f,h);if(p===Set)return c(d,f,h);var g=bPe(d);return g===fPe?n(d,f,h):g===gPe?s(d,f,h):g===hPe?r(d,f,h):g===vPe?c(d,f,h):g===mPe?typeof d.then!="function"&&typeof f.then!="function"&&i(d,f,h):g===uPe?i(d,f,h):g===dPe||g===pPe||g===yPe?o(d,f,h):!1}}function SPe(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?Dh:iPe,areDatesEqual:oPe,areMapsEqual:r?sD(uD,Dh):uD,areObjectsEqual:r?Dh:sPe,arePrimitiveWrappersEqual:aPe,areRegExpsEqual:cPe,areSetsEqual:r?sD(dD,Dh):dD,areTypedArraysEqual:r?Dh:lPe};if(n&&(i=hD({},i,n(i))),e){var o=kv(i.areArraysEqual),s=kv(i.areMapsEqual),c=kv(i.areObjectsEqual),l=kv(i.areSetsEqual);i=hD({},i,{areArraysEqual:o,areMapsEqual:s,areObjectsEqual:c,areSetsEqual:l})}return i}function CPe(t){return function(e,n,r,i,o,s,c){return t(e,n,c)}}function _Pe(t){var e=t.circular,n=t.comparator,r=t.createState,i=t.equals,o=t.strict;if(r)return function(l,u){var d=r(),f=d.cache,h=f===void 0?e?new WeakMap:void 0:f,p=d.meta;return n(l,u,{cache:h,equals:i,meta:p,strict:o})};if(e)return function(l,u){return n(l,u,{cache:new WeakMap,equals:i,meta:void 0,strict:o})};var s={cache:void 0,equals:i,meta:void 0,strict:o};return function(l,u){return n(l,u,s)}}var APe=ml();ml({strict:!0});ml({circular:!0});ml({circular:!0,strict:!0});ml({createInternalComparator:function(){return ch}});ml({strict:!0,createInternalComparator:function(){return ch}});ml({circular:!0,createInternalComparator:function(){return ch}});ml({circular:!0,createInternalComparator:function(){return ch},strict:!0});function ml(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,i=t.createState,o=t.strict,s=o===void 0?!1:o,c=SPe(t),l=wPe(c),u=r?r(l):CPe(l);return _Pe({circular:n,comparator:l,createState:i,equals:u,strict:s})}function jPe(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function pD(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function i(o){n<0&&(n=o),o-n>e?(t(o),n=-1):jPe(i)};requestAnimationFrame(r)}function E1(t){"@babel/helpers - typeof";return E1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E1(t)}function EPe(t){return kPe(t)||PPe(t)||NPe(t)||TPe()}function TPe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NPe(t,e){if(t){if(typeof t=="string")return mD(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mD(t,e)}}function mD(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1?1:b<0?0:b},m=function(b){for(var x=b>1?1:b,w=x,S=0;S<8;++S){var C=f(w)-x,_=p(w);if(Math.abs(C-x)0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,i=e.damping,o=i===void 0?8:i,s=e.dt,c=s===void 0?17:s,l=function(d,f,h){var p=-(d-f)*r,g=h*o,m=h+(p-g)*c/1e3,y=h*c/1e3+d;return Math.abs(y-f)t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function cke(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o=0)&&(n[i]=t[i]);return n}function CC(t){return fke(t)||dke(t)||uke(t)||lke()}function lke(){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 uke(t,e){if(t){if(typeof t=="string")return O1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O1(t,e)}}function dke(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function fke(t){if(Array.isArray(t))return O1(t)}function O1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Sb(t){return Sb=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Sb(t)}var fs=function(t){vke(n,t);var e=yke(n);function n(r,i){var o;hke(this,n),o=e.call(this,r,i);var s=o.props,c=s.isActive,l=s.attributeName,u=s.from,d=s.to,f=s.steps,h=s.children,p=s.duration;if(o.handleStyleChange=o.handleStyleChange.bind(M1(o)),o.changeStyle=o.changeStyle.bind(M1(o)),!c||p<=0)return o.state={style:{}},typeof h=="function"&&(o.state={style:d}),R1(o);if(f&&f.length)o.state={style:f[0].style};else if(u){if(typeof h=="function")return o.state={style:u},R1(o);o.state={style:l?Xh({},l,u):u}}else o.state={style:{}};return o}return mke(n,[{key:"componentDidMount",value:function(){var i=this.props,o=i.isActive,s=i.canBegin;this.mounted=!0,!(!o||!s)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var o=this.props,s=o.isActive,c=o.canBegin,l=o.attributeName,u=o.shouldReAnimate,d=o.to,f=o.from,h=this.state.style;if(c){if(!s){var p={style:l?Xh({},l,d):d};this.state&&h&&(l&&h[l]!==d||!l&&h!==d)&&this.setState(p);return}if(!(APe(i.to,d)&&i.canBegin&&i.isActive)){var g=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var m=g||u?f:i.to;if(this.state&&h){var y={style:l?Xh({},l,m):m};(l&&h[l]!==m||!l&&h!==m)&&this.setState(y)}this.runAnimation(Ro(Ro({},this.props),{},{from:m,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var o=this,s=i.from,c=i.to,l=i.duration,u=i.easing,d=i.begin,f=i.onAnimationEnd,h=i.onAnimationStart,p=oke(s,c,qPe(u),l,this.changeStyle),g=function(){o.stopJSAnimation=p()};this.manager.start([h,d,g,l,f])}},{key:"runStepAnimation",value:function(i){var o=this,s=i.steps,c=i.begin,l=i.onAnimationStart,u=s[0],d=u.style,f=u.duration,h=f===void 0?0:f,p=function(m,y,b){if(b===0)return m;var x=y.duration,w=y.easing,S=w===void 0?"ease":w,C=y.style,_=y.properties,A=y.onAnimationEnd,j=b>0?s[b-1]:y,P=_||Object.keys(C);if(typeof S=="function"||S==="spring")return[].concat(CC(m),[o.runJSAnimation.bind(o,{from:j.style,to:C,duration:x,easing:S}),x]);var k=yD(P,x,S),O=Ro(Ro(Ro({},j.style),C),{},{transition:k});return[].concat(CC(m),[O,x,A]).filter(DPe)};return this.manager.start([l].concat(CC(s.reduce(p,[d,Math.max(h,c)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=OPe());var o=i.begin,s=i.duration,c=i.attributeName,l=i.to,u=i.easing,d=i.onAnimationStart,f=i.onAnimationEnd,h=i.steps,p=i.children,g=this.manager;if(this.unSubscribe=g.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(i);return}if(h.length>1){this.runStepAnimation(i);return}var m=c?Xh({},c,l):l,y=yD(Object.keys(m),s,u);g.start([d,o,Ro(Ro({},m),{},{transition:y}),s,f])}},{key:"render",value:function(){var i=this.props,o=i.children;i.begin;var s=i.duration;i.attributeName,i.easing;var c=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var l=ake(i,ske),u=v.Children.count(o),d=this.state.style;if(typeof o=="function")return o(d);if(!c||u===0||s<=0)return o;var f=function(p){var g=p.props,m=g.style,y=m===void 0?{}:m,b=g.className,x=v.cloneElement(p,Ro(Ro({},l),{},{style:Ro(Ro({},y),d),className:b}));return x};return u===1?f(v.Children.only(o)):N.createElement("div",null,v.Children.map(o,function(h){return f(h)}))}}]),n}(v.PureComponent);fs.displayName="Animate";fs.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};fs.propTypes={from:Ut.oneOfType([Ut.object,Ut.string]),to:Ut.oneOfType([Ut.object,Ut.string]),attributeName:Ut.string,duration:Ut.number,begin:Ut.number,easing:Ut.oneOfType([Ut.string,Ut.func]),steps:Ut.arrayOf(Ut.shape({duration:Ut.number.isRequired,style:Ut.object.isRequired,easing:Ut.oneOfType([Ut.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Ut.func]),properties:Ut.arrayOf("string"),onAnimationEnd:Ut.func})),children:Ut.oneOfType([Ut.node,Ut.func]),isActive:Ut.bool,canBegin:Ut.bool,onAnimationEnd:Ut.func,shouldReAnimate:Ut.bool,onAnimationStart:Ut.func,onAnimationReStart:Ut.func};Ut.object,Ut.object,Ut.object,Ut.element;Ut.object,Ut.object,Ut.object,Ut.oneOfType([Ut.array,Ut.element]),Ut.any;function Vm(t){"@babel/helpers - typeof";return Vm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vm(t)}function Cb(){return Cb=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0?1:-1,l=r>=0?1:-1,u=i>=0&&r>=0||i<0&&r<0?1:0,d;if(s>0&&o instanceof Array){for(var f=[0,0,0,0],h=0,p=4;hs?s:o[h];d="M".concat(e,",").concat(n+c*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(e+l*f[0],",").concat(n)),d+="L ".concat(e+r-l*f[1],",").concat(n),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`, - `).concat(e+r,",").concat(n+c*f[1])),d+="L ".concat(e+r,",").concat(n+i-c*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`, - `).concat(e+r-l*f[2],",").concat(n+i)),d+="L ".concat(e+l*f[3],",").concat(n+i),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`, - `).concat(e,",").concat(n+i-c*f[3])),d+="Z"}else if(s>0&&o===+o&&o>0){var g=Math.min(s,o);d="M ".concat(e,",").concat(n+c*g,` - A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e+l*g,",").concat(n,` - L `).concat(e+r-l*g,",").concat(n,` - A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e+r,",").concat(n+c*g,` - L `).concat(e+r,",").concat(n+i-c*g,` - A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e+r-l*g,",").concat(n+i,` - L `).concat(e+l*g,",").concat(n+i,` - A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(e,",").concat(n+i-c*g," Z")}else d="M ".concat(e,",").concat(n," h ").concat(r," v ").concat(i," h ").concat(-r," Z");return d},Tke=function(e,n){if(!e||!n)return!1;var r=e.x,i=e.y,o=n.x,s=n.y,c=n.width,l=n.height;if(Math.abs(c)>0&&Math.abs(l)>0){var u=Math.min(o,o+c),d=Math.max(o,o+c),f=Math.min(s,s+l),h=Math.max(s,s+l);return r>=u&&r<=d&&i>=f&&i<=h}return!1},Nke={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},VP=function(e){var n=jD(jD({},Nke),e),r=v.useRef(),i=v.useState(-1),o=bke(i,2),s=o[0],c=o[1];v.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var S=r.current.getTotalLength();S&&c(S)}catch{}},[]);var l=n.x,u=n.y,d=n.width,f=n.height,h=n.radius,p=n.className,g=n.animationEasing,m=n.animationDuration,y=n.animationBegin,b=n.isAnimationActive,x=n.isUpdateAnimationActive;if(l!==+l||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var w=Mt("recharts-rectangle",p);return x?N.createElement(fs,{canBegin:s>0,from:{width:d,height:f,x:l,y:u},to:{width:d,height:f,x:l,y:u},duration:m,animationEasing:g,isActive:x},function(S){var C=S.width,_=S.height,A=S.x,j=S.y;return N.createElement(fs,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:y,duration:m,isActive:b,easing:g},N.createElement("path",Cb({},rt(n,!0),{className:w,d:ED(A,j,C,_,h),ref:r})))}):N.createElement("path",Cb({},rt(n,!0),{className:w,d:ED(l,u,d,f,h)}))},Pke=["points","className","baseLinePoints","connectNulls"];function ud(){return ud=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Oke(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function TD(t){return Dke(t)||Mke(t)||Rke(t)||Ike()}function Ike(){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 Rke(t,e){if(t){if(typeof t=="string")return D1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return D1(t,e)}}function Mke(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Dke(t){if(Array.isArray(t))return D1(t)}function D1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(r){ND(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),ND(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},bp=function(e,n){var r=$ke(e);n&&(r=[r.reduce(function(o,s){return[].concat(TD(o),TD(s))},[])]);var i=r.map(function(o){return o.reduce(function(s,c,l){return"".concat(s).concat(l===0?"M":"L").concat(c.x,",").concat(c.y)},"")}).join("");return r.length===1?"".concat(i,"Z"):i},Lke=function(e,n,r){var i=bp(e,r);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(bp(n.reverse(),r).slice(1))},mK=function(e){var n=e.points,r=e.className,i=e.baseLinePoints,o=e.connectNulls,s=kke(e,Pke);if(!n||!n.length)return null;var c=Mt("recharts-polygon",r);if(i&&i.length){var l=s.stroke&&s.stroke!=="none",u=Lke(n,i,o);return N.createElement("g",{className:c},N.createElement("path",ud({},rt(s,!0),{fill:u.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:u})),l?N.createElement("path",ud({},rt(s,!0),{fill:"none",d:bp(n,o)})):null,l?N.createElement("path",ud({},rt(s,!0),{fill:"none",d:bp(i,o)})):null)}var d=bp(n,o);return N.createElement("path",ud({},rt(s,!0),{fill:d.slice(-1)==="Z"?s.fill:"none",className:c,d}))};function $1(){return $1=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Vke(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var Kke=function(e,n,r,i,o,s){return"M".concat(e,",").concat(o,"v").concat(i,"M").concat(s,",").concat(n,"h").concat(r)},Wke=function(e){var n=e.x,r=n===void 0?0:n,i=e.y,o=i===void 0?0:i,s=e.top,c=s===void 0?0:s,l=e.left,u=l===void 0?0:l,d=e.width,f=d===void 0?0:d,h=e.height,p=h===void 0?0:h,g=e.className,m=Gke(e,Fke),y=Bke({x:r,y:o,top:c,left:u,width:f,height:p},m);return!Ae(r)||!Ae(o)||!Ae(f)||!Ae(p)||!Ae(c)||!Ae(u)?null:N.createElement("path",L1({},rt(y,!0),{className:Mt("recharts-cross",g),d:Kke(r,o,f,p,c,u)}))},qke=["cx","cy","innerRadius","outerRadius","gridType","radialLines"];function Wm(t){"@babel/helpers - typeof";return Wm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wm(t)}function Yke(t,e){if(t==null)return{};var n=Qke(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Qke(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Ha(){return Ha=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function xOe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function bOe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function RD(t,e){for(var n=0;n$D?s=i==="outer"?"start":"end":o<-$D?s=i==="outer"?"end":"start":s="middle",s}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.cx,o=r.cy,s=r.radius,c=r.axisLine,l=r.axisLineType,u=bl(bl({},rt(this.props,!1)),{},{fill:"none"},rt(c,!1));if(l==="circle")return N.createElement($g,El({className:"recharts-polar-angle-axis-line"},u,{cx:i,cy:o,r:s}));var d=this.props.ticks,f=d.map(function(h){return un(i,o,s,h.coordinate)});return N.createElement(mK,El({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var r=this,i=this.props,o=i.ticks,s=i.tick,c=i.tickLine,l=i.tickFormatter,u=i.stroke,d=rt(this.props,!1),f=rt(s,!1),h=bl(bl({},d),{},{fill:"none"},rt(c,!1)),p=o.map(function(g,m){var y=r.getTickLineCoord(g),b=r.getTickTextAnchor(g),x=bl(bl(bl({textAnchor:b},d),{},{stroke:"none",fill:u},f),{},{index:m,payload:g,x:y.x2,y:y.y2});return N.createElement(Yt,El({className:Mt("recharts-polar-angle-axis-tick",Z8(s)),key:"tick-".concat(g.coordinate)},bu(r.props,g,m)),c&&N.createElement("line",El({className:"recharts-polar-angle-axis-tick-line"},h,y)),s&&e.renderTickItem(s,x,l?l(g.value,m):g.value))});return N.createElement(Yt,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var r=this.props,i=r.ticks,o=r.radius,s=r.axisLine;return o<=0||!i||!i.length?null:N.createElement(Yt,{className:Mt("recharts-polar-angle-axis",this.props.className)},s&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,i,o){var s;return N.isValidElement(r)?s=N.cloneElement(r,i):Ct(r)?s=r(i):s=N.createElement(wu,El({},i,{className:"recharts-polar-angle-axis-tick-value"}),o),s}}])}(v.PureComponent);zw(uh,"displayName","PolarAngleAxis");zw(uh,"axisType","angleAxis");zw(uh,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var MOe=xV,DOe=MOe(Object.getPrototypeOf,Object),$Oe=DOe,LOe=Wa,FOe=$Oe,BOe=qa,UOe="[object Object]",HOe=Function.prototype,zOe=Object.prototype,wK=HOe.toString,GOe=zOe.hasOwnProperty,VOe=wK.call(Object);function KOe(t){if(!BOe(t)||LOe(t)!=UOe)return!1;var e=FOe(t);if(e===null)return!0;var n=GOe.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&wK.call(n)==VOe}var WOe=KOe;const qOe=dn(WOe);var YOe=Wa,QOe=qa,XOe="[object Boolean]";function JOe(t){return t===!0||t===!1||QOe(t)&&YOe(t)==XOe}var ZOe=JOe;const eIe=dn(ZOe);function Ym(t){"@babel/helpers - typeof";return Ym=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ym(t)}function jb(){return jb=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n0,from:{upperWidth:0,lowerWidth:0,height:h,x:l,y:u},to:{upperWidth:d,lowerWidth:f,height:h,x:l,y:u},duration:m,animationEasing:g,isActive:b},function(w){var S=w.upperWidth,C=w.lowerWidth,_=w.height,A=w.x,j=w.y;return N.createElement(fs,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:y,duration:m,easing:g},N.createElement("path",jb({},rt(n,!0),{className:x,d:UD(A,j,S,C,_),ref:r})))}):N.createElement("g",null,N.createElement("path",jb({},rt(n,!0),{className:x,d:UD(l,u,d,f,h)})))},dIe=["option","shapeType","propTransformer","activeClassName","isActive"];function Qm(t){"@babel/helpers - typeof";return Qm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qm(t)}function fIe(t,e){if(t==null)return{};var n=hIe(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function hIe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function HD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Eb(t){for(var e=1;e0?to(w,"paddingAngle",0):0;if(C){var A=Ir(C.endAngle-C.startAngle,w.endAngle-w.startAngle),j=Tn(Tn({},w),{},{startAngle:x+_,endAngle:x+A(m)+_});y.push(j),x=j.endAngle}else{var P=w.endAngle,k=w.startAngle,O=Ir(0,P-k),E=O(m),I=Tn(Tn({},w),{},{startAngle:x+_,endAngle:x+E+_});y.push(I),x=I.endAngle}}),N.createElement(Yt,null,r.renderSectorsStatically(y))})}},{key:"attachKeyboardHandlers",value:function(r){var i=this;r.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var s=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[s].focus(),i.setState({sectorToFocus:s});break}case"ArrowRight":{var c=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[c].focus(),i.setState({sectorToFocus:c});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,i=r.sectors,o=r.isAnimationActive,s=this.state.prevSectors;return o&&i&&i.length&&(!s||!Su(s,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,i=this.props,o=i.hide,s=i.sectors,c=i.className,l=i.label,u=i.cx,d=i.cy,f=i.innerRadius,h=i.outerRadius,p=i.isAnimationActive,g=this.state.isAnimationFinished;if(o||!s||!s.length||!Ae(u)||!Ae(d)||!Ae(f)||!Ae(h))return null;var m=Mt("recharts-pie",c);return N.createElement(Yt,{tabIndex:this.props.rootTabIndex,className:m,ref:function(b){r.pieRef=b}},this.renderSectors(),l&&this.renderLabels(s),Rr.renderCallByParent(this.props,null,!1),(!p||g)&&Bs.renderCallByParent(this.props,s,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return i.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:r.sectors!==i.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,i){return r>i?"start":r=360?x:x-1)*l,S=y-x*p-w,C=i.reduce(function(j,P){var k=ir(P,b,0);return j+(Ae(k)?k:0)},0),_;if(C>0){var A;_=i.map(function(j,P){var k=ir(j,b,0),O=ir(j,d,P),E=(Ae(k)?k:0)/C,I;P?I=A.endAngle+mi(m)*l*(k!==0?1:0):I=s;var D=I+mi(m)*((k!==0?p:0)+E*S),z=(I+D)/2,$=(g.innerRadius+g.outerRadius)/2,G=[{name:O,value:k,payload:j,dataKey:b,type:h}],R=un(g.cx,g.cy,$,z);return A=Tn(Tn(Tn({percent:E,cornerRadius:o,name:O,tooltipPayload:G,midAngle:z,middleRadius:$,tooltipPosition:R},j),g),{},{value:ir(j,b),startAngle:I,endAngle:D,payload:j,paddingAngle:mi(m)*l}),A})}return Tn(Tn({},g),{},{sectors:_,data:i})});function RIe(t){return t&&t.length?t[0]:void 0}var MIe=RIe,DIe=MIe;const $Ie=dn(DIe);var LIe=["key"];function vf(t){"@babel/helpers - typeof";return vf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vf(t)}function FIe(t,e){if(t==null)return{};var n=BIe(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function BIe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Nb(){return Nb=Object.assign?Object.assign.bind():function(t){for(var e=1;e=2&&(l=!0),u.push(li(li({},un(s,c,x,y)),{},{name:g,value:m,cx:s,cy:c,radius:x,angle:y,payload:h}))});var f=[];return l&&u.forEach(function(h){if(Array.isArray(h.value)){var p=$Ie(h.value),g=Dt(p)?void 0:e.scale(p);f.push(li(li({},h),{},{radius:g},un(s,c,g,h.angle)))}else f.push(h)}),{points:u,isRange:l,baseLinePoints:f}});var qIe=Math.ceil,YIe=Math.max;function QIe(t,e,n,r){for(var i=-1,o=YIe(qIe((e-t)/(n||1)),0),s=Array(o);o--;)s[r?o:++i]=t,t+=n;return s}var XIe=QIe,JIe=LV,qD=1/0,ZIe=17976931348623157e292;function eRe(t){if(!t)return t===0?t:0;if(t=JIe(t),t===qD||t===-qD){var e=t<0?-1:1;return e*ZIe}return t===t?t:0}var EK=eRe,tRe=XIe,nRe=Pw,_C=EK;function rRe(t){return function(e,n,r){return r&&typeof r!="number"&&nRe(e,n,r)&&(n=r=void 0),e=_C(e),n===void 0?(n=e,e=0):n=_C(n),r=r===void 0?e0&&r.handleDrag(i.changedTouches[0])}),Hi(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=r.props,o=i.endIndex,s=i.onDragEnd,c=i.startIndex;s==null||s({endIndex:o,startIndex:c})}),r.detachDragEndListener()}),Hi(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Hi(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Hi(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Hi(r,"handleSlideDragStart",function(i){var o=ZD(i)?i.changedTouches[0]:i;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return vRe(e,t),hRe(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var i=r.startX,o=r.endX,s=this.state.scaleValues,c=this.props,l=c.gap,u=c.data,d=u.length-1,f=Math.min(i,o),h=Math.max(i,o),p=e.getIndexInRange(s,f),g=e.getIndexInRange(s,h);return{startIndex:p-p%l,endIndex:g===d?d:g-g%l}}},{key:"getTextOfTick",value:function(r){var i=this.props,o=i.data,s=i.tickFormatter,c=i.dataKey,l=ir(o[r],c,r);return Ct(s)?s(l,r):l}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var i=this.state,o=i.slideMoveStartX,s=i.startX,c=i.endX,l=this.props,u=l.x,d=l.width,f=l.travellerWidth,h=l.startIndex,p=l.endIndex,g=l.onChange,m=r.pageX-o;m>0?m=Math.min(m,u+d-f-c,u+d-f-s):m<0&&(m=Math.max(m,u-s,u-c));var y=this.getIndex({startX:s+m,endX:c+m});(y.startIndex!==h||y.endIndex!==p)&&g&&g(y),this.setState({startX:s+m,endX:c+m,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,i){var o=ZD(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var i=this.state,o=i.brushMoveStartX,s=i.movingTravellerId,c=i.endX,l=i.startX,u=this.state[s],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,g=d.onChange,m=d.gap,y=d.data,b={startX:this.state.startX,endX:this.state.endX},x=r.pageX-o;x>0?x=Math.min(x,f+h-p-u):x<0&&(x=Math.max(x,f-u)),b[s]=u+x;var w=this.getIndex(b),S=w.startIndex,C=w.endIndex,_=function(){var j=y.length-1;return s==="startX"&&(c>l?S%m===0:C%m===0)||cl?C%m===0:S%m===0)||c>l&&C===j};this.setState(Hi(Hi({},s,u+x),"brushMoveStartX",r.pageX),function(){g&&_()&&g(w)})}},{key:"handleTravellerMoveKeyboard",value:function(r,i){var o=this,s=this.state,c=s.scaleValues,l=s.startX,u=s.endX,d=this.state[i],f=c.indexOf(d);if(f!==-1){var h=f+r;if(!(h===-1||h>=c.length)){var p=c[h];i==="startX"&&p>=u||i==="endX"&&p<=l||this.setState(Hi({},i,p),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,i=r.x,o=r.y,s=r.width,c=r.height,l=r.fill,u=r.stroke;return N.createElement("rect",{stroke:u,fill:l,x:i,y:o,width:s,height:c})}},{key:"renderPanorama",value:function(){var r=this.props,i=r.x,o=r.y,s=r.width,c=r.height,l=r.data,u=r.children,d=r.padding,f=v.Children.only(u);return f?N.cloneElement(f,{x:i,y:o,width:s,height:c,margin:d,compact:!0,data:l}):null}},{key:"renderTravellerLayer",value:function(r,i){var o,s,c=this,l=this.props,u=l.y,d=l.travellerWidth,f=l.height,h=l.traveller,p=l.ariaLabel,g=l.data,m=l.startIndex,y=l.endIndex,b=Math.max(r,this.props.x),x=AC(AC({},rt(this.props,!1)),{},{x:b,y:u,width:d,height:f}),w=p||"Min value: ".concat((o=g[m])===null||o===void 0?void 0:o.name,", Max value: ").concat((s=g[y])===null||s===void 0?void 0:s.name);return N.createElement(Yt,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(C){["ArrowLeft","ArrowRight"].includes(C.key)&&(C.preventDefault(),C.stopPropagation(),c.handleTravellerMoveKeyboard(C.key==="ArrowRight"?1:-1,i))},onFocus:function(){c.setState({isTravellerFocused:!0})},onBlur:function(){c.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(h,x))}},{key:"renderSlide",value:function(r,i){var o=this.props,s=o.y,c=o.height,l=o.stroke,u=o.travellerWidth,d=Math.min(r,i)+u,f=Math.max(Math.abs(i-r)-u,0);return N.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:l,fillOpacity:.2,x:d,y:s,width:f,height:c})}},{key:"renderText",value:function(){var r=this.props,i=r.startIndex,o=r.endIndex,s=r.y,c=r.height,l=r.travellerWidth,u=r.stroke,d=this.state,f=d.startX,h=d.endX,p=5,g={pointerEvents:"none",fill:u};return N.createElement(Yt,{className:"recharts-brush-texts"},N.createElement(wu,Ob({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:s+c/2},g),this.getTextOfTick(i)),N.createElement(wu,Ob({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+l+p,y:s+c/2},g),this.getTextOfTick(o)))}},{key:"render",value:function(){var r=this.props,i=r.data,o=r.className,s=r.children,c=r.x,l=r.y,u=r.width,d=r.height,f=r.alwaysShowText,h=this.state,p=h.startX,g=h.endX,m=h.isTextActive,y=h.isSlideMoving,b=h.isTravellerMoving,x=h.isTravellerFocused;if(!i||!i.length||!Ae(c)||!Ae(l)||!Ae(u)||!Ae(d)||u<=0||d<=0)return null;var w=Mt("recharts-brush",o),S=N.Children.count(s)===1,C=dRe("userSelect","none");return N.createElement(Yt,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:C},this.renderBackground(),S&&this.renderPanorama(),this.renderSlide(p,g),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(g,"endX"),(m||y||b||x||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var i=r.x,o=r.y,s=r.width,c=r.height,l=r.stroke,u=Math.floor(o+c/2)-1;return N.createElement(N.Fragment,null,N.createElement("rect",{x:i,y:o,width:s,height:c,fill:l,stroke:"none"}),N.createElement("line",{x1:i+1,y1:u,x2:i+s-1,y2:u,fill:"none",stroke:"#fff"}),N.createElement("line",{x1:i+1,y1:u+2,x2:i+s-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,i){var o;return N.isValidElement(r)?o=N.cloneElement(r,i):Ct(r)?o=r(i):o=e.renderDefaultTraveller(i),o}},{key:"getDerivedStateFromProps",value:function(r,i){var o=r.data,s=r.width,c=r.x,l=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(o!==i.prevData||u!==i.prevUpdateId)return AC({prevData:o,prevTravellerWidth:l,prevUpdateId:u,prevX:c,prevWidth:s},o&&o.length?xRe({data:o,width:s,x:c,travellerWidth:l,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(i.scale&&(s!==i.prevWidth||c!==i.prevX||l!==i.prevTravellerWidth)){i.scale.range([c,c+s-l]);var h=i.scale.domain().map(function(p){return i.scale(p)});return{prevData:o,prevTravellerWidth:l,prevUpdateId:u,prevX:c,prevWidth:s,startX:i.scale(r.startIndex),endX:i.scale(r.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(r,i){for(var o=r.length,s=0,c=o-1;c-s>1;){var l=Math.floor((s+c)/2);r[l]>i?c=l:s=l}return i>=r[c]?c:s}}])}(v.PureComponent);Hi(xf,"displayName","Brush");Hi(xf,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var bRe=vP;function wRe(t,e){var n;return bRe(t,function(r,i,o){return n=e(r,i,o),!n}),!!n}var SRe=wRe,CRe=dV,_Re=ea,ARe=SRe,jRe=Bi,ERe=Pw;function TRe(t,e,n){var r=jRe(t)?CRe:ARe;return n&&ERe(t,e,n)&&(e=void 0),r(t,_Re(e))}var NRe=TRe;const PRe=dn(NRe);var Us=function(e,n){var r=e.alwaysShow,i=e.ifOverflow;return r&&(i="extendDomain"),i===n},e$=IV;function kRe(t,e,n){e=="__proto__"&&e$?e$(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var ORe=kRe,IRe=ORe,RRe=kV,MRe=ea;function DRe(t,e){var n={};return e=MRe(e),RRe(t,function(r,i,o){IRe(n,i,e(r,i,o))}),n}var $Re=DRe;const LRe=dn($Re);function FRe(t,e){for(var n=-1,r=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function n2e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function r2e(t,e){var n=t.x,r=t.y,i=t2e(t,XRe),o="".concat(n),s=parseInt(o,10),c="".concat(r),l=parseInt(c,10),u="".concat(e.height||i.height),d=parseInt(u,10),f="".concat(e.width||i.width),h=parseInt(f,10);return $h($h($h($h($h({},e),i),s?{x:s}:{}),l?{y:l}:{}),{},{height:d,width:h,name:e.name,radius:e.radius})}function n$(t){return N.createElement(SK,G1({shapeType:"rectangle",propTransformer:r2e,activeClassName:"recharts-active-bar"},t))}var i2e=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,i){if(typeof e=="number")return e;var o=typeof r=="number";return o?e(r,i):(o||_u(),n)}},o2e=["value","background"],OK;function bf(t){"@babel/helpers - typeof";return bf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bf(t)}function s2e(t,e){if(t==null)return{};var n=a2e(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function a2e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Rb(){return Rb=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&Math.abs(z)0&&Math.abs(D)0&&(I=Math.min((F||0)-(D[se-1]||0),I))}),Number.isFinite(I)){var z=I/E,$=m.layout==="vertical"?r.height:r.width;if(m.padding==="gap"&&(A=z*$/2),m.padding==="no-gap"){var G=gi(e.barCategoryGap,z*$),R=z*$/2;A=R-G-(R-G)/$*G}}}i==="xAxis"?j=[r.left+(w.left||0)+(A||0),r.left+r.width-(w.right||0)-(A||0)]:i==="yAxis"?j=l==="horizontal"?[r.top+r.height-(w.bottom||0),r.top+(w.top||0)]:[r.top+(w.top||0)+(A||0),r.top+r.height-(w.bottom||0)-(A||0)]:j=m.range,C&&(j=[j[1],j[0]]);var L=V8(m,o,h),W=L.scale,Y=L.realScaleType;W.domain(b).range(j),K8(W);var te=W8(W,Ho(Ho({},m),{},{realScaleType:Y}));i==="xAxis"?(O=y==="top"&&!S||y==="bottom"&&S,P=r.left,k=f[_]-O*m.height):i==="yAxis"&&(O=y==="left"&&!S||y==="right"&&S,P=f[_]-O*m.width,k=r.top);var me=Ho(Ho(Ho({},m),te),{},{realScaleType:Y,x:P,y:k,scale:W,width:i==="xAxis"?r.width:m.width,height:i==="yAxis"?r.height:m.height});return me.bandSize=vb(me,te),!m.hide&&i==="xAxis"?f[_]+=(O?-1:1)*me.height:m.hide||(f[_]+=(O?-1:1)*me.width),Ho(Ho({},p),{},Kw({},g,me))},{})},$K=function(e,n){var r=e.x,i=e.y,o=n.x,s=n.y;return{x:Math.min(r,o),y:Math.min(i,s),width:Math.abs(o-r),height:Math.abs(s-i)}},y2e=function(e){var n=e.x1,r=e.y1,i=e.x2,o=e.y2;return $K({x:n,y:r},{x:i,y:o})},LK=function(){function t(e){m2e(this,t),this.scale=e}return g2e(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.bandAware,o=r.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+s}case"end":{var c=this.bandwidth?this.bandwidth():0;return this.scale(n)+c}default:return this.scale(n)}if(i){var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+l}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),i=r[0],o=r[r.length-1];return i<=o?n>=i&&n<=o:n>=o&&n<=i}}],[{key:"create",value:function(n){return new t(n)}}])}();Kw(LK,"EPS",1e-4);var KP=function(e){var n=Object.keys(e).reduce(function(r,i){return Ho(Ho({},r),{},Kw({},i,LK.create(e[i])))},{});return Ho(Ho({},n),{},{apply:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=o.bandAware,c=o.position;return LRe(i,function(l,u){return n[u].apply(l,{bandAware:s,position:c})})},isInRange:function(i){return kK(i,function(o,s){return n[s].isInRange(o)})}})};function x2e(t){return(t%180+180)%180}var b2e=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=x2e(i),s=o*Math.PI/180,c=Math.atan(r/n),l=s>c&&s-1?i[o?e[s]:s]:void 0}}var A2e=_2e,j2e=EK;function E2e(t){var e=j2e(t),n=e%1;return e===e?n?e-n:e:0}var T2e=E2e,N2e=AV,P2e=ea,k2e=T2e,O2e=Math.max;function I2e(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:k2e(n);return i<0&&(i=O2e(r+i,0)),N2e(t,P2e(e),i)}var R2e=I2e,M2e=A2e,D2e=R2e,$2e=M2e(D2e),L2e=$2e;const F2e=dn(L2e);var B2e=_pe(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),WP=v.createContext(void 0),qP=v.createContext(void 0),FK=v.createContext(void 0),BK=v.createContext({}),UK=v.createContext(void 0),HK=v.createContext(0),zK=v.createContext(0),a$=function(e){var n=e.state,r=n.xAxisMap,i=n.yAxisMap,o=n.offset,s=e.clipPathId,c=e.children,l=e.width,u=e.height,d=B2e(o);return N.createElement(WP.Provider,{value:r},N.createElement(qP.Provider,{value:i},N.createElement(BK.Provider,{value:o},N.createElement(FK.Provider,{value:d},N.createElement(UK.Provider,{value:s},N.createElement(HK.Provider,{value:u},N.createElement(zK.Provider,{value:l},c)))))))},U2e=function(){return v.useContext(UK)},GK=function(e){var n=v.useContext(WP);n==null&&_u();var r=n[e];return r==null&&_u(),r},H2e=function(){var e=v.useContext(WP);return fc(e)},z2e=function(){var e=v.useContext(qP),n=F2e(e,function(r){return kK(r.domain,Number.isFinite)});return n||fc(e)},VK=function(e){var n=v.useContext(qP);n==null&&_u();var r=n[e];return r==null&&_u(),r},G2e=function(){var e=v.useContext(FK);return e},V2e=function(){return v.useContext(BK)},YP=function(){return v.useContext(zK)},QP=function(){return v.useContext(HK)};function wf(t){"@babel/helpers - typeof";return wf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wf(t)}function K2e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function W2e(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);nt*i)return!1;var o=n();return t*(e-t*o/2-r)>=0&&t*(e+t*o/2-i)<=0}function TMe(t,e){return JK(t,e+1)}function NMe(t,e,n,r,i){for(var o=(r||[]).slice(),s=e.start,c=e.end,l=0,u=1,d=s,f=function(){var g=r==null?void 0:r[l];if(g===void 0)return{v:JK(r,u)};var m=l,y,b=function(){return y===void 0&&(y=n(g,m)),y},x=g.coordinate,w=l===0||Fb(t,x,b,d,c);w||(l=0,d=s,u+=1),w&&(d=x+t*(b()/2+i),l+=u)},h;u<=o.length;)if(h=f(),h)return h.v;return[]}function tg(t){"@babel/helpers - typeof";return tg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tg(t)}function m$(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Jr(t){for(var e=1;e0?p.coordinate-y*t:p.coordinate})}else o[h]=p=Jr(Jr({},p),{},{tickCoord:p.coordinate});var b=Fb(t,p.tickCoord,m,c,l);b&&(l=p.tickCoord-t*(m()/2+i),o[h]=Jr(Jr({},p),{},{isShow:!0}))},d=s-1;d>=0;d--)u(d);return o}function RMe(t,e,n,r,i,o){var s=(r||[]).slice(),c=s.length,l=e.start,u=e.end;if(o){var d=r[c-1],f=n(d,c-1),h=t*(d.coordinate+t*f/2-u);s[c-1]=d=Jr(Jr({},d),{},{tickCoord:h>0?d.coordinate-h*t:d.coordinate});var p=Fb(t,d.tickCoord,function(){return f},l,u);p&&(u=d.tickCoord-t*(f/2+i),s[c-1]=Jr(Jr({},d),{},{isShow:!0}))}for(var g=o?c-1:c,m=function(x){var w=s[x],S,C=function(){return S===void 0&&(S=n(w,x)),S};if(x===0){var _=t*(w.coordinate-t*C()/2-l);s[x]=w=Jr(Jr({},w),{},{tickCoord:_<0?w.coordinate-_*t:w.coordinate})}else s[x]=w=Jr(Jr({},w),{},{tickCoord:w.coordinate});var A=Fb(t,w.tickCoord,C,l,u);A&&(l=w.tickCoord+t*(C()/2+i),s[x]=Jr(Jr({},w),{},{isShow:!0}))},y=0;y=2?mi(i[1].coordinate-i[0].coordinate):1,b=EMe(o,y,p);return l==="equidistantPreserveStart"?NMe(y,b,m,i,s):(l==="preserveStart"||l==="preserveStartEnd"?h=RMe(y,b,m,i,s,l==="preserveStartEnd"):h=IMe(y,b,m,i,s),h.filter(function(x){return x.isShow}))}var MMe=["viewBox"],DMe=["viewBox"],$Me=["ticks"];function _f(t){"@babel/helpers - typeof";return _f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_f(t)}function fd(){return fd=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function LMe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function FMe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v$(t,e){for(var n=0;n0?l(this.props):l(p)),s<=0||c<=0||!g||!g.length?null:N.createElement(Yt,{className:Mt("recharts-cartesian-axis",u),ref:function(y){r.layerReference=y}},o&&this.renderAxisLine(),this.renderTicks(g,this.state.fontSize,this.state.letterSpacing),Rr.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,i,o){var s;return N.isValidElement(r)?s=N.cloneElement(r,i):Ct(r)?s=r(i):s=N.createElement(wu,fd({},i,{className:"recharts-cartesian-axis-tick-value"}),o),s}}])}(v.Component);ek(dh,"displayName","CartesianAxis");ek(dh,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var KMe=["x1","y1","x2","y2","key"],WMe=["offset"];function Au(t){"@babel/helpers - typeof";return Au=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Au(t)}function y$(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ni(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function XMe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var JMe=function(e){var n=e.fill;if(!n||n==="none")return null;var r=e.fillOpacity,i=e.x,o=e.y,s=e.width,c=e.height,l=e.ry;return N.createElement("rect",{x:i,y:o,ry:l,width:s,height:c,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function tW(t,e){var n;if(N.isValidElement(t))n=N.cloneElement(t,e);else if(Ct(t))n=t(e);else{var r=e.x1,i=e.y1,o=e.x2,s=e.y2,c=e.key,l=x$(e,KMe),u=rt(l,!1);u.offset;var d=x$(u,WMe);n=N.createElement("line",Bl({},d,{x1:r,y1:i,x2:o,y2:s,fill:"none",key:c}))}return n}function ZMe(t){var e=t.x,n=t.width,r=t.horizontal,i=r===void 0?!0:r,o=t.horizontalPoints;if(!i||!o||!o.length)return null;var s=o.map(function(c,l){var u=ni(ni({},t),{},{x1:e,y1:c,x2:e+n,y2:c,key:"line-".concat(l),index:l});return tW(i,u)});return N.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function eDe(t){var e=t.y,n=t.height,r=t.vertical,i=r===void 0?!0:r,o=t.verticalPoints;if(!i||!o||!o.length)return null;var s=o.map(function(c,l){var u=ni(ni({},t),{},{x1:c,y1:e,x2:c,y2:e+n,key:"line-".concat(l),index:l});return tW(i,u)});return N.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function tDe(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,o=t.width,s=t.height,c=t.horizontalPoints,l=t.horizontal,u=l===void 0?!0:l;if(!u||!e||!e.length)return null;var d=c.map(function(h){return Math.round(h+i-i)}).sort(function(h,p){return h-p});i!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?i+s-h:d[p+1]-h;if(m<=0)return null;var y=p%e.length;return N.createElement("rect",{key:"react-".concat(p),y:h,x:r,height:m,width:o,stroke:"none",fill:e[y],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return N.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function nDe(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,o=t.x,s=t.y,c=t.width,l=t.height,u=t.verticalPoints;if(!n||!r||!r.length)return null;var d=u.map(function(h){return Math.round(h+o-o)}).sort(function(h,p){return h-p});o!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?o+c-h:d[p+1]-h;if(m<=0)return null;var y=p%r.length;return N.createElement("rect",{key:"react-".concat(p),x:h,y:s,width:m,height:l,stroke:"none",fill:r[y],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return N.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var rDe=function(e,n){var r=e.xAxis,i=e.width,o=e.height,s=e.offset;return G8(ZP(ni(ni(ni({},dh.defaultProps),r),{},{ticks:Ca(r,!0),viewBox:{x:0,y:0,width:i,height:o}})),s.left,s.left+s.width,n)},iDe=function(e,n){var r=e.yAxis,i=e.width,o=e.height,s=e.offset;return G8(ZP(ni(ni(ni({},dh.defaultProps),r),{},{ticks:Ca(r,!0),viewBox:{x:0,y:0,width:i,height:o}})),s.top,s.top+s.height,n)},Vu={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function ng(t){var e,n,r,i,o,s,c=YP(),l=QP(),u=V2e(),d=ni(ni({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:Vu.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:Vu.fill,horizontal:(r=t.horizontal)!==null&&r!==void 0?r:Vu.horizontal,horizontalFill:(i=t.horizontalFill)!==null&&i!==void 0?i:Vu.horizontalFill,vertical:(o=t.vertical)!==null&&o!==void 0?o:Vu.vertical,verticalFill:(s=t.verticalFill)!==null&&s!==void 0?s:Vu.verticalFill,x:Ae(t.x)?t.x:u.left,y:Ae(t.y)?t.y:u.top,width:Ae(t.width)?t.width:u.width,height:Ae(t.height)?t.height:u.height}),f=d.x,h=d.y,p=d.width,g=d.height,m=d.syncWithTicks,y=d.horizontalValues,b=d.verticalValues,x=H2e(),w=z2e();if(!Ae(p)||p<=0||!Ae(g)||g<=0||!Ae(f)||f!==+f||!Ae(h)||h!==+h)return null;var S=d.verticalCoordinatesGenerator||rDe,C=d.horizontalCoordinatesGenerator||iDe,_=d.horizontalPoints,A=d.verticalPoints;if((!_||!_.length)&&Ct(C)){var j=y&&y.length,P=C({yAxis:w?ni(ni({},w),{},{ticks:j?y:w.ticks}):void 0,width:c,height:l,offset:u},j?!0:m);ts(Array.isArray(P),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Au(P),"]")),Array.isArray(P)&&(_=P)}if((!A||!A.length)&&Ct(S)){var k=b&&b.length,O=S({xAxis:x?ni(ni({},x),{},{ticks:k?b:x.ticks}):void 0,width:c,height:l,offset:u},k?!0:m);ts(Array.isArray(O),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Au(O),"]")),Array.isArray(O)&&(A=O)}return N.createElement("g",{className:"recharts-cartesian-grid"},N.createElement(JMe,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),N.createElement(ZMe,Bl({},d,{offset:u,horizontalPoints:_,xAxis:x,yAxis:w})),N.createElement(eDe,Bl({},d,{offset:u,verticalPoints:A,xAxis:x,yAxis:w})),N.createElement(tDe,Bl({},d,{horizontalPoints:_})),N.createElement(nDe,Bl({},d,{verticalPoints:A})))}ng.displayName="CartesianGrid";var oDe=["layout","type","stroke","connectNulls","isRange","ref"],sDe=["key"],nW;function Af(t){"@babel/helpers - typeof";return Af=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Af(t)}function rW(t,e){if(t==null)return{};var n=aDe(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function aDe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Ul(){return Ul=Object.assign?Object.assign.bind():function(t){for(var e=1;e0||!Su(d,s)||!Su(f,c))?this.renderAreaWithAnimation(r,i):this.renderAreaStatically(s,c,r,i)}},{key:"render",value:function(){var r,i=this.props,o=i.hide,s=i.dot,c=i.points,l=i.className,u=i.top,d=i.left,f=i.xAxis,h=i.yAxis,p=i.width,g=i.height,m=i.isAnimationActive,y=i.id;if(o||!c||!c.length)return null;var b=this.state.isAnimationFinished,x=c.length===1,w=Mt("recharts-area",l),S=f&&f.allowDataOverflow,C=h&&h.allowDataOverflow,_=S||C,A=Dt(y)?this.id:y,j=(r=rt(s,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},P=j.r,k=P===void 0?3:P,O=j.strokeWidth,E=O===void 0?2:O,I=Nme(s)?s:{},D=I.clipDot,z=D===void 0?!0:D,$=k*2+E;return N.createElement(Yt,{className:w},S||C?N.createElement("defs",null,N.createElement("clipPath",{id:"clipPath-".concat(A)},N.createElement("rect",{x:S?d:d-p/2,y:C?u:u-g/2,width:S?p:p*2,height:C?g:g*2})),!z&&N.createElement("clipPath",{id:"clipPath-dots-".concat(A)},N.createElement("rect",{x:d-$/2,y:u-$/2,width:p+$,height:g+$}))):null,x?null:this.renderArea(_,A),(s||x)&&this.renderDots(_,z,A),(!m||b)&&Bs.renderCallByParent(this.props,c))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:i.curPoints,prevBaseLine:i.curBaseLine}:r.points!==i.curPoints||r.baseLine!==i.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(v.PureComponent);nW=rs;Is(rs,"displayName","Area");Is(rs,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!ns.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});Is(rs,"getBaseValue",function(t,e,n,r){var i=t.layout,o=t.baseValue,s=e.props.baseValue,c=s??o;if(Ae(c)&&typeof c=="number")return c;var l=i==="horizontal"?r:n,u=l.scale.domain();if(l.type==="number"){var d=Math.max(u[0],u[1]),f=Math.min(u[0],u[1]);return c==="dataMin"?f:c==="dataMax"||d<0?d:Math.max(Math.min(u[0],u[1]),0)}return c==="dataMin"?u[0]:c==="dataMax"?u[1]:u[0]});Is(rs,"getComposedData",function(t){var e=t.props,n=t.item,r=t.xAxis,i=t.yAxis,o=t.xAxisTicks,s=t.yAxisTicks,c=t.bandSize,l=t.dataKey,u=t.stackedData,d=t.dataStartIndex,f=t.displayedData,h=t.offset,p=e.layout,g=u&&u.length,m=nW.getBaseValue(e,n,r,i),y=p==="horizontal",b=!1,x=f.map(function(S,C){var _;g?_=u[d+C]:(_=ir(S,l),Array.isArray(_)?b=!0:_=[m,_]);var A=_[1]==null||g&&ir(S,l)==null;return y?{x:zM({axis:r,ticks:o,bandSize:c,entry:S,index:C}),y:A?null:i.scale(_[1]),value:_,payload:S}:{x:A?null:r.scale(_[1]),y:zM({axis:i,ticks:s,bandSize:c,entry:S,index:C}),value:_,payload:S}}),w;return g||b?w=x.map(function(S){var C=Array.isArray(S.value)?S.value[0]:null;return y?{x:S.x,y:C!=null&&S.y!=null?i.scale(C):null}:{x:C!=null?r.scale(C):null,y:S.y}}):w=y?i.scale(m):r.scale(m),nc({points:x,baseLine:w,layout:p,isRange:b},h)});Is(rs,"renderDotItem",function(t,e){var n;if(N.isValidElement(t))n=N.cloneElement(t,e);else if(Ct(t))n=t(e);else{var r=Mt("recharts-area-dot",typeof t!="boolean"?t.className:""),i=e.key,o=rW(e,sDe);n=N.createElement($g,Ul({},o,{key:i,className:r}))}return n});function jf(t){"@babel/helpers - typeof";return jf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jf(t)}function mDe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gDe(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function n$e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function r$e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i$e(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n0?s:e&&e.length&&Ae(i)&&Ae(o)?e.slice(i,o+1):[]};function xW(t){return t==="number"?[0,"auto"]:void 0}var cj=function(e,n,r,i){var o=e.graphicalItems,s=e.tooltipAxis,c=Xw(n,e);return r<0||!o||!o.length||r>=c.length?null:o.reduce(function(l,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:n;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=r&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var h;if(s.dataKey&&!s.allowDuplicatedCategory){var p=f===void 0?c:f;h=zx(p,s.dataKey,i)}else h=f&&f[r]||c[r];return h?[].concat(Nf(l),[Y8(u,h)]):l},[])},E$=function(e,n,r,i){var o=i||{x:e.chartX,y:e.chartY},s=g$e(o,r),c=e.orderedTooltipTicks,l=e.tooltipAxis,u=e.tooltipTicks,d=PTe(s,c,u,l);if(d>=0&&u){var f=u[d]&&u[d].value,h=cj(e,n,d,f),p=v$e(r,c,d,o);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},y$e=function(e,n){var r=n.axes,i=n.graphicalItems,o=n.axisType,s=n.axisIdKey,c=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,h=e.stackOffset,p=z8(d,o);return r.reduce(function(g,m){var y,b=m.type.defaultProps!==void 0?le(le({},m.type.defaultProps),m.props):m.props,x=b.type,w=b.dataKey,S=b.allowDataOverflow,C=b.allowDuplicatedCategory,_=b.scale,A=b.ticks,j=b.includeHidden,P=b[s];if(g[P])return g;var k=Xw(e.data,{graphicalItems:i.filter(function(te){var me,F=s in te.props?te.props[s]:(me=te.type.defaultProps)===null||me===void 0?void 0:me[s];return F===P}),dataStartIndex:l,dataEndIndex:u}),O=k.length,E,I,D;GDe(b.domain,S,x)&&(E=S1(b.domain,null,S),p&&(x==="number"||_!=="auto")&&(D=yp(k,w,"category")));var z=xW(x);if(!E||E.length===0){var $,G=($=b.domain)!==null&&$!==void 0?$:z;if(w){if(E=yp(k,w,x),x==="category"&&p){var R=bme(E);C&&R?(I=E,E=kb(0,O)):C||(E=WM(G,E,m).reduce(function(te,me){return te.indexOf(me)>=0?te:[].concat(Nf(te),[me])},[]))}else if(x==="category")C?E=E.filter(function(te){return te!==""&&!Dt(te)}):E=WM(G,E,m).reduce(function(te,me){return te.indexOf(me)>=0||me===""||Dt(me)?te:[].concat(Nf(te),[me])},[]);else if(x==="number"){var L=MTe(k,i.filter(function(te){var me,F,se=s in te.props?te.props[s]:(me=te.type.defaultProps)===null||me===void 0?void 0:me[s],ne="hide"in te.props?te.props.hide:(F=te.type.defaultProps)===null||F===void 0?void 0:F.hide;return se===P&&(j||!ne)}),w,o,d);L&&(E=L)}p&&(x==="number"||_!=="auto")&&(D=yp(k,w,"category"))}else p?E=kb(0,O):c&&c[P]&&c[P].hasStack&&x==="number"?E=h==="expand"?[0,1]:q8(c[P].stackGroups,l,u):E=H8(k,i.filter(function(te){var me=s in te.props?te.props[s]:te.type.defaultProps[s],F="hide"in te.props?te.props.hide:te.type.defaultProps.hide;return me===P&&(j||!F)}),x,d,!0);if(x==="number")E=oj(f,E,P,o,A),G&&(E=S1(G,E,S));else if(x==="category"&&G){var W=G,Y=E.every(function(te){return W.indexOf(te)>=0});Y&&(E=W)}}return le(le({},g),{},Et({},P,le(le({},b),{},{axisType:o,domain:E,categoricalDomain:D,duplicateDomain:I,originalDomain:(y=b.domain)!==null&&y!==void 0?y:z,isCategorical:p,layout:d})))},{})},x$e=function(e,n){var r=n.graphicalItems,i=n.Axis,o=n.axisType,s=n.axisIdKey,c=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,h=Xw(e.data,{graphicalItems:r,dataStartIndex:l,dataEndIndex:u}),p=h.length,g=z8(d,o),m=-1;return r.reduce(function(y,b){var x=b.type.defaultProps!==void 0?le(le({},b.type.defaultProps),b.props):b.props,w=x[s],S=xW("number");if(!y[w]){m++;var C;return g?C=kb(0,p):c&&c[w]&&c[w].hasStack?(C=q8(c[w].stackGroups,l,u),C=oj(f,C,w,o)):(C=S1(S,H8(h,r.filter(function(_){var A,j,P=s in _.props?_.props[s]:(A=_.type.defaultProps)===null||A===void 0?void 0:A[s],k="hide"in _.props?_.props.hide:(j=_.type.defaultProps)===null||j===void 0?void 0:j.hide;return P===w&&!k}),"number",d),i.defaultProps.allowDataOverflow),C=oj(f,C,w,o)),le(le({},y),{},Et({},w,le(le({axisType:o},i.defaultProps),{},{hide:!0,orientation:to(p$e,"".concat(o,".").concat(m%2),null),domain:C,originalDomain:S,isCategorical:g,layout:d})))}return y},{})},b$e=function(e,n){var r=n.axisType,i=r===void 0?"xAxis":r,o=n.AxisComp,s=n.graphicalItems,c=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,d=e.children,f="".concat(i,"Id"),h=jo(d,o),p={};return h&&h.length?p=y$e(e,{axes:h,graphicalItems:s,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:l,dataEndIndex:u}):s&&s.length&&(p=x$e(e,{Axis:o,graphicalItems:s,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:l,dataEndIndex:u})),p},w$e=function(e){var n=fc(e),r=Ca(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:yP(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:vb(n,r)}},T$=function(e){var n=e.children,r=e.defaultShowTooltip,i=Ki(n,xf),o=0,s=0;return e.data&&e.data.length!==0&&(s=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(s=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!r}},S$e=function(e){return!e||!e.length?!1:e.some(function(n){var r=ja(n&&n.type);return r&&r.indexOf("Bar")>=0})},N$=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},C$e=function(e,n){var r=e.props,i=e.graphicalItems,o=e.xAxisMap,s=o===void 0?{}:o,c=e.yAxisMap,l=c===void 0?{}:c,u=r.width,d=r.height,f=r.children,h=r.margin||{},p=Ki(f,xf),g=Ki(f,Ea),m=Object.keys(l).reduce(function(C,_){var A=l[_],j=A.orientation;return!A.mirror&&!A.hide?le(le({},C),{},Et({},j,C[j]+A.width)):C},{left:h.left||0,right:h.right||0}),y=Object.keys(s).reduce(function(C,_){var A=s[_],j=A.orientation;return!A.mirror&&!A.hide?le(le({},C),{},Et({},j,to(C,"".concat(j))+A.height)):C},{top:h.top||0,bottom:h.bottom||0}),b=le(le({},y),m),x=b.bottom;p&&(b.bottom+=p.props.height||xf.defaultProps.height),g&&n&&(b=ITe(b,i,r,n));var w=u-b.left-b.right,S=d-b.top-b.bottom;return le(le({brushBottom:x},b),{},{width:Math.max(w,0),height:Math.max(S,0)})},_$e=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},Jw=function(e){var n=e.chartName,r=e.GraphicalChild,i=e.defaultTooltipEventType,o=i===void 0?"axis":i,s=e.validateTooltipEventTypes,c=s===void 0?["axis"]:s,l=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,f=e.defaultProps,h=function(y,b){var x=b.graphicalItems,w=b.stackGroups,S=b.offset,C=b.updateId,_=b.dataStartIndex,A=b.dataEndIndex,j=y.barSize,P=y.layout,k=y.barGap,O=y.barCategoryGap,E=y.maxBarSize,I=N$(P),D=I.numericAxisName,z=I.cateAxisName,$=S$e(x),G=[];return x.forEach(function(R,L){var W=Xw(y.data,{graphicalItems:[R],dataStartIndex:_,dataEndIndex:A}),Y=R.type.defaultProps!==void 0?le(le({},R.type.defaultProps),R.props):R.props,te=Y.dataKey,me=Y.maxBarSize,F=Y["".concat(D,"Id")],se=Y["".concat(z,"Id")],ne={},ae=l.reduce(function(U,V){var Q=b["".concat(V.axisType,"Map")],B=Y["".concat(V.axisType,"Id")];Q&&Q[B]||V.axisType==="zAxis"||_u();var X=Q[B];return le(le({},U),{},Et(Et({},V.axisType,X),"".concat(V.axisType,"Ticks"),Ca(X)))},ne),De=ae[z],de=ae["".concat(z,"Ticks")],ye=w&&w[F]&&w[F].hasStack&>e(R,w[F].stackGroups),Ee=ja(R.type).indexOf("Bar")>=0,Z=vb(De,de),ct=[],Le=$&&kTe({barSize:j,stackGroups:w,totalSize:_$e(ae,z)});if(Ee){var At,lt,Jt=Dt(me)?E:me,T=(At=(lt=vb(De,de,!0))!==null&<!==void 0?lt:Jt)!==null&&At!==void 0?At:0;ct=OTe({barGap:k,barCategoryGap:O,bandSize:T!==Z?T:Z,sizeList:Le[se],maxBarSize:Jt}),T!==Z&&(ct=ct.map(function(U){return le(le({},U),{},{position:le(le({},U.position),{},{offset:U.position.offset-T/2})})}))}var M=R&&R.type&&R.type.getComposedData;M&&G.push({props:le(le({},M(le(le({},ae),{},{displayedData:W,props:y,dataKey:te,item:R,bandSize:Z,barPosition:ct,offset:S,stackedData:ye,layout:P,dataStartIndex:_,dataEndIndex:A}))),{},Et(Et(Et({key:R.key||"item-".concat(L)},D,ae[D]),z,ae[z]),"animationId",C)),childIndex:Ome(R,y.children),item:R})}),G},p=function(y,b){var x=y.props,w=y.dataStartIndex,S=y.dataEndIndex,C=y.updateId;if(!BR({props:x}))return null;var _=x.children,A=x.layout,j=x.stackOffset,P=x.data,k=x.reverseStackOrder,O=N$(A),E=O.numericAxisName,I=O.cateAxisName,D=jo(_,r),z=HTe(P,D,"".concat(E,"Id"),"".concat(I,"Id"),j,k),$=l.reduce(function(Y,te){var me="".concat(te.axisType,"Map");return le(le({},Y),{},Et({},me,b$e(x,le(le({},te),{},{graphicalItems:D,stackGroups:te.axisType===E&&z,dataStartIndex:w,dataEndIndex:S}))))},{}),G=C$e(le(le({},$),{},{props:x,graphicalItems:D}),b==null?void 0:b.legendBBox);Object.keys($).forEach(function(Y){$[Y]=d(x,$[Y],G,Y.replace("Map",""),n)});var R=$["".concat(I,"Map")],L=w$e(R),W=h(x,le(le({},$),{},{dataStartIndex:w,dataEndIndex:S,updateId:C,graphicalItems:D,stackGroups:z,offset:G}));return le(le({formattedGraphicalItems:W,graphicalItems:D,offset:G,stackGroups:z},L),$)},g=function(m){function y(b){var x,w,S;return r$e(this,y),S=s$e(this,y,[b]),Et(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Et(S,"accessibilityManager",new zDe),Et(S,"handleLegendBBoxUpdate",function(C){if(C){var _=S.state,A=_.dataStartIndex,j=_.dataEndIndex,P=_.updateId;S.setState(le({legendBBox:C},p({props:S.props,dataStartIndex:A,dataEndIndex:j,updateId:P},le(le({},S.state),{},{legendBBox:C}))))}}),Et(S,"handleReceiveSyncEvent",function(C,_,A){if(S.props.syncId===C){if(A===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(_)}}),Et(S,"handleBrushChange",function(C){var _=C.startIndex,A=C.endIndex;if(_!==S.state.dataStartIndex||A!==S.state.dataEndIndex){var j=S.state.updateId;S.setState(function(){return le({dataStartIndex:_,dataEndIndex:A},p({props:S.props,dataStartIndex:_,dataEndIndex:A,updateId:j},S.state))}),S.triggerSyncEvent({dataStartIndex:_,dataEndIndex:A})}}),Et(S,"handleMouseEnter",function(C){var _=S.getMouseInfo(C);if(_){var A=le(le({},_),{},{isTooltipActive:!0});S.setState(A),S.triggerSyncEvent(A);var j=S.props.onMouseEnter;Ct(j)&&j(A,C)}}),Et(S,"triggeredAfterMouseMove",function(C){var _=S.getMouseInfo(C),A=_?le(le({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(A),S.triggerSyncEvent(A);var j=S.props.onMouseMove;Ct(j)&&j(A,C)}),Et(S,"handleItemMouseEnter",function(C){S.setState(function(){return{isTooltipActive:!0,activeItem:C,activePayload:C.tooltipPayload,activeCoordinate:C.tooltipPosition||{x:C.cx,y:C.cy}}})}),Et(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),Et(S,"handleMouseMove",function(C){C.persist(),S.throttleTriggeredAfterMouseMove(C)}),Et(S,"handleMouseLeave",function(C){S.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};S.setState(_),S.triggerSyncEvent(_);var A=S.props.onMouseLeave;Ct(A)&&A(_,C)}),Et(S,"handleOuterEvent",function(C){var _=kme(C),A=to(S.props,"".concat(_));if(_&&Ct(A)){var j,P;/.*touch.*/i.test(_)?P=S.getMouseInfo(C.changedTouches[0]):P=S.getMouseInfo(C),A((j=P)!==null&&j!==void 0?j:{},C)}}),Et(S,"handleClick",function(C){var _=S.getMouseInfo(C);if(_){var A=le(le({},_),{},{isTooltipActive:!0});S.setState(A),S.triggerSyncEvent(A);var j=S.props.onClick;Ct(j)&&j(A,C)}}),Et(S,"handleMouseDown",function(C){var _=S.props.onMouseDown;if(Ct(_)){var A=S.getMouseInfo(C);_(A,C)}}),Et(S,"handleMouseUp",function(C){var _=S.props.onMouseUp;if(Ct(_)){var A=S.getMouseInfo(C);_(A,C)}}),Et(S,"handleTouchMove",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(C.changedTouches[0])}),Et(S,"handleTouchStart",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseDown(C.changedTouches[0])}),Et(S,"handleTouchEnd",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseUp(C.changedTouches[0])}),Et(S,"triggerSyncEvent",function(C){S.props.syncId!==void 0&&EC.emit(TC,S.props.syncId,C,S.eventEmitterSymbol)}),Et(S,"applySyncEvent",function(C){var _=S.props,A=_.layout,j=_.syncMethod,P=S.state.updateId,k=C.dataStartIndex,O=C.dataEndIndex;if(C.dataStartIndex!==void 0||C.dataEndIndex!==void 0)S.setState(le({dataStartIndex:k,dataEndIndex:O},p({props:S.props,dataStartIndex:k,dataEndIndex:O,updateId:P},S.state)));else if(C.activeTooltipIndex!==void 0){var E=C.chartX,I=C.chartY,D=C.activeTooltipIndex,z=S.state,$=z.offset,G=z.tooltipTicks;if(!$)return;if(typeof j=="function")D=j(G,C);else if(j==="value"){D=-1;for(var R=0;R=0){var ye,Ee;if(E.dataKey&&!E.allowDuplicatedCategory){var Z=typeof E.dataKey=="function"?de:"payload.".concat(E.dataKey.toString());ye=zx(R,Z,D),Ee=L&&W&&zx(W,Z,D)}else ye=R==null?void 0:R[I],Ee=L&&W&&W[I];if(se||F){var ct=C.props.activeIndex!==void 0?C.props.activeIndex:I;return[v.cloneElement(C,le(le(le({},j.props),ae),{},{activeIndex:ct})),null,null]}if(!Dt(ye))return[De].concat(Nf(S.renderActivePoints({item:j,activePoint:ye,basePoint:Ee,childIndex:I,isRange:L})))}else{var Le,At=(Le=S.getItemByXY(S.state.activeCoordinate))!==null&&Le!==void 0?Le:{graphicalItem:De},lt=At.graphicalItem,Jt=lt.item,T=Jt===void 0?C:Jt,M=lt.childIndex,U=le(le(le({},j.props),ae),{},{activeIndex:M});return[v.cloneElement(T,U),null,null]}return L?[De,null,null]:[De,null]}),Et(S,"renderCustomized",function(C,_,A){return v.cloneElement(C,le(le({key:"recharts-customized-".concat(A)},S.props),S.state))}),Et(S,"renderMap",{CartesianGrid:{handler:Iv,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:Iv},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:Iv},YAxis:{handler:Iv},Brush:{handler:S.renderBrush,once:!0},Bar:{handler:S.renderGraphicChild},Line:{handler:S.renderGraphicChild},Area:{handler:S.renderGraphicChild},Radar:{handler:S.renderGraphicChild},RadialBar:{handler:S.renderGraphicChild},Scatter:{handler:S.renderGraphicChild},Pie:{handler:S.renderGraphicChild},Funnel:{handler:S.renderGraphicChild},Tooltip:{handler:S.renderCursor,once:!0},PolarGrid:{handler:S.renderPolarGrid,once:!0},PolarAngleAxis:{handler:S.renderPolarAxis},PolarRadiusAxis:{handler:S.renderPolarAxis},Customized:{handler:S.renderCustomized}}),S.clipPathId="".concat((x=b.id)!==null&&x!==void 0?x:th("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=FV(S.triggeredAfterMouseMove,(w=b.throttleDelay)!==null&&w!==void 0?w:1e3/60),S.state={},S}return l$e(y,m),o$e(y,[{key:"componentDidMount",value:function(){var x,w;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(x=this.props.margin.left)!==null&&x!==void 0?x:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var x=this.props,w=x.children,S=x.data,C=x.height,_=x.layout,A=Ki(w,ei);if(A){var j=A.props.defaultIndex;if(!(typeof j!="number"||j<0||j>this.state.tooltipTicks.length-1)){var P=this.state.tooltipTicks[j]&&this.state.tooltipTicks[j].value,k=cj(this.state,S,j,P),O=this.state.tooltipTicks[j].coordinate,E=(this.state.offset.top+C)/2,I=_==="horizontal",D=I?{x:O,y:E}:{y:O,x:E},z=this.state.formattedGraphicalItems.find(function(G){var R=G.item;return R.type.name==="Scatter"});z&&(D=le(le({},D),z.props.points[j].tooltipPosition),k=z.props.points[j].tooltipPayload);var $={activeTooltipIndex:j,isTooltipActive:!0,activeLabel:P,activePayload:k,activeCoordinate:D};this.setState($),this.renderCursor(A),this.accessibilityManager.setIndex(j)}}}},{key:"getSnapshotBeforeUpdate",value:function(x,w){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==w.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==x.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==x.margin){var S,C;this.accessibilityManager.setDetails({offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0}})}return null}},{key:"componentDidUpdate",value:function(x){$A([Ki(x.children,ei)],[Ki(this.props.children,ei)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var x=Ki(this.props.children,ei);if(x&&typeof x.props.shared=="boolean"){var w=x.props.shared?"axis":"item";return c.indexOf(w)>=0?w:o}return o}},{key:"getMouseInfo",value:function(x){if(!this.container)return null;var w=this.container,S=w.getBoundingClientRect(),C=iAe(S),_={chartX:Math.round(x.pageX-C.left),chartY:Math.round(x.pageY-C.top)},A=S.width/w.offsetWidth||1,j=this.inRange(_.chartX,_.chartY,A);if(!j)return null;var P=this.state,k=P.xAxisMap,O=P.yAxisMap,E=this.getTooltipEventType();if(E!=="axis"&&k&&O){var I=fc(k).scale,D=fc(O).scale,z=I&&I.invert?I.invert(_.chartX):null,$=D&&D.invert?D.invert(_.chartY):null;return le(le({},_),{},{xValue:z,yValue:$})}var G=E$(this.state,this.props.data,this.props.layout,j);return G?le(le({},_),G):null}},{key:"inRange",value:function(x,w){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,C=this.props.layout,_=x/S,A=w/S;if(C==="horizontal"||C==="vertical"){var j=this.state.offset,P=_>=j.left&&_<=j.left+j.width&&A>=j.top&&A<=j.top+j.height;return P?{x:_,y:A}:null}var k=this.state,O=k.angleAxisMap,E=k.radiusAxisMap;if(O&&E){var I=fc(O);return QM({x:_,y:A},I)}return null}},{key:"parseEventsOfWrapper",value:function(){var x=this.props.children,w=this.getTooltipEventType(),S=Ki(x,ei),C={};S&&w==="axis"&&(S.props.trigger==="click"?C={onClick:this.handleClick}:C={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var _=Gx(this.props,this.handleOuterEvent);return le(le({},_),C)}},{key:"addListener",value:function(){EC.on(TC,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){EC.removeListener(TC,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(x,w,S){for(var C=this.state.formattedGraphicalItems,_=0,A=C.length;_{var g;const[r,i]=v.useState([{name:"Very Positive",value:0,color:"#4ade80"},{name:"Positive",value:0,color:"#a3e635"},{name:"Neutral",value:0,color:"#93c5fd"},{name:"Negative",value:0,color:"#fb923c"},{name:"Very Negative",value:0,color:"#f87171"}]),[o,s]=v.useState([]),[c,l]=v.useState({}),[u,d]=v.useState({isBalanced:!1,score:0,reason:""}),f=m=>{const y=n.find(b=>b.id===m);return y?y.name:`Participant ${m}`};v.useEffect(()=>{if(t.length===0)return;const m={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0},y={},b={};t.forEach(S=>{if(S.senderId!=="moderator"&&S.senderId!=="facilitator"){const C=S.text.toLowerCase();let _="Neutral";C.includes("love")||C.includes("excellent")||C.includes("amazing")?_="Very Positive":C.includes("good")||C.includes("like")||C.includes("great")?_="Positive":C.includes("bad")||C.includes("issue")||C.includes("problem")?_="Negative":(C.includes("terrible")||C.includes("hate")||C.includes("awful"))&&(_="Very Negative"),m[_]++,b[S.senderId]||(b[S.senderId]={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0}),b[S.senderId][_]++,y[S.senderId]=(y[S.senderId]||0)+1}}),i(S=>S.map(C=>({...C,value:m[C.name]||0})));const x=Object.entries(y).map(([S,C])=>({name:f(S),messages:C}));s(x);const w={};Object.entries(b).forEach(([S,C])=>{w[S]={name:f(S),sentiments:C}}),l(w),h(y,b)},[t,n,f]);const h=(m,y)=>{if(Object.keys(m).length===0){d({isBalanced:!1,score:0,reason:"No participant data available"});return}const x=Object.values(m).reduce((G,R)=>G+R,0)/Object.keys(m).length,w=Object.values(m).map(G=>Math.abs(G-x)/x),S=w.reduce((G,R)=>G+R,0)/w.length,C=Object.values(y).map(G=>Object.values(G).filter(R=>R>0).length),_=C.reduce((G,R)=>G+R,0)/C.length,A=["Very Positive","Positive","Neutral","Negative","Very Negative"],j=Object.values(y).map(G=>{const R=Math.max(...Object.values(G));return A.find(L=>G[L]===R)||"Neutral"}),P=new Set(j).size,k=P/A.length,O=Math.max(0,100-S*100),E=_/5*100,I=k*100,D=Math.round(O*.6+E*.2+I*.2);let z="";const $=D>=70;S>.3&&(z+="Participation is uneven among participants. "),_<2&&(z+="Limited range of sentiments expressed. "),P<=1?z+="Participants show similar sentiment patterns, suggesting potential group-think. ":P>=4&&(z+="Wide divergence in participant sentiments, showing healthy diversity of opinions. "),z===""&&(z=$?"Good mix of participation and diverse opinions.":"Multiple factors affecting balance."),d({isBalanced:$,score:D,reason:z})},p=m=>{const y=c[m];if(!y)return"N/A";const b=y.sentiments;let x=0,w="Neutral";return Object.entries(b).forEach(([S,C])=>{C>x&&(x=C,w=S)}),w};return a.jsx("div",{className:"glass-panel rounded-xl p-4",children:a.jsxs(dl,{defaultValue:"sentiment",children:[a.jsxs(Va,{className:"grid grid-cols-2 mb-4",children:[a.jsxs(gn,{value:"sentiment",className:"flex items-center",children:[a.jsx(VJ,{className:"h-4 w-4 mr-2"}),"Sentiment"]}),a.jsxs(gn,{value:"participation",className:"flex items-center",children:[a.jsx(B_,{className:"h-4 w-4 mr-2"}),"Participation"]})]}),a.jsx(vn,{value:"sentiment",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"Sentiment Analysis"}),a.jsxs("div",{className:`px-3 py-1 rounded-full text-sm ${u.isBalanced?"bg-green-100 text-green-800":"bg-amber-100 text-amber-800"}`,children:["Balance score: ",u.score,"/100"]})]}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(tk,{children:[a.jsx(ei,{}),a.jsx(gs,{data:r,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:m,percent:y})=>y>0?`${m} ${(y*100).toFixed(0)}%`:"",children:r.map((m,y)=>a.jsx(Og,{fill:m.color},`cell-${y}`))}),a.jsx(Ea,{})]})})}),a.jsxs("div",{className:"mt-4",children:[a.jsx("h4",{className:"text-sm font-medium mb-2",children:"Sentiment by Participant"}),a.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto pr-2",children:Object.entries(c).map(([m,y])=>{var w;const b=p(m),x=((w=r.find(S=>S.name===b))==null?void 0:w.color)||"#93c5fd";return a.jsxs("div",{className:"flex items-center justify-between p-2 bg-slate-50 rounded",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(qp,{className:"h-4 w-4 text-slate-400 mr-2"}),a.jsx("span",{className:"text-sm",children:y.name})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("span",{className:"text-xs mr-2",children:"Predominant:"}),a.jsx("span",{className:"text-xs font-medium px-2 py-0.5 rounded",style:{backgroundColor:`${x}30`,color:x},children:b})]})]},m)})})]}),a.jsxs("div",{className:"mt-4 pt-4 border-t",children:[a.jsx("h4",{className:"text-sm font-medium mb-2",children:"Focus Group Balance Assessment"}),a.jsxs("div",{className:`p-3 rounded text-sm ${u.isBalanced?"bg-green-50 text-green-700":"bg-amber-50 text-amber-700"}`,children:[a.jsx("span",{className:"font-medium",children:u.isBalanced?"Balanced Focus Group":"Potential Balance Issues"}),a.jsx("p",{className:"mt-1 text-xs",children:u.reason})]})]})]})})}),a.jsx(vn,{value:"participation",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"pt-6",children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Participation Distribution"}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(bW,{data:o,layout:"vertical",margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(ng,{strokeDasharray:"3 3"}),a.jsx(rl,{type:"number"}),a.jsx(il,{dataKey:"name",type:"category",width:100}),a.jsx(ei,{}),a.jsx(gl,{dataKey:"messages",fill:"#8884d8",name:"Messages"})]})})}),a.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:o.length>0?`Most active: ${(g=o.sort((m,y)=>y.messages-m.messages)[0])==null?void 0:g.name}`:"No participation data available"})]})})})]})})};function E$e(t){if(console.log("šŸ” [GPT-5 CONVERTER] Input wsMessage:",JSON.stringify(t,null,2)),!t)return console.error("šŸ” [GPT-5 CONVERTER] ERROR: wsMessage is null/undefined"),null;const e={id:t.id,senderId:t.senderId,text:t.text,timestamp:new Date(t.timestamp),type:t.type,highlighted:t.highlighted,attached_assets:t.attached_assets||[],activates_visual_context:t.activates_visual_context||!1};return console.log("šŸ” [GPT-5 CONVERTER] Output converted:",JSON.stringify(e,null,2)),e}function T$e(t){return{id:t.id,title:t.title,description:t.description,quotes:t.quotes,source:t.source,created_at:t.created_at}}function SW(){return!0}const N$e=({focusGroupId:t,personas:e,isVisible:n,onToggle:r})=>{const[i,o]=v.useState(null),[s,c]=v.useState(null),[l,u]=v.useState(null),[d,f]=v.useState(null),[h,p]=v.useState(!1),[g,m]=v.useState(null),[y,b]=v.useState(null);Xs();const x=SW();v.useEffect(()=>{if(!(!n||!t))return S(),console.log("šŸ“Š Setting up STABLE WebSocket event listeners for dashboard"),console.log("šŸ“Š Dashboard WebSocket listeners temporarily disabled for GPT-5 fix"),()=>{console.log("šŸ“Š Cleaning up STABLE dashboard WebSocket listeners")}},[n,t,x,!0]);const S=async()=>{p(!0),m(null);try{const[P,k,O,E]=await Promise.allSettled([Xn.getConversationAnalytics(t),Xn.getConversationState(t),Xn.getAutonomousConversationStatus(t),Xn.getConversationInsights(t)]);P.status==="fulfilled"&&o(P.value.data.analytics),k.status==="fulfilled"&&c(k.value.data.state),O.status==="fulfilled"&&u(O.value.data.status),E.status==="fulfilled"&&f(E.value.data.insights),b(new Date)}catch(P){console.error("Error fetching dashboard data:",P),m("Failed to load dashboard data")}finally{p(!1)}},C=()=>{S()},_=P=>{switch(P){case"running":return"bg-green-500";case"paused":return"bg-amber-500";case"completed":return"bg-blue-500";case"error":return"bg-red-500";default:return"bg-gray-500"}},A=P=>{switch(P){case"positive":return"text-green-600";case"negative":return"text-red-600";default:return"text-gray-600"}},j=P=>{switch(P){case"excellent":return"text-green-600";case"good":return"text-blue-600";case"fair":return"text-amber-600";case"poor":return"text-red-600";default:return"text-gray-600"}};return n?a.jsxs("div",{className:"fixed right-4 top-4 bottom-4 w-80 bg-white rounded-lg shadow-lg border border-gray-200 flex flex-col overflow-hidden z-50",children:[a.jsxs("div",{className:"p-4 border-b border-gray-200 bg-gray-50",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ya,{className:"h-5 w-5 text-blue-600"}),a.jsx("h3",{className:"font-semibold text-gray-900",children:"AI Dashboard"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(J,{variant:"ghost",size:"sm",onClick:C,disabled:h,className:"p-1",children:a.jsx(wd,{className:`h-4 w-4 ${h?"animate-spin":""}`})}),a.jsx(J,{variant:"ghost",size:"sm",onClick:r,className:"p-1",children:a.jsx(QJ,{className:"h-4 w-4"})})]})]}),y&&a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Last updated: ",y.toLocaleTimeString()]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[g&&a.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(KJ,{className:"h-4 w-4 text-red-600"}),a.jsx("span",{className:"text-sm text-red-800",children:g})]})}),l&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${_(l.conversation_state)}`}),"Autonomous Status"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"State:"}),a.jsx(Sr,{variant:l.conversation_state==="running"?"default":"secondary",children:l.conversation_state})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Actions:"}),a.jsx("span",{className:"font-medium",children:l.action_count||0})]})]})})]}),s&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(pa,{className:"h-4 w-4"}),"Conversation Health"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm",children:"Overall Health:"}),a.jsx(Sr,{className:j(s.conversation_health.status),children:s.conversation_health.status})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Score:"}),a.jsxs("span",{className:"font-medium",children:[s.conversation_health.score,"/100"]})]}),a.jsx(Rl,{value:s.conversation_health.score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("span",{className:"text-xs text-gray-600",children:"Indicators:"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:s.conversation_health.indicators.map((P,k)=>a.jsx(Sr,{variant:"outline",className:"text-xs",children:P.replace("_"," ")},k))})]})]})})]}),i&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(Dr,{className:"h-4 w-4"}),"Participation"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-semibold text-blue-600",children:i.overview.active_participants}),a.jsx("div",{className:"text-xs text-gray-600",children:"Active"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-semibold text-green-600",children:i.overview.participant_messages}),a.jsx("div",{className:"text-xs text-gray-600",children:"Messages"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Balance:"}),a.jsx(Sr,{variant:i.participation.participation_balance==="balanced"?"default":"secondary",children:i.participation.participation_balance.replace("_"," ")})]}),i.participation.dominant_participants.length>0&&a.jsxs("div",{className:"text-xs text-amber-600",children:["Dominant: ",i.participation.dominant_participants.length," participant(s)"]}),i.participation.quiet_participants.length>0&&a.jsxs("div",{className:"text-xs text-blue-600",children:["Quiet: ",i.participation.quiet_participants.length," participant(s)"]})]})]})})]}),i&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(pZ,{className:"h-4 w-4"}),"Sentiment"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm",children:"Overall:"}),a.jsx(Sr,{className:A(i.sentiment_analysis.overall_sentiment),children:i.sentiment_analysis.overall_sentiment})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-xs",children:[a.jsxs("span",{children:["Positive: ",i.sentiment_analysis.sentiment_distribution.positive]}),a.jsxs("span",{children:["Neutral: ",i.sentiment_analysis.sentiment_distribution.neutral]}),a.jsxs("span",{children:["Negative: ",i.sentiment_analysis.sentiment_distribution.negative]})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Trend:"}),a.jsx("span",{className:"font-medium",children:i.sentiment_analysis.sentiment_trend})]})]})]})})]}),i&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(GJ,{className:"h-4 w-4"}),"Quality Metrics"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Engagement:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(i.quality_metrics.engagement_score),"/100"]})]}),a.jsx(Rl,{value:i.quality_metrics.engagement_score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Depth:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(i.quality_metrics.depth_score),"/100"]})]}),a.jsx(Rl,{value:i.quality_metrics.depth_score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Overall:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(i.quality_metrics.quality_score),"/100"]})]}),a.jsx(Rl,{value:i.quality_metrics.quality_score,className:"h-2"})]})]})})]}),d&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(uu,{className:"h-4 w-4"}),"AI Insights"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Energy:"}),a.jsx(Sr,{variant:d.conversation_energy==="high"?"default":"secondary",children:d.conversation_energy})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Engagement:"}),a.jsx(Sr,{variant:d.topic_engagement==="high"?"default":"secondary",children:d.topic_engagement})]}),d.next_suggested_action&&a.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-2 mt-2",children:a.jsxs("div",{className:"text-xs text-blue-800",children:[a.jsx("strong",{children:"Suggestion:"})," ",d.next_suggested_action]})})]})})]}),i&&i.recommendations.length>0&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(IE,{className:"h-4 w-4"}),"Recommendations"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsx("div",{className:"space-y-2",children:i.recommendations.map((P,k)=>a.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-2",children:a.jsx("div",{className:"text-xs text-amber-800",children:P})},k))})})]})]})]}):null},P$e=({discussionGuide:t,moderatorStatus:e,onSectionSelect:n,onSetPosition:r,onSave:i,focusGroupId:o,isOpen:s,onToggle:c,className:l,onEditingChange:u})=>{const d=v.useRef(!1),f=v.useCallback(y=>{d.current=y,u==null||u(y)},[u]),[h,p]=v.useState(!1),g=async()=>{if(!t){re.error("No discussion guide available",{description:"The discussion guide is not available for download"});return}p(!0);try{await Ot.downloadDiscussionGuide(o),re.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(y){console.error("Error downloading discussion guide:",y),re.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{p(!1)}},m=t&&typeof t=="object"&&t.sections;return a.jsx("div",{className:Ne("w-full border-b bg-white shadow-sm",l),children:a.jsxs(_g,{open:s,onOpenChange:c,children:[a.jsx(Ag,{asChild:!0,children:a.jsxs("div",{className:"w-full px-4 py-3 flex items-center justify-between hover:bg-slate-50 transition-colors cursor-pointer",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(YJ,{className:"h-5 w-5 text-slate-600"}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-semibold text-slate-900",children:"Discussion Guide"}),m&&a.jsxs("p",{className:"text-xs text-slate-500",children:[t.title," • ",t.total_duration," minutes"]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(J,{variant:"ghost",size:"sm",onClick:y=>{y.stopPropagation(),g()},disabled:!t||h,className:"h-8",children:h?a.jsx(Ds,{className:"h-4 w-4 animate-spin"}):a.jsx(lu,{className:"h-4 w-4"})}),s?a.jsx(cu,{className:"h-4 w-4 text-slate-500"}):a.jsx(Ma,{className:"h-4 w-4 text-slate-500"})]})]})}),a.jsx(jg,{children:a.jsx("div",{className:"border-t bg-slate-50",children:a.jsx(gt,{className:"mx-4 mb-4 mt-2",children:a.jsx(Rt,{className:"p-4",children:a.jsx("div",{className:"max-h-[70vh] overflow-y-auto",children:a.jsx(GN,{discussionGuide:t,moderatorStatus:e,onSectionSelect:n,onSetPosition:r,onSave:i,showProgress:!0,collapsible:!0,defaultExpanded:!0,focusGroupId:o,onEditingChange:f})})})})})})]})})},k$e=({focusGroupId:t,focusGroupName:e="Focus Group",onNoteClick:n})=>{const[r,i]=v.useState([]),[o,s]=v.useState(!0),[c,l]=v.useState(null);v.useEffect(()=>{u()},[t]);const u=async()=>{try{s(!0);const x=await Ot.getNotes(t);if(x.data&&Array.isArray(x.data)){const w=x.data.map(S=>({...S,timestamp:new Date(S.timestamp),createdAt:new Date(S.createdAt)}));i(y(w))}}catch(x){console.error("Error fetching notes:",x),re.error("Failed to load notes",{description:"Please refresh the page to try again."})}finally{s(!1)}},d=async x=>{l(x);try{await Ot.deleteNote(t,x),i(r.filter(w=>w.id!==x)),re.success("Note deleted successfully")}catch(w){console.error("Error deleting note:",w),re.error("Failed to delete note",{description:"Please try again."})}finally{l(null)}},f=x=>{x.associatedMessageId&&n?n(x.associatedMessageId):re.info("No associated message",{description:"This note is not linked to a specific discussion point."})},h=()=>{if(r.length===0){re.warning("No notes to export",{description:"Create some notes first before exporting."});return}const x=p(),w=document.createElement("a"),S=new Blob([x],{type:"text/markdown"});w.href=URL.createObjectURL(S),w.download=`${e.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_notes.md`,document.body.appendChild(w),w.click(),document.body.removeChild(w),re.success("Notes exported successfully",{description:`Downloaded ${r.length} notes as Markdown file.`})},p=()=>{const x=[`# Notes: ${e}`,"",`Exported on: ${new Date().toLocaleString()}`,`Total notes: ${r.length}`,"","---",""];return r.forEach((w,S)=>{var C;x.push(`## Note ${S+1}`),x.push(""),x.push(`**Created:** ${w.createdAt.toLocaleString()}`),(C=w.sectionInfo)!=null&&C.sectionTitle&&x.push(`**Section:** ${w.sectionInfo.sectionTitle}`),x.push(`**Elapsed Time:** ${g(w.elapsedTime)}`),x.push(""),x.push("**Content:**"),x.push(w.content),x.push(""),x.push("---"),x.push("")}),x.join(` -`)},g=x=>{const w=Math.floor(x/1e3),S=Math.floor(w/60),C=w%60;return`${S}:${C.toString().padStart(2,"0")}`},m=x=>x.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),y=x=>[...x].sort((w,S)=>S.createdAt.getTime()-w.createdAt.getTime()),b=x=>{i(w=>y([...w,x]))};return v.useEffect(()=>(window.notesPanelAddNote=b,()=>{delete window.notesPanelAddNote}),[]),o?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(Ky,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Notes"}),r.length>0&&a.jsxs("span",{className:"ml-2 text-sm text-slate-500",children:["(",r.length,")"]})]}),a.jsxs(J,{variant:"outline",size:"sm",onClick:h,disabled:r.length===0,children:[a.jsx(lu,{className:"mr-2 h-4 w-4"}),"Export Notes"]})]}),a.jsx(cw,{className:"flex-1",children:r.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center bg-slate-50 rounded-lg",children:[a.jsx(Ky,{className:"h-8 w-8 text-slate-400 mb-3"}),a.jsx("p",{className:"text-slate-600",children:"No notes yet."}),a.jsx("p",{className:"text-sm text-slate-500 mt-2",children:'Click the "Note" button during the session to add contextual notes.'})]}):a.jsx("div",{className:"space-y-4",children:r.map(x=>{var w;return a.jsxs(gt,{className:"hover:shadow-md transition-shadow cursor-pointer group",onClick:()=>f(x),children:[a.jsx(ji,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(Wi,{className:"text-sm font-medium text-slate-600",children:m(x.createdAt)}),((w=x.sectionInfo)==null?void 0:w.sectionTitle)&&a.jsx("div",{className:"text-xs text-slate-500 mt-1",children:a.jsx("span",{children:x.sectionInfo.sectionTitle})})]}),a.jsxs("div",{className:"flex items-center space-x-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[x.associatedMessageId&&a.jsx(J,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:S=>{S.stopPropagation(),f(x)},title:"Go to discussion point",children:a.jsx(aZ,{className:"h-3 w-3"})}),a.jsx(J,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-600 hover:text-red-700",onClick:S=>{S.stopPropagation(),d(x.id)},disabled:c===x.id,title:"Delete note",children:a.jsx(nr,{className:"h-3 w-3"})})]})]})}),a.jsx(Rt,{className:"pt-0",children:a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:x.content})})]},x.id)})})})]})},O$e=({isOpen:t,onClose:e,focusGroupId:n,associatedMessageId:r,sectionInfo:i,messageTimestamp:o,onNoteSaved:s})=>{const[c,l]=v.useState(""),[u,d]=v.useState(!1),f=async()=>{if(!c.trim()){re.error("Note content cannot be empty");return}d(!0);try{const p={content:c.trim(),associatedMessageId:r,sectionInfo:i,elapsedTime:0,timestamp:o.toISOString(),createdAt:new Date().toISOString()},g=await Ot.createNote(n,p);if(g.data){const m={...g.data,timestamp:new Date(g.data.timestamp),createdAt:new Date(g.data.createdAt)},y=i!=null&&i.sectionTitle?`'${i.sectionTitle}'`:"current section",b=o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});re.success("Quick note saved",{description:`Note linked to ${y} at ${b}`}),s&&s(m),l(""),e()}}catch(p){console.error("Error saving note:",p),re.error("Failed to save note",{description:"Please try again or check your connection."})}finally{d(!1)}},h=()=>{l(""),e()};return a.jsx(Ql,{open:t,onOpenChange:h,children:a.jsxs($c,{className:"sm:max-w-md",children:[a.jsx(Lc,{children:a.jsx(Bc,{children:"Quick Note"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"text-sm text-slate-600",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"Section:"})," ",(i==null?void 0:i.sectionTitle)||"Unknown section"]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Time:"})," ",o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),a.jsx(mt,{placeholder:"Enter your note here...",value:c,onChange:p=>l(p.target.value),className:"min-h-[100px] resize-none",autoFocus:!0})]}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(J,{onClick:f,disabled:u,children:u?"Saving...":"Save Note"})]})]})})},Ys=Object.create(null);Ys.open="0";Ys.close="1";Ys.ping="2";Ys.pong="3";Ys.message="4";Ys.upgrade="5";Ys.noop="6";const cy=Object.create(null);Object.keys(Ys).forEach(t=>{cy[Ys[t]]=t});const lj={type:"error",data:"parser error"},CW=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",_W=typeof ArrayBuffer=="function",AW=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,nk=({type:t,data:e},n,r)=>CW&&e instanceof Blob?n?r(e):P$(e,r):_W&&(e instanceof ArrayBuffer||AW(e))?n?r(e):P$(new Blob([e]),r):r(Ys[t]+(e||"")),P$=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function k$(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let PC;function I$e(t,e){if(CW&&t.data instanceof Blob)return t.data.arrayBuffer().then(k$).then(e);if(_W&&(t.data instanceof ArrayBuffer||AW(t.data)))return e(k$(t.data));nk(t,!1,n=>{PC||(PC=new TextEncoder),e(PC.encode(n))})}const O$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jh=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t{let e=t.length*.75,n=t.length,r,i=0,o,s,c,l;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const u=new ArrayBuffer(e),d=new Uint8Array(u);for(r=0;r>4,d[i++]=(s&15)<<4|c>>2,d[i++]=(c&3)<<6|l&63;return u},M$e=typeof ArrayBuffer=="function",rk=(t,e)=>{if(typeof t!="string")return{type:"message",data:jW(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:D$e(t.substring(1),e)}:cy[n]?t.length>1?{type:cy[n],data:t.substring(1)}:{type:cy[n]}:lj},D$e=(t,e)=>{if(M$e){const n=R$e(t);return jW(n,e)}else return{base64:!0,data:t}},jW=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},EW="",$$e=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((o,s)=>{nk(o,!1,c=>{r[s]=c,++i===n&&e(r.join(EW))})})},L$e=(t,e)=>{const n=t.split(EW),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(n)})}})}let kC;function Rv(t){return t.reduce((e,n)=>e+n.length,0)}function Mv(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let i=0;iMath.pow(2,21)-1){c.enqueue(lj);break}i=d*Math.pow(2,32)+u.getUint32(4),r=3}else{if(Rv(n)t){c.enqueue(lj);break}}}})}const TW=4;function hr(t){if(t)return U$e(t)}function U$e(t){for(var e in hr.prototype)t[e]=hr.prototype[e];return t}hr.prototype.on=hr.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};hr.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};hr.prototype.off=hr.prototype.removeListener=hr.prototype.removeAllListeners=hr.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,i=0;iPromise.resolve().then(e):(e,n)=>n(e,0),xo=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),H$e="arraybuffer";function NW(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const z$e=xo.setTimeout,G$e=xo.clearTimeout;function eS(t,e){e.useNativeTimers?(t.setTimeoutFn=z$e.bind(xo),t.clearTimeoutFn=G$e.bind(xo)):(t.setTimeoutFn=xo.setTimeout.bind(xo),t.clearTimeoutFn=xo.clearTimeout.bind(xo))}const V$e=1.33;function K$e(t){return typeof t=="string"?W$e(t):Math.ceil((t.byteLength||t.size)*V$e)}function W$e(t){let e=0,n=0;for(let r=0,i=t.length;r=57344?n+=3:(r++,n+=4);return n}function PW(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function q$e(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function Y$e(t){let e={},n=t.split("&");for(let r=0,i=n.length;r{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};L$e(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,$$e(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=PW()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let kW=!1;try{kW=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const J$e=kW;function Z$e(){}class eLe extends X$e{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}let Od=class ly extends hr{constructor(e,n,r){super(),this.createRequest=e,eS(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=NW(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=ly.requestsCount++,ly.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Z$e,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete ly.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Od.requestsCount=0;Od.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",I$);else if(typeof addEventListener=="function"){const t="onpagehide"in xo?"pagehide":"unload";addEventListener(t,I$,!1)}}function I$(){for(let t in Od.requests)Od.requests.hasOwnProperty(t)&&Od.requests[t].abort()}const tLe=function(){const t=OW({xdomain:!1});return t&&t.responseType!==null}();class nLe extends eLe{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=tLe&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Od(OW,this.uri(),e)}}function OW(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||J$e))return new XMLHttpRequest}catch{}if(!e)try{return new xo[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const IW=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class rLe extends ik{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=IW?{}:NW(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n{try{this.doWrite(r,o)}catch{}i&&Zw(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=PW()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const OC=xo.WebSocket||xo.MozWebSocket;class iLe extends rLe{createSocket(e,n,r){return IW?new OC(e,n,r):n?new OC(e,n):new OC(e)}doWrite(e,n){this.ws.send(n)}}class oLe extends ik{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=B$e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),i=F$e();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const o=()=>{r.read().then(({done:c,value:l})=>{c||(this.onPacket(l),o())}).catch(c=>{})};o();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n{i&&Zw(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const sLe={websocket:iLe,webtransport:oLe,polling:nLe},aLe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,cLe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function uj(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=aLe.exec(t||""),o={},s=14;for(;s--;)o[cLe[s]]=i[s]||"";return n!=-1&&r!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=lLe(o,o.path),o.queryKey=uLe(o,o.query),o}function lLe(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function uLe(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const dj=typeof addEventListener=="function"&&typeof removeEventListener=="function",uy=[];dj&&addEventListener("offline",()=>{uy.forEach(t=>t())},!1);class Gc extends hr{constructor(e,n){if(super(),this.binaryType=H$e,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=uj(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=uj(n.host).host);eS(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Y$e(this.opts.query)),dj&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},uy.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=TW,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Gc.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Gc.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Zw(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:e,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(Gc.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),dj&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=uy.indexOf(this._offlineEventListener);r!==-1&&uy.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}Gc.protocol=TW;class dLe extends Gc{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Gc.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=n.name,this.emitReserved("upgradeError",h)}}))};function o(){r||(r=!0,d(),n.close(),n=null)}const s=f=>{const h=new Error("probe error: "+f);h.transport=n.name,o(),this.emitReserved("upgradeError",h)};function c(){s("transport closed")}function l(){s("socket closed")}function u(f){n&&f.name!==n.name&&o()}const d=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",c),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",s),n.once("close",c),this.once("close",l),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;rsLe[i]).filter(i=>!!i)),super(e,r)}};function hLe(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=uj(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+e,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}const pLe=typeof ArrayBuffer=="function",mLe=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,RW=Object.prototype.toString,gLe=typeof Blob=="function"||typeof Blob<"u"&&RW.call(Blob)==="[object BlobConstructor]",vLe=typeof File=="function"||typeof File<"u"&&RW.call(File)==="[object FileConstructor]";function ok(t){return pLe&&(t instanceof ArrayBuffer||mLe(t))||gLe&&t instanceof Blob||vLe&&t instanceof File}function dy(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n=0&&t.num{delete this.acks[e];for(let c=0;c{this.io.clearTimeoutFn(o),n.apply(this,c)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...n){return new Promise((r,i)=>{const o=(s,c)=>s?i(s):r(c);o.withError=!0,n.push(o),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Zt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Zt.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Zt.EVENT:case Zt.BINARY_EVENT:this.onevent(e);break;case Zt.ACK:case Zt.BINARY_ACK:this.onack(e);break;case Zt.DISCONNECT:this.ondisconnect();break;case Zt.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Zt.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Zt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r0&&t.jitter<=1?t.jitter:0,this.attempts=0}fh.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0};fh.prototype.reset=function(){this.attempts=0};fh.prototype.setMin=function(t){this.ms=t};fh.prototype.setMax=function(t){this.max=t};fh.prototype.setJitter=function(t){this.jitter=t};class pj extends hr{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,eS(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new fh({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||_Le;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new fLe(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=zo(n,"open",function(){r.onopen(),e&&e()}),o=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},s=zo(n,"error",o);if(this._timeout!==!1){const c=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},c);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(zo(e,"ping",this.onping.bind(this)),zo(e,"data",this.ondata.bind(this)),zo(e,"error",this.onerror.bind(this)),zo(e,"close",this.onclose.bind(this)),zo(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Zw(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new MW(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;re()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Lh={};function fy(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=hLe(t,e.path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=Lh[i]&&o in Lh[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return c?l=new pj(r,e):(Lh[i]||(Lh[i]=new pj(r,e)),l=Lh[i]),n.query&&!e.query&&(e.query=n.queryKey),l.socket(n.path,e)}Object.assign(fy,{Manager:pj,Socket:MW,io:fy,connect:fy});const M$=window.location.origin,D$=new URLSearchParams(window.location.search).get("direct")==="1"?"/socket.io/":"/semblance_back/socket.io/";let It=null,eu=null,$$=!1;function DW(t){if(It)return It.io.opts.auth={token:t()},It;console.log("šŸ”§ [GPT-5] Creating singleton socket:",M$,D$),It=fy(M$,{path:D$,transports:["websocket"],reconnection:!0,autoConnect:!1,timeout:6e4,pingInterval:45e3,pingTimeout:12e4,auth:n=>n({token:t()})}),It.io.on("reconnect_attempt",()=>{console.log("šŸ”§ [GPT-5] Reconnect attempt - refreshing token"),It.io.opts.auth={token:t()}});const e=()=>{console.log("šŸ”§ [GPT-5] Socket connected, rebinding listeners and rejoining room"),NLe(),eu&&TLe()};return It.on("connect",e),It.onAny((n,...r)=>{console.log(`šŸ”§ [GPT-5 onAny] ${n}:`,r);const i=r[0];switch(n){case"joined_focus_group":console.log("šŸ”§ [GPT-5] *** ROUTING joined_focus_group from onAny ***"),window.dispatchEvent(new CustomEvent("ws:joined_focus_group",{detail:i}));break;case"left_focus_group":console.log("šŸ”§ [GPT-5] *** ROUTING left_focus_group from onAny ***"),window.dispatchEvent(new CustomEvent("ws:left_focus_group",{detail:i}));break;case"message_update":console.log("šŸ”§ [GPT-5] *** ROUTING message_update from onAny ***");try{window.dispatchEvent(new CustomEvent("ws:message_update",{detail:i})),console.log("šŸ”§ [GPT-5] DISPATCHED window event ws:message_update SUCCESS (via onAny)")}catch(o){console.error("šŸ”§ [GPT-5] ERROR dispatching window event (via onAny):",o)}break;case"ai_status_update":console.log("šŸ”§ [GPT-5] *** ROUTING ai_status_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:ai_status_update",{detail:i}));break;case"moderator_status_update":console.log("šŸ”§ [GPT-5] *** ROUTING moderator_status_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:moderator_status_update",{detail:i}));break;case"theme_update":console.log("šŸ”§ [GPT-5] *** ROUTING theme_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:theme_update",{detail:i}));break;case"focus_group_update":console.log("šŸ”§ [GPT-5] *** ROUTING focus_group_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:focus_group_update",{detail:i}));break;case"connected":console.log("šŸ”§ [GPT-5] *** ROUTING connected from onAny ***");break;case"error":console.error("šŸ”§ [GPT-5] *** ROUTING error from onAny ***",i);break}}),It.on("connect_error",n=>{console.error("šŸ”§ [GPT-5] Connect error:",n)}),It.on("disconnect",n=>{console.log("šŸ”§ [GPT-5] Disconnected:",n)}),It}function $W(){It&&!It.connected&&(console.log("šŸ”§ [GPT-5] Connecting socket"),It.connect())}function jLe(t,e){if(console.log("šŸ”§ [GPT-5] Joining focus group:",t),eu=t,!(It!=null&&It.connected)){console.log("šŸ”§ [GPT-5] Socket not connected, will auto-rejoin on connect"),$W(),setTimeout(()=>{It!=null&&It.connected?(console.log("šŸ”§ [GPT-5] Retrying join after connection established"),It.emit("join_focus_group",{focus_group_id:t},n=>{console.log("šŸ”§ [GPT-5] join_focus_group RETRY ACK:",n)})):console.log("šŸ”§ [GPT-5] Still not connected, will rejoin on next connect event")},1e3);return}It.emit("join_focus_group",{focus_group_id:t},n=>{console.log("šŸ”§ [GPT-5] join_focus_group ACK:",n)})}function ELe(t){console.log("šŸ”§ [GPT-5] Leaving focus group:",t),eu===t&&(eu=null),It!=null&&It.connected&&It.emit("leave_focus_group",{focus_group_id:t})}function TLe(){!(It!=null&&It.connected)||!eu||(console.log("šŸ”§ [GPT-5] Auto-rejoining room after reconnect:",eu),It.emit("join_focus_group",{focus_group_id:eu}))}function NLe(){if(!It){console.log("šŸ”§ [GPT-5] bindCoreListeners called but socket is null!");return}$$&&console.log("šŸ”§ [GPT-5] Listeners already bound, but rebinding anyway for safety"),console.log("šŸ”§ [GPT-5] bindCoreListeners called - socket exists, binding listeners");const t=c=>{console.log("šŸ”§ [GPT-5] joined_focus_group:",c),window.dispatchEvent(new CustomEvent("ws:joined_focus_group",{detail:c}))},e=c=>{console.log("šŸ”§ [GPT-5] left_focus_group:",c),window.dispatchEvent(new CustomEvent("ws:left_focus_group",{detail:c}))},n=c=>{console.log("šŸ”§ [GPT-5] *** MESSAGE_UPDATE LISTENER FIRED! ***"),console.log("šŸ”§ [GPT-5] message_update payload:",c),console.log("šŸ”§ [GPT-5] DISPATCHING window event ws:message_update");try{window.dispatchEvent(new CustomEvent("ws:message_update",{detail:c})),console.log("šŸ”§ [GPT-5] DISPATCHED window event ws:message_update SUCCESS")}catch(l){console.error("šŸ”§ [GPT-5] ERROR dispatching window event:",l)}},r=c=>{console.log("šŸ”§ [GPT-5] ai_status_update:",c),console.log("šŸ”§ [GPT-5] DISPATCHING window event ws:ai_status_update"),window.dispatchEvent(new CustomEvent("ws:ai_status_update",{detail:c})),console.log("šŸ”§ [GPT-5] DISPATCHED window event ws:ai_status_update")},i=c=>{console.log("šŸ”§ [GPT-5] moderator_status_update:",c),window.dispatchEvent(new CustomEvent("ws:moderator_status_update",{detail:c}))},o=c=>{console.log("šŸ”§ [GPT-5] theme_update:",c),window.dispatchEvent(new CustomEvent("ws:theme_update",{detail:c}))},s=c=>{console.log("šŸ”§ [GPT-5] focus_group_update:",c),window.dispatchEvent(new CustomEvent("ws:focus_group_update",{detail:c}))};console.log("šŸ”§ [GPT-5] BINDING specific listeners to socket"),It.on("joined_focus_group",t),It.on("left_focus_group",e),It.on("message_update",n),It.on("ai_status_update",r),It.on("moderator_status_update",i),It.on("theme_update",o),It.on("focus_group_update",s),console.log("šŸ”§ [GPT-5] BOUND specific listeners to socket"),console.log("šŸ”§ [GPT-5] Socket listeners after binding:",It.listeners("message_update").length),console.log("šŸ”§ [GPT-5] Socket hasListeners message_update:",It.hasListeners("message_update")),setTimeout(()=>{It!=null&&It.connected&&(console.log("šŸ”§ [GPT-5] SELF-TEST: Emitting test event"),It.emit("message_update",{test:"self-emit-test"}))},1e3),It.on("connected",c=>{console.log("šŸ”§ [GPT-5] connected:",c)}),It.on("error",c=>{console.error("šŸ”§ [GPT-5] socket error:",c)}),$$=!0}const PLe=()=>{const{id:t}=OE(),e=ar(),{token:n}=Xs(),[r,i]=v.useState([]),[o,s]=v.useState([]),[c,l]=v.useState([]),[u,d]=v.useState(null),[f,h]=v.useState([]),[p,g]=v.useState("chat"),[m,y]=v.useState(null),[b,x]=v.useState(!1),[w,S]=v.useState(!1),[C,_]=v.useState(!0),[A,j]=v.useState(!1),[P,k]=v.useState(!1),O=v.useRef(!1),[E,I]=v.useState(!1),D=v.useRef(u);D.current=u;const[z,$]=v.useState([]),[G,R]=v.useState(!1),[L,W]=v.useState(""),[Y,te]=v.useState("medium"),[me,F]=v.useState("medium"),[se,ne]=v.useState(!1),[ae,De]=v.useState(!1),[de,ye]=v.useState(null),[Ee,Z]=v.useState([]),[ct,Le]=v.useState(!1),[At,lt]=v.useState(!1),[Jt,T]=v.useState(!1),[M,U]=v.useState(!0),[V,Q]=v.useState({isOpen:!1}),B=v.useRef(!1),[X,ge]=v.useState(""),xe=v.useRef(""),Re=v.useRef(!1),be=v.useRef({wasConnected:!1,wasConnecting:!1,initialConnection:!0,hasShownFallbackNotification:!1}),Ve=SW(),[st,kt]=v.useState(!1),[Ke,tt]=v.useState(!1),[Nt,sn]=v.useState(null),Nr=v.useCallback(()=>n||"",[n]);v.useEffect(()=>{console.log("šŸ”§ [GPT-5 Session] Initializing WebSocket"),DW(Nr)},[Ve,Nr]),v.useEffect(()=>{if(!t)return;(()=>{console.log("šŸ”§ [GPT-5 Session] Joining focus group:",t),jLe(t)})()},[t,Ve]),v.useEffect(()=>{tt(!0),kt(!1),sn(null);const ee=setTimeout(()=>{kt(!0),tt(!1)},1e3);return()=>{clearTimeout(ee)}},[Ve]),v.useEffect(()=>{console.log("šŸ”§ [GPT-5 Session] Setting up window event listeners");const ee=He=>{const nt=He.detail;console.log("šŸ”§ [GPT-5 Session] message_update:",nt),nt.focus_group_id&&(console.log("šŸ”§ [GPT-5] Message focus_group_id:",nt.focus_group_id),console.log("šŸ”§ [GPT-5] Current focus group from URL:",t));const Se=E$e(nt.message);if(!Se){console.error("šŸ”§ [GPT-5] convertWebSocketMessage returned null");return}i(Gt=>Gt.find(en=>en.id===Se.id)?(console.log("šŸ”§ [GPT-5] Message already exists, skipping"),Gt):(console.log("šŸ”§ [GPT-5] Adding new message, count:",Gt.length+1),[...Gt,Se]))},ce=He=>{const nt=He.detail;console.log("šŸ”§ [GPT-5 Session] ai_status_update:",nt),S(Se=>nt.status.status==="ai_mode"),ge(Se=>nt.status.status)},ke=He=>{const nt=He.detail;console.log("šŸ”§ [GPT-5 Session] moderator_status_update:",nt),y(nt.moderator_status)},Fe=He=>{const nt=He.detail;console.log("šŸ”§ [GPT-5 Session] theme_update:",nt);const Se=T$e(nt.theme);l(Gt=>{const wt=[...Gt],en=wt.findIndex(qt=>qt.id===Se.id);return en>=0?wt[en]=Se:wt.push(Se),wt})},Ue=He=>{const nt=He.detail;console.log("šŸ”§ [GPT-5 Session] focus_group_update:",nt),d(Se=>Se?{...Se,...nt}:null)},_t=He=>{const nt=He.detail;console.log("šŸ”§ [GPT-5 Session] joined_focus_group:",nt)};return console.log("šŸ”§ [GPT-5 Session] ADDING window event listeners"),window.addEventListener("ws:message_update",ee),window.addEventListener("ws:ai_status_update",ce),window.addEventListener("ws:moderator_status_update",ke),window.addEventListener("ws:theme_update",Fe),window.addEventListener("ws:focus_group_update",Ue),window.addEventListener("ws:joined_focus_group",_t),console.log("šŸ”§ [GPT-5 Session] ADDED all window event listeners"),()=>{console.log("šŸ”§ [GPT-5 Session] Cleaning up window event listeners"),window.removeEventListener("ws:message_update",ee),window.removeEventListener("ws:ai_status_update",ce),window.removeEventListener("ws:moderator_status_update",ke),window.removeEventListener("ws:theme_update",Fe),window.removeEventListener("ws:focus_group_update",Ue),window.removeEventListener("ws:joined_focus_group",_t),t&&ELe(t)}},[Ve,t]),v.useEffect(()=>{if(!t)return;const ee=be.current;st&&!ee.wasConnected&&(ee.initialConnection?qe.success("Live updates enabled",{description:"Connected to real-time updates. Changes will appear instantly.",duration:3e3}):qe.success("Real-time updates restored",{description:"WebSocket connection re-established. You'll now receive instant updates.",duration:4e3}),ee.wasConnected=!0,ee.initialConnection=!1),!st&&!Ke&&ee.wasConnected&&!ee.initialConnection&&(qe.warning("Connection lost",{description:"Real-time updates unavailable. Attempting to reconnect...",duration:5e3}),ee.wasConnected=!1,U(!0)),Nt&&!Ke&&!st&&!ee.initialConnection&&(qe.error("Connection failed",{description:"Unable to establish real-time connection. Using periodic updates instead.",duration:6e3}),U(!0)),ee.wasConnecting=Ke},[st,Ke,Nt,Ve,t]),v.useEffect(()=>{},[Ve,t,u]);const fn=async()=>{var ee;if(t)try{const ce=await Xn.getModeratorStatus(t);if((ee=ce==null?void 0:ce.data)!=null&&ee.status){const ke=ce.data.status;if(m){const Fe=m.current_section_id!==ke.current_section_id||m.current_item_id!==ke.current_item_id||m.progress!==ke.progress}O.current||y(ke)}}catch(ce){console.error("Error fetching moderator status:",ce)}},St=async()=>{if(!t)return{aiActive:!1,sessionStatus:""};try{if(typeof(Ot==null?void 0:Ot.getById)!="function")return console.error("focusGroupsApi.getById is not a function:",typeof(Ot==null?void 0:Ot.getById)),{aiActive:w,sessionStatus:X};const ee=await Ot.getById(t);if(!ee||typeof ee!="object")return console.error("Invalid response object received:",ee),{aiActive:w,sessionStatus:X};if(!ee.data||typeof ee.data!="object")return console.warn("Focus group response missing data property:",ee),{aiActive:w,sessionStatus:X};const ce=ee.data.status;if(typeof ce>"u")return console.warn("Focus group response missing status field:",ee.data),{aiActive:w,sessionStatus:X};const ke=ce==="ai_mode";return ce==="autonomous_active"?console.warn('Detected legacy "autonomous_active" status - backend may need updating to "ai_mode"'):["ai_mode","active","completed","paused","draft","in-progress"].includes(ce)||console.warn("Unexpected focus group status value:",ce),{aiActive:ke,sessionStatus:ce}}catch(ee){console.error("Error checking AI mode status:",ee);const ce={focusGroupId:t,currentAiModeStatus:w,errorType:"unknown",timestamp:new Date().toISOString()};return ee.response?(ce.errorType="api_error",ce.status=ee.response.status,ce.data=ee.response.data,console.error("API error response:",ee.response.status,ee.response.data),ee.response.status===404?console.warn("Focus group not found - may have been deleted"):ee.response.status===500&&console.error("Server error during status check - backend issue")):ee.request?(ce.errorType="network_error",console.error("Network error - no response received, check connectivity")):(ce.errorType="request_setup",ce.message=ee.message,console.error("Request setup error:",ee.message)),console.debug("Status check error details:",ce),{aiActive:w,sessionStatus:X,isGenerating:!1}}},Ze=async(ee,ce)=>{if(!t||Re.current)return;const ke=["completed","paused"],Ue=["ai_mode","autonomous_active","active","in-progress"].includes(ce),_t=ke.includes(ee);if(Ue&&_t){Re.current=!0;try{let He="session_ended";ee==="completed"?He="auto_complete":ee==="paused"&&(He="manual_stop");const nt=await Xn.endSession(t,He);nt!=null&&nt.data&&(qe.success("Session concluded",{description:"The focus group session has ended with a concluding statement from the moderator."}),setTimeout(()=>{ot()},1e3))}catch(He){console.error("āŒ Error ending session with concluding statement:",He),qe.error("Error ending session",{description:"Failed to add concluding statement, but the session has ended."})}}},ot=async()=>{var ee;if(t)try{const ce=await Ot.getMessages(t);let ke=[],Fe=[];ce&&ce.data&&(Array.isArray(ce.data)?(ke=ce.data,Fe=[]):ce.data.messages||ce.data.mode_events?(ke=ce.data.messages||[],Fe=ce.data.mode_events||[]):(ke=Array.isArray(ce.data)?ce.data:[],Fe=[]));const Ue=ke.map(Se=>({id:Se._id||Se.id||`msg-${Date.now()}`,senderId:Se.senderId,text:Se.text,timestamp:new Date(Se.timestamp||Se.created_at||new Date),type:Se.type||"response",highlighted:Se.highlighted||!1})),_t=Fe.map(Se=>({id:Se._id||Se.id||`event-${Date.now()}`,focus_group_id:Se.focus_group_id,event_type:Se.event_type,timestamp:new Date(Se.timestamp||Se.created_at||new Date),user_id:Se.user_id,created_at:new Date(Se.created_at||new Date)}));s(_t),Ue.length>0?i(Se=>{if(Se.length===0)return Ue;{const Gt=new Map;Se.forEach(On=>Gt.set(On.id,On));const wt=Ue.map(On=>{if(Gt.has(On.id)){const ln=Gt.get(On.id);return{...On,highlighted:ln.highlighted}}return On}),en=new Set(wt.map(On=>On.id)),qt=Se.filter(On=>!en.has(On.id));return[...wt,...qt].sort((On,ln)=>On.timestamp.getTime()-ln.timestamp.getTime())}}):Ue.length===0&&i(Se=>Se.length===0?[]:Se);const He=Ue.filter(Se=>Se.highlighted),nt=He.length>0?He.map(Se=>({id:`theme-${Se.id}`,text:Se.text.substring(0,40)+(Se.text.length>40?"...":""),count:1,messages:[Se.id],source:"highlight"})):[];try{const Se=await Xn.getKeyThemes(t);if((ee=Se==null?void 0:Se.data)!=null&&ee.themes&&Array.isArray(Se.data.themes)){const Gt=Se.data.themes;l([...nt,...Gt])}else l(nt)}catch(Se){console.error("Error fetching AI-generated themes:",Se),l(nt)}}catch(ce){console.error("Error fetching messages:",ce),r.length===0&&qe.error("Failed to fetch messages",{description:"Please try again later or restart the session."})}},Xt=async()=>{if(!t)return!1;try{const ce=(await zr.getAll()).data||[],ke=await Ot.getById(t);if(ke&&ke.data){const Fe=ke.data;console.log("Focus group data from API:",Fe);const Ue={id:Fe._id||Fe.id,name:Fe.name,status:Fe.status||"in-progress",participants:Fe.participants||[],date:Fe.date||new Date().toISOString(),duration:Fe.duration||60,topic:Fe.topic||"general",discussionGuide:Fe.discussionGuide||"",llm_model:Fe.llm_model||"gemini-2.5-pro"};if(d(Ue),W(Ue.llm_model||"gemini-2.5-pro"),te(Ue.reasoning_effort||"medium"),F(Ue.verbosity||"medium"),Fe.participants_data&&Array.isArray(Fe.participants_data))h(Fe.participants_data.map(He=>({...He,id:He._id||He.id})));else if(Ue.participants&&Array.isArray(Ue.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:Ue.participants,allPersonas:ce.map(nt=>({id:nt._id||nt.id,name:nt.name}))});const He=ce.filter(nt=>{const Se=nt._id||nt.id;return Ue.participants.includes(Se)});console.log("Matched participants:",He.map(nt=>nt.name)),h(He)}await ot(),await fn();const _t=await St();return S(_t.aiActive),ge(_t.sessionStatus),B.current=_t.aiActive,xe.current=_t.sessionStatus,!0}return!1}catch(ee){return console.error("Error fetching focus group:",ee),!1}},wn=async(ee,ce,ke)=>{if(console.log("šŸ”§ updateFocusGroupModel called with:",{id:t,focusGroup:!!u,newModel:ee,reasoningEffort:ce,verbosity:ke}),!t||!u){console.log("āŒ updateFocusGroupModel: Missing id or focusGroup",{id:t,focusGroup:!!u});return}ne(!0);try{const Fe={llm_model:ee};ee==="gpt-5"&&(Fe.reasoning_effort=ce||Y,Fe.verbosity=ke||me),console.log("šŸ”§ Making API call to update focus group model:",{id:t,updateData:Fe});const Ue=await Ot.update(t,Fe);console.log("šŸ”§ API response:",Ue),Ue&&Ue.data?(d(_t=>_t?{..._t,llm_model:ee,reasoning_effort:ee==="gpt-5"?ce||Y:_t==null?void 0:_t.reasoning_effort,verbosity:ee==="gpt-5"?ke||me:_t==null?void 0:_t.verbosity}:null),qe.success("AI Model Updated",{description:`Focus group will now use ${ee==="gemini-2.5-pro"?"Gemini 2.5 Pro":ee==="gpt-4.1"?"GPT-4.1":ee==="gpt-5"?"GPT-5":ee} for AI responses`}),R(!1),console.log("āœ… Model update successful")):console.log("āŒ API response missing data:",Ue)}catch(Fe){console.error("āŒ Error updating focus group model:",Fe),qe.error("Failed to update AI model",{description:"There was an error updating the AI model. Please try again."})}finally{ne(!1)}};v.useEffect(()=>{console.log("Looking for focus group with ID:",t);const ee=async()=>{try{return(await zr.getAll()).data||[]}catch(Ue){return console.error("Error fetching personas:",Ue),[]}},ce=async Ue=>{try{const _t=await Ot.getById(t);if(_t&&_t.data){const He=_t.data;console.log("Focus group data from API:",He);const nt={id:He._id||He.id,name:He.name,status:He.status||"in-progress",participants:He.participants||[],date:He.date||new Date().toISOString(),duration:He.duration||60,topic:He.topic||"general",discussionGuide:He.discussionGuide||"",llm_model:He.llm_model||"gemini-2.5-pro"};if(d(nt),W(nt.llm_model||"gemini-2.5-pro"),te(nt.reasoning_effort||"medium"),F(nt.verbosity||"medium"),He.participants_data&&Array.isArray(He.participants_data))h(He.participants_data.map(Se=>({...Se,id:Se._id||Se.id})));else if(nt.participants&&Array.isArray(nt.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:nt.participants,allPersonas:Ue.map(Gt=>({id:Gt._id||Gt.id,name:Gt.name}))});const Se=Ue.filter(Gt=>{const wt=Gt._id||Gt.id;return nt.participants.includes(wt)});console.log("Matched participants:",Se.map(Gt=>Gt.name)),h(Se)}return ot(),fn(),_(!1),!0}return!1}catch(_t){return console.error("Error fetching focus group:",_t),!1}};let ke,Fe;return ee().then(Ue=>{ce(Ue).then(_t=>{_t?Nt&&(Nt.includes("unavailable")||Nt.includes("websocket error"))?(console.log("šŸ“” WebSocket connection failed, falling back to polling"),(()=>{ot(),fn(),ke&&window.clearInterval(ke);const wt=w?3e3:1e4;console.log("šŸ“” Setting up message polling:",{aiModeActive:w,pollInterval:wt,timestamp:new Date().toISOString()}),ke=window.setInterval(()=>{O.current?console.log("šŸ“” Skipping poll - editing discussion guide"):(console.log("šŸ“” Polling for messages...",new Date().toISOString()),ot(),fn())},wt)})(),Fe=window.setInterval(async()=>{const wt=B.current,en=xe.current,qt=await St();if(B.current=qt.aiActive,xe.current=qt.sessionStatus,S(qt.aiActive),ge(qt.sessionStatus),en&&en!==qt.sessionStatus&&await Ze(qt.sessionStatus,en),wt!==qt.aiActive&&ke){window.clearInterval(ke);const Ci=qt.aiActive?3e3:1e4;ke=window.setInterval(()=>{O.current||(ot(),fn())},Ci)}},15e3)):console.log("šŸ“” WebSocket enabled, skipping polling setup"):(console.error("Focus group not found with ID:",t),_(!1),qe.error("Focus group not found",{description:`Could not find focus group with ID: ${t}`}))})}),()=>{ke&&window.clearInterval(ke),Fe&&window.clearInterval(Fe)}},[t,e,Ve,Nt]);const oo=ee=>{if(!ee||!ee.sections||!Array.isArray(ee.sections))return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const ce=ee.sections[0];if(!ce)return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const ke=Ue=>Ue.questions&&Array.isArray(Ue.questions)&&Ue.questions.length>0?{content:Ue.questions[0].content,itemId:Ue.questions[0].id,type:"question"}:Ue.activities&&Array.isArray(Ue.activities)&&Ue.activities.length>0?{content:Ue.activities[0].content,itemId:Ue.activities[0].id,type:"activity"}:null;let Fe=ke(ce);if(!Fe&&ce.subsections&&Array.isArray(ce.subsections)){for(const Ue of ce.subsections)if(Fe=ke(Ue),Fe)break}return Fe?{content:Fe.content,sectionId:ce.id,itemId:Fe.itemId}:{content:`Welcome to our focus group session on "${ce.title||"our topic"}". Let's begin our discussion.`,sectionId:ce.id,itemId:"section-intro"}},ta=async()=>{var ee,ce,ke,Fe,Ue,_t;if(t)try{qe.info("Starting focus group session...",{description:"The session is now ready for AI moderation."});try{const He=await Xn.getModeratorStatus(t),nt=(ce=(ee=He==null?void 0:He.data)==null?void 0:ee.status)==null?void 0:ce.moderator_position;nt?console.log("šŸ“ Preserving existing moderator position:",nt):(await Xn.setModeratorPosition(t,((Ue=(Fe=(ke=u==null?void 0:u.discussionGuide)==null?void 0:ke.sections)==null?void 0:Fe[0])==null?void 0:Ue.id)||"welcome"),console.log("šŸš€ Moderator position initialized to start of discussion guide (first time)"))}catch(He){console.warn("Failed to check/initialize moderator position:",He)}await Ot.update(t,{status:"active"});try{const He=oo(u==null?void 0:u.discussionGuide),nt={id:`msg-${Date.now()}`,senderId:"moderator",text:He.content,timestamp:new Date,type:"question"},Se=await Ot.sendMessage(t,{senderId:"moderator",text:nt.text,type:"question"});(_t=Se==null?void 0:Se.data)!=null&&_t.message_id&&(nt.id=Se.data.message_id),q(nt),console.log("šŸš€ Initial moderator message created:",{content:He.content,sectionId:He.sectionId,itemId:He.itemId})}catch(He){console.warn("Failed to create initial moderator message:",He)}qe.success("Focus group session started",{description:"The discussion has begun. Use the control panel below to moderate."})}catch(He){console.error("Error starting session:",He),qe.error("Error starting session",{description:"There was a problem connecting to the server."})}},q=ee=>{i(ce=>[...ce,ee])},Pe=async ee=>{const ce=[...r],ke=ce.findIndex(Fe=>Fe.id===ee);if(ke!==-1){const Fe=ce[ke],Ue=!Fe.highlighted;if(ce[ke]={...Fe,highlighted:Ue},i(ce),t)try{!ee.startsWith("local-")&&!ee.startsWith("msg-")?await Ot.updateMessageHighlight(t,ee,Ue):console.log("Skipping database update for local message:",ee)}catch(_t){console.error("Error updating message highlight state:",_t),qe.error("Failed to save highlight state",{description:"The highlight may not persist if the page is refreshed."})}}},We=ee=>f.find(ce=>ce.id===ee||ce._id===ee),yt=()=>{const ee=r.map(Fe=>{var He;let Ue;return Fe.senderId==="moderator"?Ue="AI Moderator":Fe.senderId==="facilitator"?Ue="Human Facilitator":Ue=((He=We(Fe.senderId))==null?void 0:He.name)||"Unknown",`[${Fe.timestamp.toLocaleTimeString()}] ${Ue}: ${Fe.text}`}).join(` - -`),ce=document.createElement("a"),ke=new Blob([ee],{type:"text/plain"});ce.href=URL.createObjectURL(ke),ce.download=`focus-group-${t}-transcript.txt`,document.body.appendChild(ce),ce.click(),document.body.removeChild(ce),qe.success("Transcript downloaded",{description:"The focus group transcript has been saved to your device."})},et=(ee,ce)=>{const ke=wt=>{const en=wt.match(/^\[([^\]]+)\]:\s*(.*)$/);return en?en[2].trim():wt.trim()},Fe=wt=>wt.toLowerCase().replace(/[^\w\s]/g," ").replace(/\s+/g," ").trim(),Ue=(wt,en)=>{const qt=Fe(wt),Ci=Fe(en);if(qt===Ci)return 1;if(qt.includes(Ci)||Ci.includes(qt))return Math.min(qt.length,Ci.length)/Math.max(qt.length,Ci.length);const On=qt.split(" "),ln=Ci.split(" "),hh=On.filter(ak=>ln.includes(ak)&&ak.length>2);return On.length===0||ln.length===0?0:hh.length/Math.max(On.length,ln.length)},_t=typeof ee=="object"&&ee!==null,He=_t?ee.text:ke(ee),nt=_t?ee.original:ee;let Se=null,Gt="";if(ce&&(Se=r.find(wt=>wt.id===ce),Se?Gt="direct_message_id_match":console.warn(`Message ID ${ce} not found in current messages array`)),Se||(Se=r.find(wt=>wt.text.includes(nt)),Se&&(Gt="exact_full_match")),Se||(Se=r.find(wt=>wt.text.includes(He)),Se&&(Gt="exact_text_match")),Se||(Se=r.find(wt=>He.includes(wt.text.trim())),Se&&(Gt="reverse_exact_match")),!Se){const wt=He.toLowerCase();Se=r.find(en=>en.text.toLowerCase().includes(wt)||wt.includes(en.text.toLowerCase())),Se&&(Gt="case_insensitive_match")}if(!Se){const wt=r.map(en=>({message:en,similarity:Ue(He,en.text)})).filter(en=>en.similarity>.7).sort((en,qt)=>qt.similarity-en.similarity);wt.length>0&&(Se=wt[0].message,Gt=`fuzzy_match_${Math.round(wt[0].similarity*100)}%`)}if(!Se){const en=Fe(He).split(" ").filter(qt=>qt.length>3);en.length>0&&(Se=r.find(qt=>{const Ci=Fe(qt.text);return en.every(On=>Ci.includes(On))}),Se&&(Gt="partial_word_match"))}Se?(console.log(`Quote match found using strategy: ${Gt}`,{quoteType:_t?"QuoteData":"string",providedMessageId:ce,extractedText:He,matchedMessage:Se.text.substring(0,100),matchedMessageId:Se.id,originalQuote:nt.substring(0,100)}),g("chat"),setTimeout(()=>{const wt=document.getElementById(`message-${Se.id}`);wt&&(P||wt.scrollIntoView({behavior:"smooth",block:"center"}),wt.style.backgroundColor="#fbbf24",wt.style.transition="background-color 0.3s ease",setTimeout(()=>{wt.style.backgroundColor=""},2e3))},100)):(console.warn("Quote match failed",{quoteType:_t?"QuoteData":"string",providedMessageId:ce,originalQuote:nt.substring(0,100),extractedText:He.substring(0,100),totalMessages:r.length,messageSample:r.slice(0,3).map(wt=>({id:wt.id,text:wt.text.substring(0,50)}))}),qe.warning("Message not found",{description:"Could not locate the original message for this quote. The quote may have been paraphrased by the AI."}))},bt=ee=>{l(ce=>{const ke=new Set(ce.map(Ue=>Ue.id)),Fe=ee.filter(Ue=>!ke.has(Ue.id));return[...ce,...Fe]})},hn=async ee=>{if(!t)return;const ce=c.find(ke=>ke.id===ee);if(ce)try{"source"in ce&&ce.source==="generated"&&await Xn.deleteKeyTheme(t,ee),l(c.filter(ke=>ke.id!==ee))}catch(ke){console.error("Error deleting theme:",ke),qe.error("Failed to delete theme",{description:"There was an error removing the theme. Please try again."})}},ut=v.useCallback(async(ee,ce)=>{if(t)try{await Xn.setModeratorPosition(t,ee,ce),qe.success("Moderator position updated",{description:"The moderator has been moved to the selected section."})}catch(ke){console.error("Error setting moderator position:",ke),qe.error("Failed to update moderator position",{description:"There was an error updating the moderator position."})}},[t]),An=v.useCallback(async ee=>{if(console.log("šŸ’¾ handleDiscussionGuideSave called:",{hasId:!!t,isEditingGuideContent:E,timestamp:new Date().toISOString()}),!!t)try{await Ot.update(t,{discussionGuide:ee}),E?(D.current&&(D.current={...D.current,discussionGuide:ee}),console.log("āš ļø Skipping focus group state update during editing to preserve focus")):(console.log("šŸ”„ Updating focus group state (not editing)"),d(ce=>ce?{...ce,discussionGuide:ee}:null))}catch(ce){throw console.error("Error saving discussion guide:",ce),ce}},[t,E]),an=v.useCallback(ee=>{console.log("šŸ”„ handleGuideEditingStateChange called:",{editing:ee,timestamp:new Date().toISOString(),currentIsEditingGuideContent:E}),k(ee),I(ee),!ee&&D.current&&(console.log("šŸ“ Updating focus group state after editing ended"),d(D.current))},[E]),rn=v.useCallback(()=>{j(ee=>!ee)},[]),gr=v.useCallback((ee,ce,ke,Fe,Ue,_t)=>{Q({isOpen:!0,sectionId:ee,itemId:ce,content:ke,sectionTitle:Fe,itemTitle:Ue,itemType:_t})},[]),H=ee=>{console.log("šŸ” EXTRACT ASSET FILENAME DEBUG - Input content:",ee);const ce=[/'([^']*\.[a-zA-Z]{3,4})'/g,/"([^"]*\.[a-zA-Z]{3,4})"/g,/titled\s+['"]([^'"]*\.[a-zA-Z]{3,4})['"](?:\.|,|\s|$)/gi,/asset[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/image[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/file[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/\b([a-zA-Z0-9_-]+\.[a-zA-Z]{3,4})\b/g];for(let ke=0;ke0){const _t=Ue[0][1];if(console.log(`šŸ” Pattern ${ke+1} extracted filename:`,_t),_t&&_t.includes("."))return console.log("āœ… EXTRACT ASSET FILENAME - Found:",_t),_t}}return console.warn("āŒ EXTRACT ASSET FILENAME - No filename found in content"),null},he=()=>{if(m)return{sectionId:m.current_section_id,sectionTitle:m.current_section,itemId:m.current_item_id,itemTitle:m.current_item}},ue=()=>{if(r.length!==0)return r[r.length-1].id},je=()=>{const ee=ue();if(!ee||r.length===0)return new Date;const ce=r.find(ke=>ke.id===ee);return ce?ce.timestamp:new Date},Be=async()=>{if(t){Le(!0),lt(!1),T(!1),qe.info("Analyzing discussion for key themes...",{description:"This may take a moment as we process the entire conversation."});try{const ee=await Xn.generateKeyThemes(t);ee.data&&ee.data.themes?(lt(!0),qe.success(`Generated ${ee.data.themes.length} key themes`,{description:"New themes have been added to the analysis."}),l(ce=>[...ce,...ee.data.themes])):(lt(!0),qe.warning("No new themes were generated",{description:"Try again when the discussion has more content."}))}catch(ee){console.error("Error generating key themes:",ee),T(!0),qe.error("Failed to generate key themes",{description:"There was an error analyzing the discussion. Please try again."})}}},zt=()=>{Le(!1),lt(!1),T(!1)},er=()=>{de||ye(new Date),De(!0)},so=ee=>{$(ce=>[...ce,ee].sort((ke,Fe)=>Fe.createdAt.getTime()-ke.createdAt.getTime())),window.notesPanelAddNote&&window.notesPanelAddNote(ee)},Mu=ee=>{const ce=r.find(ke=>ke.id===ee);ce?(g("chat"),setTimeout(()=>{const ke=document.getElementById(`message-${ce.id}`);ke&&(P||ke.scrollIntoView({behavior:"smooth",block:"center"}),ke.style.backgroundColor="#fbbf24",ke.style.transition="background-color 0.3s ease",setTimeout(()=>{ke.style.backgroundColor=""},2e3))},100)):qe.info("Message not found",{description:"Could not locate the original message for this note."})};v.useEffect(()=>{r.length>0&&!de&&ye(new Date)},[r.length,de]),v.useEffect(()=>{O.current=P,P||fn()},[P]);const na=ee=>{Z(ce=>ce.includes(ee)?ce.filter(ke=>ke!==ee):[...ce,ee])};return C?a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(Aa,{}),a.jsxs("div",{className:"max-w-7xl mx-auto text-center py-12",children:[a.jsx("div",{className:"flex justify-center items-center",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}),a.jsx("p",{className:"mt-4 text-slate-600",children:"Loading focus group..."})]})]}):u?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),M&&a.jsx("div",{className:`w-full transition-all duration-300 ${st?"bg-green-500":Ke?"bg-yellow-500":"bg-red-500"}`,children:a.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex items-center justify-between py-2 text-white text-sm font-medium",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("div",{className:`w-2 h-2 rounded-full ${st?"bg-white animate-pulse":Ke?"bg-white animate-spin":"bg-white"}`}),a.jsx("span",{children:st?"Real-time updates active - Changes appear instantly":Ke?"Connecting to real-time updates...":"Real-time updates unavailable - Using periodic refresh"}),Nt&&a.jsx("span",{className:"text-xs opacity-75 ml-2",title:Nt,children:"(Connection error)"})]}),a.jsx("button",{onClick:()=>U(!1),className:"ml-4 text-white hover:text-gray-200 transition-colors",title:"Hide status bar","aria-label":"Hide connection status",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}),!M&&a.jsx("div",{className:"fixed top-20 right-4 z-40",children:a.jsx("button",{onClick:()=>U(!0),className:`px-3 py-1 rounded-full text-white text-xs font-medium shadow-lg transition-all duration-200 hover:shadow-xl ${st?"bg-green-500 hover:bg-green-600":Ke?"bg-yellow-500 hover:bg-yellow-600":"bg-red-500 hover:bg-red-600"}`,title:st?"WebSocket connected - Show status bar":Ke?"WebSocket connecting - Show status bar":"WebSocket disconnected - Show status bar",children:a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx("div",{className:`w-2 h-2 rounded-full bg-white ${st?"animate-pulse":""}`}),a.jsx("span",{children:st?"Live":Ke?"Connecting":"Offline"})]})})}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-4",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(J,{variant:"ghost",onClick:()=>e("/focus-groups"),className:"mr-2",children:a.jsx(Kp,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-2xl font-bold text-slate-900",children:u.name}),a.jsx("p",{className:"text-slate-600",children:new Date(u.date).toLocaleString()}),a.jsxs("div",{className:"flex items-center mt-1",children:[a.jsx(ya,{className:"h-3 w-3 text-slate-500 mr-1"}),a.jsx(Sr,{variant:"secondary",className:"text-xs",children:u.llm_model==="gpt-4.1"?"GPT-4.1":u.llm_model==="gpt-5"?"GPT-5":"Gemini 2.5 Pro"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-4 mt-4 sm:mt-0",children:[a.jsxs(J,{variant:"outline",onClick:()=>x(!b),className:b?"bg-blue-50 text-blue-600":"",children:[a.jsx(B_,{className:"mr-2 h-4 w-4"}),"AI Dashboard"]}),a.jsxs(J,{variant:"outline",onClick:()=>R(!0),children:[a.jsx(LE,{className:"mr-2 h-4 w-4"}),"AI Model"]}),a.jsxs(J,{variant:"outline",onClick:yt,children:[a.jsx(lu,{className:"mr-2 h-4 w-4"}),"Download Transcript"]})]})]}),ct&&a.jsx("div",{className:"mb-6",children:a.jsx(zN,{isActive:ct,isComplete:At,hasError:Jt,label:"Analyzing discussion for key themes",onComplete:zt,className:"max-w-4xl mx-auto"})}),a.jsx(P$e,{discussionGuide:u.discussionGuide,moderatorStatus:m,onSectionSelect:ut,onSetPosition:gr,onSave:An,focusGroupId:t||"",isOpen:A,onToggle:rn,onEditingChange:an}),a.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 h-[calc(100vh-12rem)]",children:[a.jsx(ude,{participants:f,selectedParticipantIds:Ee,onToggleParticipantFilter:na}),a.jsx("div",{className:"flex-1 flex flex-col",children:a.jsxs(dl,{defaultValue:"chat",value:p,onValueChange:g,className:"w-full h-full flex flex-col",children:[a.jsxs(Va,{className:"grid grid-cols-4 mb-4",children:[a.jsxs(gn,{value:"chat",className:"flex items-center",children:[a.jsx(As,{className:"h-4 w-4 mr-2"}),"Discussion"]}),a.jsxs(gn,{value:"themes",className:"flex items-center",children:[a.jsx(uu,{className:"h-4 w-4 mr-2"}),"Key Themes"]}),a.jsxs(gn,{value:"notes",className:"flex items-center",children:[a.jsx(Ky,{className:"h-4 w-4 mr-2"}),"Notes"]}),a.jsxs(gn,{value:"analytics",className:"flex items-center",children:[a.jsx(B_,{className:"h-4 w-4 mr-2"}),"Analytics"]})]}),a.jsx(vn,{value:"chat",className:"m-0 flex-1 flex flex-col h-0",children:r.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[a.jsx("p",{className:"text-lg text-slate-600",children:"No messages yet. Start the session to begin the discussion."}),a.jsxs(J,{onClick:ta,size:"lg",className:"flex items-center gap-2",children:[a.jsx(u5,{className:"h-5 w-5"}),"Start Session"]})]}):a.jsx(Fde,{messages:r,modeEvents:o,personas:f,isSpeaking:!1,focusGroupId:t||"",isAiModeActive:w,selectedParticipantIds:Ee,onToggleHighlight:Pe,onAdvanceDiscussion:()=>null,onNewMessage:q,onStatusChange:Xt,isEditingDiscussionGuide:P})}),a.jsx(vn,{value:"themes",className:"m-0",children:a.jsx(Ude,{themes:c,messages:r,personas:f,focusGroupId:t||"",onThemesGenerated:bt,onThemeDelete:hn,onQuoteClick:et,onGenerateKeyThemes:Be})}),a.jsx(vn,{value:"notes",className:"m-0",style:{height:"calc(100% - 3.5rem)"},children:a.jsx("div",{className:"h-full",children:a.jsx(k$e,{focusGroupId:t||"",focusGroupName:u==null?void 0:u.name,onNoteClick:Mu})})}),a.jsx(vn,{value:"analytics",className:"m-0",children:a.jsx(j$e,{messages:r,themes:c,personas:f})})]})})]})]}),r.length>0&&a.jsx("div",{className:"fixed bottom-6 right-6 z-40",children:a.jsx(J,{onClick:er,className:"rounded-full h-12 w-12 p-0 shadow-lg",title:"Take a quick note",children:a.jsx(Ky,{className:"h-5 w-5"})})}),a.jsx(O$e,{isOpen:ae,onClose:()=>De(!1),focusGroupId:t||"",associatedMessageId:ue(),sectionInfo:he(),messageTimestamp:je(),onNoteSaved:so}),a.jsx(Ql,{open:V.isOpen,onOpenChange:ee=>Q(ce=>({...ce,isOpen:ee})),children:a.jsxs($c,{children:[a.jsxs(Lc,{children:[a.jsx(Bc,{children:"Set Moderator Position"}),a.jsxs(Xl,{children:['Are you sure you want to set the moderator position to "',V.itemTitle,'" in section "',V.sectionTitle,'"? This will make the moderator ask this question in the chat.']})]}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",disabled:V.isLoading,onClick:()=>Q({isOpen:!1}),children:"Cancel"}),a.jsxs(J,{disabled:V.isLoading,onClick:async()=>{var ee,ce,ke,Fe,Ue,_t,He,nt,Se;if(!(!t||!V.sectionId||!V.itemId||!V.content)){Q(Gt=>({...Gt,isLoading:!0}));try{await Xn.setModeratorPosition(t,V.sectionId,V.itemId);let Gt=[],wt=!1,en=V.content;const qt=V.content?H(V.content):null,Ci=!!qt;if(console.log("šŸ” MANUAL POSITION DEBUG:",{itemType:V.itemType,hasImageAttached:Ci,assetFilename:qt,content:V.content,sectionTitle:V.sectionTitle,itemTitle:V.itemTitle,contentLength:(ee=V.content)==null?void 0:ee.length}),Ci&&V.content&&qt)if(console.log("šŸ” ASSET EXTRACTION DEBUG:",{originalContent:V.content,extractedFilename:qt,contentLength:V.content.length}),qt){Gt=[qt],wt=!0,console.log("šŸŽØ MANUAL POSITION: Creative review detected, will activate visual context for:",qt);try{console.log("šŸŽØ MANUAL MODE: Requesting AI description for",qt);try{console.log("šŸ” TESTING: Calling test endpoint first...");const hh=await $e.post(`/focus-groups/${t}/test-endpoint`,{test:"data"});console.log("āœ… TEST: Test endpoint response:",hh.data)}catch(hh){console.error("āŒ TEST: Test endpoint failed:",hh)}const ln=await Ot.describeAsset(t,qt);ln.data.description&&(en=V.content.replace(`'${qt}'`,`'${qt}' - ${ln.data.description}`),console.log("āœ… MANUAL MODE: Enhanced question with AI description"),console.log("šŸ” Original:",V.content),console.log("šŸ” Enhanced:",en))}catch(ln){console.error("āš ļø MANUAL MODE: Failed to generate AI description:",ln),console.error("āš ļø Error response data:",(ce=ln.response)==null?void 0:ce.data),console.error("āš ļø Error status:",(ke=ln.response)==null?void 0:ke.status),console.error("āš ļø Error headers:",(Fe=ln.response)==null?void 0:Fe.headers),console.error("āš ļø Full axios error:",{message:ln.message,code:ln.code,status:(Ue=ln.response)==null?void 0:Ue.status,statusText:(_t=ln.response)==null?void 0:_t.statusText,url:(He=ln.config)==null?void 0:He.url,method:(nt=ln.config)==null?void 0:nt.method}),qe.warning("AI description failed",{description:"Using original question text. Image will still be available to participants."})}}else console.warn("āš ļø MANUAL POSITION: Creative review detected but no asset filename extracted from content");const On={id:`msg-${Date.now()}`,senderId:"moderator",text:en,timestamp:new Date,type:"question"};console.log("šŸ“¤ Sending moderator message to API:",{text:en,attachedAssets:Gt,activatesVisualContext:wt});try{const ln=await Ot.sendMessage(t,{senderId:"moderator",text:en,type:"question",attached_assets:Gt,activates_visual_context:wt});(Se=ln==null?void 0:ln.data)!=null&&Se.message_id?(On.id=ln.data.message_id,console.log("āœ… Message API call successful, assigned ID:",On.id)):console.warn("āš ļø Message API call succeeded but no message_id returned:",ln==null?void 0:ln.data)}catch(ln){console.error("āŒ Failed to save message to API:",ln),qe.warning("Message display only",{description:"The moderator message is shown locally but may not be saved to the server."})}console.log("šŸ“Ø Adding moderator message to UI:",{messageId:On.id,text:On.text,hasAssets:Gt.length>0}),q(On),Q({isOpen:!1}),console.log("āœ… Set position complete, moderator message added to UI"),qe.success("Moderator position set",{description:`Position set to "${V.itemTitle}" in "${V.sectionTitle}"`})}catch(Gt){console.error("Error setting moderator position:",Gt),Q(wt=>({...wt,isLoading:!1})),qe.error("Failed to set moderator position",{description:"There was an error setting the moderator position."})}}},className:"flex items-center gap-2",children:[V.isLoading&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),V.isLoading?"Generating detailed image description...":"Confirm"]})]})]})}),a.jsx(Ql,{open:G,onOpenChange:R,children:a.jsxs($c,{children:[a.jsxs(Lc,{children:[a.jsx(Bc,{children:"AI Model Settings"}),a.jsx(Xl,{children:"Choose which AI model to use for generating responses and discussion guides in this focus group."})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ya,{className:"h-4 w-4 text-slate-500"}),a.jsx("span",{className:"text-sm font-medium",children:"Current Model:"}),a.jsx(Sr,{variant:"secondary",children:(u==null?void 0:u.llm_model)==="gpt-4.1"?"GPT-4.1":(u==null?void 0:u.llm_model)==="gpt-5"?"GPT-5":"Gemini 2.5 Pro"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Select AI Model:"}),a.jsxs(Un,{value:L,onValueChange:ee=>{console.log("šŸ”§ Model selection changed:",{from:L,to:ee}),W(ee)},children:[a.jsx(Ln,{className:"mt-1",children:a.jsx(Hn,{placeholder:"Select AI model"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(oe,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(oe,{value:"gpt-5",children:"GPT-5"})]})]})]}),L==="gpt-5"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Reasoning Effort:"}),a.jsxs(Un,{value:Y,onValueChange:te,children:[a.jsx(Ln,{className:"mt-1",children:a.jsx(Hn,{placeholder:"Select reasoning effort"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"minimal",children:"Minimal - Fast responses"}),a.jsx(oe,{value:"low",children:"Low - Quick thinking"}),a.jsx(oe,{value:"medium",children:"Medium - Balanced (default)"}),a.jsx(oe,{value:"high",children:"High - Deep reasoning"})]})]}),a.jsx("p",{className:"text-xs text-slate-600 mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx("p",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how thoroughly GPT-5 thinks and how detailed responses are"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Response Verbosity:"}),a.jsxs(Un,{value:me,onValueChange:F,children:[a.jsx(Ln,{className:"mt-1",children:a.jsx(Hn,{placeholder:"Select verbosity level"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"low",children:"Low - Concise responses"}),a.jsx(oe,{value:"medium",children:"Medium - Balanced length (default)"}),a.jsx(oe,{value:"high",children:"High - Detailed responses"})]})]}),a.jsx("p",{className:"text-xs text-slate-600 mt-1",children:"Controls how detailed and lengthy GPT-5's responses will be"}),a.jsx("p",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how thoroughly GPT-5 thinks and how detailed responses are"})]})]}),a.jsxs("div",{className:"text-xs text-slate-600",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Gemini 2.5 Pro:"})," Google's advanced model, great for creative and analytical tasks."]}),a.jsxs("p",{children:[a.jsx("strong",{children:"GPT-4.1:"})," OpenAI's latest model, excellent for conversational and reasoning tasks."]}),a.jsxs("p",{children:[a.jsx("strong",{children:"GPT-5:"})," OpenAI's newest model with advanced reasoning and customizable response styles."]})]})]}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:()=>R(!1),disabled:se,children:"Cancel"}),a.jsxs(J,{onClick:()=>{console.log("šŸ”§ Update button clicked:",{selectedModel:L,selectedReasoningEffort:Y,selectedVerbosity:me,currentModel:u==null?void 0:u.llm_model,isDisabled:se||L===(u==null?void 0:u.llm_model)&&(L!=="gpt-5"||Y===(u==null?void 0:u.reasoning_effort)&&me===(u==null?void 0:u.verbosity))}),wn(L,Y,me)},disabled:se||L===(u==null?void 0:u.llm_model)&&(L!=="gpt-5"||Y===((u==null?void 0:u.reasoning_effort)||"medium")&&me===((u==null?void 0:u.verbosity)||"medium")),children:[se&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),se?"Updating...":"Update Model"]})]})]})}),a.jsx(N$e,{focusGroupId:t,personas:f,isVisible:b,onToggle:()=>x(!b)})]}):a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(Aa,{}),a.jsxs("div",{className:"max-w-7xl mx-auto text-center py-12",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Focus group not found"}),a.jsx("p",{className:"mt-2 text-slate-600",children:"We couldn't find the focus group you're looking for."}),a.jsxs(J,{onClick:()=>e("/focus-groups"),className:"mt-4",children:[a.jsx(Kp,{className:"mr-2 h-4 w-4"})," Back to Focus Groups"]})]})]})},kLe=({title:t,description:e})=>a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:t}),a.jsx("p",{className:"text-slate-600 mt-1",children:e})]}),a.jsxs("div",{className:"mt-4 sm:mt-0 flex gap-2",children:[a.jsx(J,{variant:"outline",children:"Export Data"}),a.jsx(J,{children:"Generate Report"})]})]}),IC=({title:t,value:e,changePercentage:n,icon:r})=>a.jsx(gt,{className:"p-6 hover:shadow-md transition-shadow",children:a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-muted-foreground text-sm",children:t}),a.jsx("h3",{className:"text-2xl font-bold mt-1",children:e}),a.jsxs("p",{className:`${n>=0?"text-green-500":"text-red-500"} text-xs mt-1`,children:[n>=0?"↑":"↓"," ",Math.abs(n),"% from last month"]})]}),a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:a.jsx(r,{className:"h-6 w-6 text-primary"})})]})}),OLe=[{name:"Jan",users:20,groups:3,interactions:120},{name:"Feb",users:25,groups:4,interactions:160},{name:"Mar",users:30,groups:5,interactions:220},{name:"Apr",users:40,groups:6,interactions:280},{name:"May",users:45,groups:7,interactions:350},{name:"Jun",users:48,groups:7,interactions:420}],ILe=[{id:"1",title:"User Interface Feedback",description:"Users consistently mentioned difficulty with the navigation menu on mobile devices.",source:"Mobile App Focus Group",date:"2023-06-12",sentiment:"negative"},{id:"2",title:"Feature Adoption",description:'The new search functionality is well-received, with 85% of users rating it as "very useful".',source:"Product Testing Group",date:"2023-06-10",sentiment:"positive"},{id:"3",title:"Pricing Strategy",description:"Price-conscious users expressed willingness to pay up to 20% more for premium features.",source:"Pricing Model Analysis",date:"2023-06-08",sentiment:"positive"},{id:"4",title:"Competitive Analysis",description:"Users who switched from competitor products cited our streamlined onboarding as a key factor.",source:"Customer Journey Mapping",date:"2023-06-05",sentiment:"positive"}],RLe=()=>a.jsxs("div",{className:"space-y-6",children:[a.jsxs(gt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Research Activity"}),a.jsx("div",{className:"h-64",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(wW,{data:OLe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(ng,{strokeDasharray:"3 3"}),a.jsx(rl,{dataKey:"name"}),a.jsx(il,{}),a.jsx(ei,{}),a.jsx(rs,{type:"monotone",dataKey:"users",stackId:"1",stroke:"#8884d8",fill:"#8884d8",name:"Synthetic Users"}),a.jsx(rs,{type:"monotone",dataKey:"groups",stackId:"2",stroke:"#82ca9d",fill:"#82ca9d",name:"Focus Groups"}),a.jsx(rs,{type:"monotone",dataKey:"interactions",stackId:"3",stroke:"#ffc658",fill:"#ffc658",name:"Interactions"})]})})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs(gt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Recent AI Insights"}),a.jsxs("div",{className:"space-y-4",children:[ILe.slice(0,3).map(t=>a.jsx("div",{className:"border-b pb-4 last:border-b-0 last:pb-0",children:a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:`p-2 rounded-full mr-3 ${t.sentiment==="positive"?"bg-green-100":t.sentiment==="negative"?"bg-red-100":"bg-slate-100"}`,children:a.jsx(au,{className:`h-4 w-4 ${t.sentiment==="positive"?"text-green-600":t.sentiment==="negative"?"text-red-600":"text-slate-600"}`})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:t.title}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.description}),a.jsxs("div",{className:"flex items-center text-xs text-muted-foreground mt-2",children:[a.jsx("span",{children:t.source}),a.jsx("span",{className:"mx-2",children:"•"}),a.jsx("span",{children:t.date})]})]})]})},t.id)),a.jsx(J,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"View All Insights"})]})]}),a.jsxs(gt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Upcoming Research Tasks"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-blue-100 p-2 rounded-full mr-3",children:a.jsx(cv,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Website Redesign Feedback"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Focus group scheduled for Jun 20"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-purple-100 p-2 rounded-full mr-3",children:a.jsx(cv,{className:"h-4 w-4 text-purple-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Mobile App User Testing"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"8 participants needed by Jun 25"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-amber-100 p-2 rounded-full mr-3",children:a.jsx(cv,{className:"h-4 w-4 text-amber-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Pricing Strategy Evaluation"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Create discussion guide by Jun 22"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-green-100 p-2 rounded-full mr-3",children:a.jsx(cv,{className:"h-4 w-4 text-green-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Product Onboarding Flow"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Results analysis due Jun 30"})]})]}),a.jsx(J,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"Manage Research Calendar"})]})]})]})]}),MLe=[{name:"18-24",value:15},{name:"25-34",value:35},{name:"35-44",value:25},{name:"45-54",value:15},{name:"55+",value:10}],DLe=()=>a.jsxs(gt,{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold",children:"Synthetic Persona Analytics"}),a.jsx(J,{variant:"outline",size:"sm",children:"View Demographics"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Persona Demographics"}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(tk,{children:[a.jsx(ei,{}),a.jsx(gs,{data:MLe,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,fill:"#FFDEE2",label:!0})]})})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Persona Distribution"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Age: 25-34"}),a.jsx("span",{children:"35%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-400 rounded-full",style:{width:"35%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Tech Savvy"}),a.jsx("span",{children:"72%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-300 rounded-full",style:{width:"72%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Brand Loyal"}),a.jsx("span",{children:"58%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-500 rounded-full",style:{width:"58%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Price Sensitive"}),a.jsx("span",{children:"67%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-200 rounded-full",style:{width:"67%"}})})]})]})]})]}),a.jsx("div",{className:"flex justify-center mt-6",children:a.jsx(J,{onClick:()=>window.location.href="/synthetic-users",children:"Manage Synthetic Personas"})})]}),$Le=[{name:"Jan",users:20,groups:3,interactions:120},{name:"Feb",users:25,groups:4,interactions:160},{name:"Mar",users:30,groups:5,interactions:220},{name:"Apr",users:40,groups:6,interactions:280},{name:"May",users:45,groups:7,interactions:350},{name:"Jun",users:48,groups:7,interactions:420}],L$=[{name:"Very Positive",value:25,color:"#4ade80"},{name:"Positive",value:40,color:"#a3e635"},{name:"Neutral",value:20,color:"#93c5fd"},{name:"Negative",value:10,color:"#fb923c"},{name:"Very Negative",value:5,color:"#f87171"}],LLe=[{name:"Navigation",count:42},{name:"Performance",count:28},{name:"UX Design",count:36},{name:"Features",count:22},{name:"Onboarding",count:18}],FLe=()=>{const t=ar();return a.jsxs(gt,{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold",children:"Focus Group Insights"}),a.jsx(J,{variant:"outline",size:"sm",onClick:()=>t("/focus-groups"),children:"View All Sessions"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Session Analytics"}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(wW,{data:$Le,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(ng,{strokeDasharray:"3 3"}),a.jsx(rl,{dataKey:"name"}),a.jsx(il,{}),a.jsx(ei,{}),a.jsx(rs,{type:"monotone",dataKey:"interactions",stroke:"#8884d8",fill:"#8884d8",name:"User Interactions"})]})})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Feedback Sentiment"}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(tk,{children:[a.jsx(ei,{}),a.jsx(gs,{data:L$,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:e,percent:n})=>`${e} ${(n*100).toFixed(0)}%`,children:L$.map((e,n)=>a.jsx(Og,{fill:e.color},`cell-${n}`))}),a.jsx(Ea,{})]})})})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Topic Frequency Analysis"}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(bW,{data:LLe,margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(ng,{strokeDasharray:"3 3"}),a.jsx(rl,{dataKey:"name"}),a.jsx(il,{}),a.jsx(ei,{}),a.jsx(Ea,{}),a.jsx(gl,{dataKey:"count",name:"Mentions",fill:"#8884d8"})]})})})]}),a.jsx("div",{className:"flex justify-center",children:a.jsx(J,{onClick:()=>t("/focus-groups"),children:"Manage Focus Groups"})})]})},BLe=()=>{const[t,e]=v.useState("overview");return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsx(kLe,{title:"Dashboard",description:"Monitor and analyze your research insights"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-8",children:[a.jsx(IC,{title:"Total Synthetic Users",value:48,changePercentage:12,icon:Dr}),a.jsx(IC,{title:"Active Focus Groups",value:7,changePercentage:5,icon:Vs}),a.jsx(IC,{title:"Research Insights",value:124,changePercentage:18,icon:uu})]}),a.jsxs(dl,{value:t,onValueChange:e,className:"glass-panel rounded-xl p-6",children:[a.jsxs(Va,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(gn,{value:"overview",children:"Overview"}),a.jsx(gn,{value:"users",children:"Synthetic Users"}),a.jsx(gn,{value:"focus-groups",children:"Focus Groups"})]}),a.jsx(vn,{value:"overview",children:a.jsx(RLe,{})}),a.jsx(vn,{value:"users",children:a.jsx(DLe,{})}),a.jsx(vn,{value:"focus-groups",children:a.jsx(FLe,{})})]})]})]})},LW=v.forwardRef(({...t},e)=>a.jsx("nav",{ref:e,"aria-label":"breadcrumb",...t}));LW.displayName="Breadcrumb";const FW=v.forwardRef(({className:t,...e},n)=>a.jsx("ol",{ref:n,className:Ne("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...e}));FW.displayName="BreadcrumbList";const hy=v.forwardRef(({className:t,...e},n)=>a.jsx("li",{ref:n,className:Ne("inline-flex items-center gap-1.5",t),...e}));hy.displayName="BreadcrumbItem";const mj=v.forwardRef(({asChild:t,className:e,...n},r)=>{const i=t?Hs:"a";return a.jsx(i,{ref:r,className:Ne("transition-colors hover:text-foreground",e),...n})});mj.displayName="BreadcrumbLink";const BW=v.forwardRef(({className:t,...e},n)=>a.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:Ne("font-normal text-foreground",t),...e}));BW.displayName="BreadcrumbPage";const gj=({children:t,className:e,...n})=>a.jsx("li",{role:"presentation","aria-hidden":"true",className:Ne("[&>svg]:size-3.5",e),...n,children:t??a.jsx(fo,{})});gj.displayName="BreadcrumbSeparator";function ULe({persona:t}){const e=t.id==="0",n=t.id==="1";return a.jsxs(gt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx("div",{className:"h-16 w-16 rounded-full bg-muted flex items-center justify-center",children:a.jsx("img",{src:Cg(t),alt:t.name,className:"h-16 w-16 rounded-full object-cover"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-sf text-xl font-semibold",children:t.name}),a.jsx("p",{className:"text-muted-foreground",children:t.occupation})]})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Dr,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Demographics"}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[t.age," ",t.gender?a.jsxs(a.Fragment,{children:["• ",t.gender]}):null,t.ethnicity?a.jsxs(a.Fragment,{children:[" • ",t.ethnicity]}):null]}),t.education&&a.jsx("p",{className:"sidebar-sub-item",children:t.education}),t.socialGrade&&a.jsxs("p",{className:"sidebar-sub-item",children:["Social Grade: ",t.socialGrade]}),t.householdIncome&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household Income: ",t.householdIncome]}),t.householdComposition&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household: ",t.householdComposition]})]})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(nZ,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Location"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.location}),t.livingSituation&&a.jsx("p",{className:"sidebar-sub-item",children:t.livingSituation})]})]}),t.interests&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(z_,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Interests"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.interests})]})]}),t.mediaConsumption&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(IS,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Media"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.mediaConsumption})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-sm mb-3",children:"Digital Behavior"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Tech Savviness"}),a.jsxs("span",{children:[t.techSavviness,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-blue-500 rounded-full",style:{width:`${t.techSavviness}%`}})})]}),t.brandLoyalty!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Brand Loyalty"}),a.jsxs("span",{children:[t.brandLoyalty,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-purple-500 rounded-full",style:{width:`${t.brandLoyalty}%`}})})]}),t.priceConsciousness!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Price Sensitivity"}),a.jsxs("span",{children:[t.priceConsciousness,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-amber-500 rounded-full",style:{width:`${t.priceConsciousness}%`}})})]}),t.environmentalConcern!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Environmental Concern"}),a.jsxs("span",{children:[t.environmentalConcern,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:`${t.environmentalConcern}%`}})})]}),t.deviceUsage&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-medium mt-3",children:"Device Usage"}),a.jsx("p",{className:"sidebar-sub-item text-xs",children:t.deviceUsage})]}),t.shoppingHabits&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-medium mt-3",children:"Shopping Habits"}),a.jsx("p",{className:"sidebar-sub-item text-xs",children:t.shoppingHabits})]})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-sm mb-3",children:"Additional Information"}),a.jsxs("div",{className:"space-y-2",children:[t.brandPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(z_,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.brandPreferences})]}),t.communicationPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(qp,{className:"sidebar-icon"}),a.jsxs("span",{className:"text-muted-foreground text-sm",children:["Prefers: ",t.communicationPreferences]})]}),t.deviceUsage&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(iZ,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.deviceUsage})]}),t.shoppingHabits&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(cZ,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.shoppingHabits})]}),t.additionalInformation&&typeof t.additionalInformation=="string"&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(JJ,{className:"sidebar-icon"}),a.jsx("div",{className:"sidebar-sub-item",children:t.additionalInformation.split(` -`).map((r,i)=>a.jsx("div",{className:"mb-1",children:r.trim().startsWith("•")||r.trim().startsWith("-")?r.trim().substring(1).trim():r.trim()},i))})]}),e&&a.jsxs("div",{className:"pt-2 space-y-2",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(YO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Maintains an extensive network of financial and luxury industry contacts"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Vy,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Owns vacation properties in the Cotswolds and South of France"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(IS,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Collector of rare first-edition books and limited-edition art prints"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(QO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Significant investment portfolio with focus on sustainable luxury ventures"})]})]}),n&&a.jsxs("div",{className:"pt-2 space-y-2",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(IS,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Active in industry panels, luxury brand collaborations, follows influencers in luxury & design"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Vy,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Modern flat in exclusive Chelsea, accessible to boutique services"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(QO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Uses premium digital payment & secure banking for HNWIs"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(YO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Respected network in London's luxury sector; attends exclusive events"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(qp,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Seeks autonomy, bespoke service, and acknowledgment for taste"})]})]})]})]})]})]})}function HLe({persona:t}){var e,n,r,i,o,s,c,l,u;return a.jsxs("div",{className:"space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(Qv,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Goals"})]}),a.jsx("ul",{className:"space-y-2",children:(e=t.goals)==null?void 0:e.map((d,f)=>a.jsxs("li",{className:"flex items-start",children:[a.jsx("div",{className:"h-5 w-5 rounded-full bg-primary/10 flex items-center justify-center mt-0.5 mr-3",children:a.jsx("span",{className:"text-xs text-primary font-medium",children:f+1})}),a.jsx("p",{className:"text-sm",children:d})]},f))})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(p5,{className:"h-5 w-5 text-amber-500 mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Frustrations"})]}),a.jsx("ul",{className:"space-y-2",children:(n=t.frustrations)==null?void 0:n.map((d,f)=>a.jsxs("li",{className:"text-sm flex items-start",children:[a.jsx("span",{className:"text-amber-500 mr-2",children:"•"}),a.jsx("span",{children:d})]},f))})]})}),a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(pa,{className:"h-5 w-5 text-green-500 mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Motivations"})]}),a.jsx("ul",{className:"space-y-2",children:(r=t.motivations)==null?void 0:r.map((d,f)=>a.jsxs("li",{className:"text-sm flex items-start",children:[a.jsx("span",{className:"text-green-500 mr-2",children:"•"}),a.jsx("span",{children:d})]},f))})]})})]}),a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(au,{className:"h-5 w-5 text-blue-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Thinks"})]}),a.jsx("ul",{className:"space-y-2",children:(o=(i=t.thinkFeelDo)==null?void 0:i.thinks)==null?void 0:o.map((d,f)=>a.jsxs("li",{className:"text-sm bg-blue-50 p-2 rounded-md",children:['"',d,'"']},f))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(z_,{className:"h-5 w-5 text-red-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Feels"})]}),a.jsx("ul",{className:"space-y-2",children:(c=(s=t.thinkFeelDo)==null?void 0:s.feels)==null?void 0:c.map((d,f)=>a.jsxs("li",{className:"text-sm bg-red-50 p-2 rounded-md",children:['"',d,'"']},f))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(pa,{className:"h-5 w-5 text-green-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Does"})]}),a.jsx("ul",{className:"space-y-2",children:(u=(l=t.thinkFeelDo)==null?void 0:l.does)==null?void 0:u.map((d,f)=>a.jsxs("li",{className:"text-sm bg-green-50 p-2 rounded-md",children:['"',d,'"']},f))})]})]})]})})]})}function zLe({persona:t}){var n,r,i,o,s;const e=[{trait:"Openness",value:((n=t.oceanTraits)==null?void 0:n.openness)||50},{trait:"Conscientiousness",value:((r=t.oceanTraits)==null?void 0:r.conscientiousness)||50},{trait:"Extraversion",value:((i=t.oceanTraits)==null?void 0:i.extraversion)||50},{trait:"Agreeableness",value:((o=t.oceanTraits)==null?void 0:o.agreeableness)||50},{trait:"Neuroticism",value:((s=t.oceanTraits)==null?void 0:s.neuroticism)||50}];return a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx("div",{className:"h-80",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(A$e,{outerRadius:90,data:e,children:[a.jsx(gK,{}),a.jsx(uh,{dataKey:"trait"}),a.jsx(lh,{domain:[0,100]}),a.jsx(Lg,{name:"Personality",dataKey:"value",stroke:"#8884d8",fill:"#8884d8",fillOpacity:.5})]})})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Openness to Experience"}),a.jsxs("span",{className:"font-medium",children:[e[0].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-purple-500 rounded-full",style:{width:`${e[0].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[0].value>75?"Highly creative and curious":e[0].value>50?"Somewhat imaginative and open to new ideas":"Practical and prefers routine"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Conscientiousness"}),a.jsxs("span",{className:"font-medium",children:[e[1].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-blue-500 rounded-full",style:{width:`${e[1].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[1].value>75?"Highly organized and responsible":e[1].value>50?"Generally reliable and hardworking":"Spontaneous and flexible"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Extraversion"}),a.jsxs("span",{className:"font-medium",children:[e[2].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:`${e[2].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[2].value>75?"Highly sociable and outgoing":e[2].value>50?"Moderately social and talkative":"Reserved and reflective"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Agreeableness"}),a.jsxs("span",{className:"font-medium",children:[e[3].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-amber-500 rounded-full",style:{width:`${e[3].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[3].value>75?"Highly cooperative and compassionate":e[3].value>50?"Generally kind and helpful":"Competitive and challenging"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Neuroticism"}),a.jsxs("span",{className:"font-medium",children:[e[4].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-red-500 rounded-full",style:{width:`${e[4].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[4].value>75?"Highly sensitive and prone to stress":e[4].value>50?"Moderately reactive to challenges":"Emotionally stable and resilient"})]})]})]})]})})}function GLe({persona:t}){var r;const e=(i,o)=>{const s=[a.jsx(eZ,{className:"sidebar-icon"},"grid"),a.jsx(lZ,{className:"sidebar-icon"},"smartphone"),a.jsx(ZJ,{className:"sidebar-icon"},"laptop"),a.jsx(XJ,{className:"sidebar-icon"},"grid2x2")];return s[o%s.length]},n=()=>t.scenarioType?t.scenarioType:"Life Scenarios";return a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:n()}),a.jsx("div",{className:"space-y-4",children:(r=t.scenarios)==null?void 0:r.map((i,o)=>a.jsx("div",{className:"bg-slate-50 p-4 rounded-lg border",children:a.jsxs("div",{className:"sidebar-section",children:[e(i,o),a.jsxs("div",{children:[a.jsxs("h4",{className:"font-medium text-sm mb-2",children:["Scenario ",o+1]}),a.jsx("p",{className:"text-sm",children:i})]})]})},o))})]})})}function VLe(){const t=ar();return a.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:a.jsxs(gt,{className:"w-96 text-center p-6",children:[a.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Persona Not Found"}),a.jsx("p",{className:"text-muted-foreground mb-6",children:"The persona you're looking for couldn't be found."}),a.jsx(J,{onClick:()=>t("/synthetic-users"),children:"Return to Personas"})]})})}function Bt({className:t,...e}){return a.jsx("div",{className:Ne("animate-pulse rounded-md bg-muted",t),...e})}function KLe(){return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex items-center mb-6 relative",children:[a.jsx(Bt,{className:"absolute left-0 top-0 h-10 w-20"}),a.jsx(Bt,{className:"h-8 w-48 mx-auto"}),a.jsx(Bt,{className:"absolute right-0 top-0 h-10 w-32"})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mt-10",children:[a.jsx("div",{className:"lg:col-span-1",children:a.jsxs(gt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx(Bt,{className:"h-16 w-16 rounded-full"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Bt,{className:"h-6 w-32 mb-2"}),a.jsx(Bt,{className:"h-4 w-24"})]})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"flex items-start",children:[a.jsx(Bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Bt,{className:"h-4 w-20 mb-2"}),a.jsx(Bt,{className:"h-3 w-40 mb-1"}),a.jsx(Bt,{className:"h-3 w-36"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Bt,{className:"h-4 w-16 mb-2"}),a.jsx(Bt,{className:"h-3 w-32"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Bt,{className:"h-4 w-16 mb-2"}),a.jsx(Bt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Bt,{className:"h-4 w-12 mb-2"}),a.jsx(Bt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(Bt,{className:"h-4 w-32 mb-3"}),a.jsx("div",{className:"space-y-3",children:[...Array(4)].map((t,e)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx(Bt,{className:"h-3 w-24"}),a.jsx(Bt,{className:"h-3 w-8"})]}),a.jsx(Bt,{className:"h-1.5 w-full rounded-full"})]},e))})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(Bt,{className:"h-4 w-36 mb-3"}),a.jsx("div",{className:"space-y-2",children:[...Array(3)].map((t,e)=>a.jsxs("div",{className:"flex items-center",children:[a.jsx(Bt,{className:"h-4 w-4 mr-2"}),a.jsx(Bt,{className:"h-3 w-40"})]},e))})]})]})]})}),a.jsxs("div",{className:"lg:col-span-2",children:[a.jsxs("div",{className:"grid w-full grid-cols-3 gap-2 mb-6",children:[a.jsx(Bt,{className:"h-10 w-full"}),a.jsx(Bt,{className:"h-10 w-full"}),a.jsx(Bt,{className:"h-10 w-full"})]}),a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(Bt,{className:"h-6 w-48"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-3/4"}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(Bt,{className:"h-6 w-32"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-2/3"})]}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(Bt,{className:"h-6 w-40"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-5/6"})]})]})})]})]})]})]})}function WLe({message:t,onLoginSuccess:e,onCancel:n}){const{login:r}=Xs(),i=ar(),[o,s]=v.useState("user"),[c,l]=v.useState("pass"),[u,d]=v.useState(!1),f=async()=>{if(!o||!c){re.error("Please enter username and password");return}d(!0);try{await r(o,c),re.success("Login successful"),e&&e()}catch(p){console.error("Login error:",p),re.error("Login failed",{description:"Please check your credentials and try again"})}finally{d(!1)}},h=()=>{n?n():i("/synthetic-users")};return a.jsxs(gt,{className:"max-w-md mx-auto shadow-lg",children:[a.jsxs(ji,{children:[a.jsx(Wi,{children:"Login Required"}),a.jsx(uN,{children:t||"You need to log in to save personas to the database"})]}),a.jsxs(Rt,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(mo,{htmlFor:"username",children:"Username"}),a.jsx(Ht,{id:"username",placeholder:"Username",value:o,onChange:p=>s(p.target.value),disabled:u})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mo,{htmlFor:"password",children:"Password"}),a.jsx(Ht,{id:"password",type:"password",placeholder:"Password",value:c,onChange:p=>l(p.target.value),disabled:u})]}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Default credentials: user / pass"})]}),a.jsxs(dN,{className:"flex justify-between",children:[a.jsx(J,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(J,{onClick:f,disabled:u,children:u?a.jsxs(a.Fragment,{children:[a.jsx(Ds,{className:"h-4 w-4 mr-2 animate-spin"}),"Logging in..."]}):"Login"})]})]})}function qLe({persona:t,onSave:e,onCancel:n}){var j,P,k,O,E,I,D,z,$,G,R,L,W,Y,te,me;const r={...t,education:t.education||"",interests:t.interests||"",brandLoyalty:t.brandLoyalty||0,priceConsciousness:t.priceConsciousness||0,environmentalConcern:t.environmentalConcern||0,hasPurchasingPower:t.hasPurchasingPower||!1,hasChildren:t.hasChildren||!1,goals:t.goals||[],frustrations:t.frustrations||[],motivations:t.motivations||[],scenarios:t.scenarios||[],oceanTraits:t.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:t.thinkFeelDo||{thinks:[],feels:[],does:[]}},[i,o]=v.useState(r),[s,c]=v.useState(!1),[l,u]=v.useState(!1),[d,f]=v.useState(null);v.useState(!1);const{isAuthenticated:h,token:p}=Xs();v.useEffect(()=>{(async()=>{l&&h&&p&&(u(!1),d&&await A())})()},[h,p,l]);const g=(F,se)=>{o(ne=>({...ne,[F]:se}))},m=(F,se)=>{o(ne=>({...ne,oceanTraits:{...ne.oceanTraits,[F]:se}}))},y=F=>{o(se=>({...se,[F]:[...se[F]||[],""]}))},b=(F,se,ne)=>{o(ae=>{const De=[...ae[F]||[]];return De[se]=ne,{...ae,[F]:De}})},x=(F,se)=>{o(ne=>{const ae=[...ne[F]||[]];return ae.splice(se,1),{...ne,[F]:ae}})},w=(F,se,ne)=>{o(ae=>{const De={...ae.thinkFeelDo},de=[...De[F]||[]];return de[se]=ne,De[F]=de,{...ae,thinkFeelDo:De}})},S=F=>{o(se=>{var ae;const ne={...se.thinkFeelDo,[F]:[...((ae=se.thinkFeelDo)==null?void 0:ae[F])||[],""]};return{...se,thinkFeelDo:ne}})},C=(F,se)=>{o(ne=>{const ae={...ne.thinkFeelDo},De=[...ae[F]||[]];return De.splice(se,1),ae[F]=De,{...ne,thinkFeelDo:ae}})},_=()=>{d&&(re.error("Login canceled - Persona changes not saved"),u(!1),f(null),n())},A=async()=>{if(d){c(!0);try{const F={...d};delete F._id,delete F.isDbPersona;const se=await zr.create(F),ne={...d,id:se.data._id||se.data.id,_id:se.data._id||se.data.id,isDbPersona:!0};re.success("Persona saved to database successfully"),u(!1),f(null),e(ne)}catch(F){console.error("Error saving after login:",F),re.error("Failed to save to database after login"),u(!1),f(null)}finally{c(!1)}}};return l?a.jsxs("div",{className:"max-w-5xl mx-auto bg-background p-6",children:[a.jsx("div",{className:"flex justify-between items-center mb-6",children:a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Authentication Required"})}),a.jsx("p",{className:"mb-6 text-muted-foreground",children:"Login is required to save personas to the database. You can either:"}),a.jsxs("ul",{className:"list-disc ml-6 mt-2 mb-6",children:[a.jsx("li",{children:"Log in to save this persona to the database"}),a.jsx("li",{children:"Cancel to discard your changes"})]}),a.jsx(WLe,{message:"Login is required to save your persona to the database",onLoginSuccess:A,onCancel:_})]}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(J,{variant:"ghost",onClick:n,className:"mr-2",children:a.jsx(Kp,{className:"h-5 w-5"})}),a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Edit Persona"})]}),a.jsxs(J,{onClick:async()=>{c(!0);try{const F=i._id||i.id,se={...i};se._id&&delete se._id,delete se.isDbPersona;let ne;if(F&&typeof F=="string"&&F.startsWith("local-")){console.log("Creating new persona instead of updating local ID"),ne=await zr.create(se),re.success("Persona saved to database");const ae={...i,id:ne.data._id||ne.data.id,_id:ne.data._id||ne.data.id,isDbPersona:!0};e(ae)}else if(F){ne=await zr.update(F,se),re.success("Persona updated successfully");const ae={...i,isDbPersona:!0};e(ae)}else{ne=await zr.create(se);const ae={...i,id:ne.data._id||ne.data.id,_id:ne.data._id||ne.data.id,isDbPersona:!0};re.success("Persona created successfully"),e(ae)}}catch(F){console.error("Error saving persona:",F),F.response&&F.response.status===401?h&&p?(console.log("Auth error despite having token - token likely invalid"),re.error("Authentication error - saving locally instead"),e(i)):(f(i),u(!0)):(re.error("Failed to save persona"),e(i))}finally{c(!1)}},disabled:s,children:[s?a.jsx(Ds,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(DE,{className:"h-4 w-4 mr-2"}),s?"Saving...":"Save Changes"]})]}),a.jsxs(dl,{defaultValue:"basic",children:[a.jsxs(Va,{className:"grid w-full grid-cols-6",children:[a.jsx(gn,{value:"basic",children:"Basic"}),a.jsx(gn,{value:"cooper",children:"Cooper"}),a.jsx(gn,{value:"personality",children:"Personality"}),a.jsx(gn,{value:"demographics",children:"Demographics"}),a.jsx(gn,{value:"lifestyle",children:"Lifestyle"}),a.jsx(gn,{value:"extended",children:"Extended"})]}),a.jsx(vn,{value:"basic",className:"mt-6",children:a.jsx(gt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Name"}),a.jsx(Ht,{value:i.name||"",onChange:F=>g("name",F.target.value)})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Age Range"}),a.jsxs(Un,{value:i.age||"",onValueChange:F=>g("age",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select age range"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"18-24",children:"18-24"}),a.jsx(oe,{value:"25-34",children:"25-34"}),a.jsx(oe,{value:"35-44",children:"35-44"}),a.jsx(oe,{value:"45-54",children:"45-54"}),a.jsx(oe,{value:"55-64",children:"55-64"}),a.jsx(oe,{value:"65+",children:"65+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Gender"}),a.jsxs(Un,{value:i.gender||"",onValueChange:F=>g("gender",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select gender"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Male",children:"Male"}),a.jsx(oe,{value:"Female",children:"Female"}),a.jsx(oe,{value:"Non-binary",children:"Non-binary"}),a.jsx(oe,{value:"Other",children:"Other"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Occupation"}),a.jsx(Ht,{value:i.occupation||"",onChange:F=>g("occupation",F.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Education"}),a.jsxs(Un,{value:i.education||"",onValueChange:F=>g("education",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select education level"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"High School",children:"High School"}),a.jsx(oe,{value:"Some College",children:"Some College"}),a.jsx(oe,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(oe,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(oe,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(oe,{value:"PhD",children:"PhD"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Location"}),a.jsx(Ht,{value:i.location||"",onChange:F=>g("location",F.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Ethnicity (Optional)"}),a.jsxs(Un,{value:i.ethnicity||"",onValueChange:F=>g("ethnicity",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select ethnicity"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"white",children:"White"}),a.jsx(oe,{value:"black",children:"Black"}),a.jsx(oe,{value:"asian",children:"Asian"}),a.jsx(oe,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(oe,{value:"native-american",children:"Native American"}),a.jsx(oe,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(oe,{value:"mixed",children:"Mixed"}),a.jsx(oe,{value:"other",children:"Other"}),a.jsx(oe,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Personality"}),a.jsx(mt,{value:i.personality||"",onChange:F=>g("personality",F.target.value),rows:3})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Interests"}),a.jsx(mt,{value:i.interests||"",onChange:F=>g("interests",F.target.value),rows:3,placeholder:"Tech, travel, cooking, etc."})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm",children:[i.techSavviness,"%"]})]}),a.jsx(br,{value:[i.techSavviness],onValueChange:F=>g("techSavviness",F[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm",children:[i.brandLoyalty||0,"%"]})]}),a.jsx(br,{value:[i.brandLoyalty||0],onValueChange:F=>g("brandLoyalty",F[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm",children:[i.priceConsciousness||0,"%"]})]}),a.jsx(br,{value:[i.priceConsciousness||0],onValueChange:F=>g("priceConsciousness",F[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm",children:[i.environmentalConcern||0,"%"]})]}),a.jsx(br,{value:[i.environmentalConcern||0],onValueChange:F=>g("environmentalConcern",F[0]),max:100,step:1})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Purchasing Power"}),a.jsx(ym,{checked:i.hasPurchasingPower||!1,onCheckedChange:F=>g("hasPurchasingPower",F)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Has Children"}),a.jsx(ym,{checked:i.hasChildren||!1,onCheckedChange:F=>g("hasChildren",F)})]})]})]})]})})})}),a.jsxs(vn,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Goals"}),(i.goals||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>b("goals",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x("goals",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y("goals"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Goal"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Frustrations"}),(i.frustrations||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>b("frustrations",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x("frustrations",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y("frustrations"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Frustration"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Motivations"}),(i.motivations||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>b("motivations",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x("motivations",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y("motivations"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Thinks"}),(((j=i.thinkFeelDo)==null?void 0:j.thinks)||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>w("thinks",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>C("thinks",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>S("thinks"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Thought"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Feels"}),(((P=i.thinkFeelDo)==null?void 0:P.feels)||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>w("feels",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>C("feels",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>S("feels"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Feeling"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Does"}),(((k=i.thinkFeelDo)==null?void 0:k.does)||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>w("does",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>C("does",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>S("does"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("div",{className:"space-y-4 mb-6",children:a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Scenario Section Title"}),a.jsx(Ht,{value:i.scenarioType||"",onChange:F=>g("scenarioType",F.target.value),placeholder:"Life Scenarios"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'})]})}),a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(i.scenarios||[]).map((F,se)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(mt,{value:F||"",onChange:ne=>b("scenarios",se,ne.target.value),rows:2}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x("scenarios",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y("scenarios"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})})]}),a.jsx(vn,{value:"personality",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Openness to Experience"}),a.jsxs("span",{className:"text-sm",children:[((O=i.oceanTraits)==null?void 0:O.openness)||50,"%"]})]}),a.jsx(br,{value:[((E=i.oceanTraits)==null?void 0:E.openness)||50],onValueChange:F=>m("openness",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Creativity, curiosity, and openness to new ideas"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Conscientiousness"}),a.jsxs("span",{className:"text-sm",children:[((I=i.oceanTraits)==null?void 0:I.conscientiousness)||50,"%"]})]}),a.jsx(br,{value:[((D=i.oceanTraits)==null?void 0:D.conscientiousness)||50],onValueChange:F=>m("conscientiousness",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization, responsibility, and self-discipline"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Extraversion"}),a.jsxs("span",{className:"text-sm",children:[((z=i.oceanTraits)==null?void 0:z.extraversion)||50,"%"]})]}),a.jsx(br,{value:[(($=i.oceanTraits)==null?void 0:$.extraversion)||50],onValueChange:F=>m("extraversion",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Sociability, assertiveness, and talkativeness"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Agreeableness"}),a.jsxs("span",{className:"text-sm",children:[((G=i.oceanTraits)==null?void 0:G.agreeableness)||50,"%"]})]}),a.jsx(br,{value:[((R=i.oceanTraits)==null?void 0:R.agreeableness)||50],onValueChange:F=>m("agreeableness",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Compassion, cooperation, and concern for others"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Neuroticism"}),a.jsxs("span",{className:"text-sm",children:[((L=i.oceanTraits)==null?void 0:L.neuroticism)||50,"%"]})]}),a.jsx(br,{value:[((W=i.oceanTraits)==null?void 0:W.neuroticism)||50],onValueChange:F=>m("neuroticism",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Emotional reactivity, anxiety, and sensitivity to stress"})]})]})]})})}),a.jsx(vn,{value:"demographics",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Demographic Information"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Social Grade"}),a.jsxs(Un,{value:i.socialGrade||"",onValueChange:F=>g("socialGrade",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select social grade"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"A",children:"A - Higher managerial"}),a.jsx(oe,{value:"B",children:"B - Intermediate managerial"}),a.jsx(oe,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(oe,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(oe,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(oe,{value:"E",children:"E - State pensioners, unemployed"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Household Income"}),a.jsxs(Un,{value:i.householdIncome||"",onValueChange:F=>g("householdIncome",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select income range"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Under $25k",children:"Under $25,000"}),a.jsx(oe,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(oe,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(oe,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(oe,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(oe,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(oe,{value:"Over $250k",children:"Over $250,000"}),a.jsx(oe,{value:"Prefer not to say",children:"Prefer not to say"})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Household Composition"}),a.jsxs(Un,{value:i.householdComposition||"",onValueChange:F=>g("householdComposition",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select household type"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Single person",children:"Single person"}),a.jsx(oe,{value:"Couple without children",children:"Couple without children"}),a.jsx(oe,{value:"Couple with children",children:"Couple with children"}),a.jsx(oe,{value:"Single parent",children:"Single parent"}),a.jsx(oe,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(oe,{value:"Shared housing",children:"Shared housing"}),a.jsx(oe,{value:"Other",children:"Other"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Living Situation"}),a.jsxs(Un,{value:i.livingSituation||"",onValueChange:F=>g("livingSituation",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select living situation"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Own home",children:"Own home"}),a.jsx(oe,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(oe,{value:"Rent house",children:"Rent house"}),a.jsx(oe,{value:"Live with family",children:"Live with family"}),a.jsx(oe,{value:"Student housing",children:"Student housing"}),a.jsx(oe,{value:"Assisted living",children:"Assisted living"}),a.jsx(oe,{value:"Other",children:"Other"})]})]})]})]})]})]})})}),a.jsx(vn,{value:"lifestyle",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Lifestyle & Behavior"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Media Consumption"}),a.jsx(mt,{value:i.mediaConsumption||"",onChange:F=>g("mediaConsumption",F.target.value),rows:3,placeholder:"TV shows, podcasts, news sources, social media platforms"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Describe media consumption habits and preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Device Usage"}),a.jsx(mt,{value:i.deviceUsage||"",onChange:F=>g("deviceUsage",F.target.value),rows:3,placeholder:"Smartphone, laptop, tablet, smart TV, gaming console"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Primary devices and usage patterns"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Shopping Habits"}),a.jsx(mt,{value:i.shoppingHabits||"",onChange:F=>g("shoppingHabits",F.target.value),rows:3,placeholder:"Online vs in-store, frequency, preferred retailers"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Shopping behavior and preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Brand Preferences"}),a.jsx(mt,{value:i.brandPreferences||"",onChange:F=>g("brandPreferences",F.target.value),rows:3,placeholder:"Favorite brands, brand values alignment"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred brands and reasoning"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Communication Preferences"}),a.jsx(mt,{value:i.communicationPreferences||"",onChange:F=>g("communicationPreferences",F.target.value),rows:3,placeholder:"Email, phone, text, video calls, in-person"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred communication methods and channels"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Payment Methods"}),a.jsx(mt,{value:i.paymentMethods||"",onChange:F=>g("paymentMethods",F.target.value),rows:3,placeholder:"Credit cards, digital wallets, cash, BNPL"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred payment methods and financial tools"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Purchase Behavior"}),a.jsx(mt,{value:i.purchaseBehaviour||"",onChange:F=>g("purchaseBehaviour",F.target.value),rows:3,placeholder:"Research habits, decision factors, impulse vs planned buying"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"How they approach making purchase decisions"})]})]})]})]})})}),a.jsxs(vn,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Extended Profile"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Core Values"}),a.jsx(mt,{value:i.coreValues||"",onChange:F=>g("coreValues",F.target.value),rows:3,placeholder:"Key principles and values that guide decisions"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Lifestyle Choices"}),a.jsx(mt,{value:i.lifestyleChoices||"",onChange:F=>g("lifestyleChoices",F.target.value),rows:3,placeholder:"Health, fitness, diet, work-life balance preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Social Activities"}),a.jsx(mt,{value:i.socialActivities||"",onChange:F=>g("socialActivities",F.target.value),rows:3,placeholder:"Social hobbies, community involvement, networking"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Category Knowledge"}),a.jsx(mt,{value:i.categoryKnowledge||"",onChange:F=>g("categoryKnowledge",F.target.value),rows:3,placeholder:"Expertise in specific product/service categories"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Decision Influences"}),a.jsx(mt,{value:i.decisionInfluences||"",onChange:F=>g("decisionInfluences",F.target.value),rows:3,placeholder:"What factors most influence their decisions"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Pain Points"}),a.jsx(mt,{value:i.painPoints||"",onChange:F=>g("painPoints",F.target.value),rows:3,placeholder:"Common challenges and friction points"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Journey Context"}),a.jsx(mt,{value:i.journeyContext||"",onChange:F=>g("journeyContext",F.target.value),rows:3,placeholder:"Current life stage and contextual factors"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Key Touchpoints"}),a.jsx(mt,{value:i.keyTouchpoints||"",onChange:F=>g("keyTouchpoints",F.target.value),rows:3,placeholder:"Important interaction points and channels"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Autonomy"}),a.jsx(mt,{value:((Y=i.selfDeterminationNeeds)==null?void 0:Y.autonomy)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,autonomy:F.target.value}),rows:2,placeholder:"Need for independence and self-direction"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Competence"}),a.jsx(mt,{value:((te=i.selfDeterminationNeeds)==null?void 0:te.competence)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,competence:F.target.value}),rows:2,placeholder:"Need to feel capable and effective"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Relatedness"}),a.jsx(mt,{value:((me=i.selfDeterminationNeeds)==null?void 0:me.relatedness)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,relatedness:F.target.value}),rows:2,placeholder:"Need for connection and belonging"})]})]})]})]})]})}),a.jsx(gt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Fears & Concerns"}),(i.fears||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F,onChange:ne=>b("fears",se,ne.target.value),placeholder:"Enter a fear or concern"}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x("fears",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y("fears"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Personal Narrative"}),a.jsx(mt,{value:i.narrative||"",onChange:F=>g("narrative",F.target.value),rows:4,placeholder:"Personal story, background, key life experiences"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"A brief narrative that captures their personal story"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Additional Information"}),a.jsx(mt,{value:i.additionalInformation||"",onChange:F=>g("additionalInformation",F.target.value),rows:4,placeholder:"Any other relevant details or context"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Additional context or details not covered elsewhere"})]})]})})})]})]})]})}function YLe(){const{id:t}=OE(),e=Fi(),n=ar(),{navigationState:r,clearNavigationState:i}=ow(),[o,s]=v.useState(void 0),[c,l]=v.useState(!1),[u,d]=v.useState(!1),[f,h]=v.useState(!0);return v.useEffect(()=>{if(!t){h(!1);return}let m=!0;const b=new URLSearchParams(e.search).get("fromReview")==="true";return l(b),h(!0),(async()=>{try{const w=t.startsWith("local-")?t.substring(6):t,S=await zr.getById(w);if(S&&S.data){const C=S.data;if(m){console.log("Found persona in database:",C),s({...C,id:C.id||C._id,isDbPersona:!0}),h(!1);return}}console.error("Could not find persona with id:",t),m&&(s(void 0),h(!1),re.error("Persona not found"))}catch(w){console.error("Error fetching persona:",w),m&&(s(void 0),h(!1),re.error("Failed to load persona details"))}})(),()=>{m=!1}},[t,e.search]),{currentPersona:o,isEditing:u,isFromReview:c,isLoading:f,setIsEditing:d,handleGoBack:()=>{r.previousRoute&&r.previousRoute.startsWith("/focus-groups/")&&r.focusGroupId?n(`/focus-groups/${r.focusGroupId}`):r.previousRoute==="/focus-groups"&&r.focusGroupTab?r.isNewFocusGroup?n(`/focus-groups?mode=create&tab=${r.focusGroupTab}`):r.focusGroupId?n(`/focus-groups?mode=edit&id=${r.focusGroupId}&tab=${r.focusGroupTab}`):n("/focus-groups?mode=create&tab=participants"):n(c?"/synthetic-users?mode=create&tab=ai&step=review":"/synthetic-users")},handleSaveEdit:async m=>{try{d(!1);const y=m.isDbPersona||t&&t.length===24&&/^[0-9a-f]{24}$/i.test(t),b={...m};if(b._id&&delete b._id,delete b.isDbPersona,y&&t&&t.length===24&&/^[0-9a-f]{24}$/i.test(t)){const x=await zr.update(t,b);console.log("Updated persona in database:",x);const w={...m,isDbPersona:!0};s(w),re.success("Persona updated in database successfully")}else{const x=await zr.create(b);console.log("Created new persona in database:",x.data);const w={...m,id:x.data._id||x.data.id,_id:x.data._id||x.data.id,isDbPersona:!0};s(w),re.success("Persona saved to database successfully")}}catch(y){return console.error("Error saving persona:",y),y.response&&y.response.status===401?re.error("Authentication error - Please log in to save personas"):y.response&&y.response.status===404?re.error("API endpoint not found - Database service may be unavailable"):re.error("Failed to save persona to database: "+(y.message||"Unknown error")),!1}return!0}}}function F$(){var f;const{currentPersona:t,isEditing:e,isFromReview:n,isLoading:r,setIsEditing:i,handleGoBack:o,handleSaveEdit:s}=YLe(),{navigationState:c}=ow(),[l,u]=v.useState("");v.useEffect(()=>{var h;c.focusGroupId&&((h=c.previousRoute)!=null&&h.startsWith("/focus-groups/"))&&(async()=>{var g;try{const m=await Ot.getById(c.focusGroupId);(g=m==null?void 0:m.data)!=null&&g.name&&u(m.data.name)}catch(m){console.error("Error fetching focus group name:",m)}})()},[c.focusGroupId,c.previousRoute]);const d=((f=c.previousRoute)==null?void 0:f.startsWith("/focus-groups/"))&&c.focusGroupId;return r?a.jsx(KLe,{}):t?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),a.jsx("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:e?a.jsx(qLe,{persona:t,onSave:s,onCancel:()=>i(!1)}):a.jsxs(a.Fragment,{children:[d&&a.jsx("div",{className:"mb-4",children:a.jsx(LW,{children:a.jsxs(FW,{children:[a.jsx(hy,{children:a.jsxs(mj,{href:"/focus-groups",className:"flex items-center",children:[a.jsx(Vy,{className:"h-4 w-4 mr-1"}),"Focus Groups"]})}),a.jsx(gj,{}),a.jsx(hy,{children:a.jsxs(mj,{href:`/focus-groups/${c.focusGroupId}`,className:"flex items-center",children:[a.jsx(Dr,{className:"h-4 w-4 mr-1"}),l||"Focus Group Session"]})}),a.jsx(gj,{}),a.jsx(hy,{children:a.jsxs(BW,{className:"flex items-center",children:[a.jsx(qp,{className:"h-4 w-4 mr-1"}),(t==null?void 0:t.name)||"Participant"]})})]})})}),a.jsxs("div",{className:"flex items-center mb-6 relative",children:[a.jsx(J,{variant:"ghost",onClick:o,className:"absolute left-0 top-0 flex items-center",children:a.jsx(Kp,{className:"h-5 w-5"})}),a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900 mx-auto",children:"Persona Profile"}),a.jsxs(J,{onClick:()=>i(!0),className:"absolute right-0 top-0",children:[a.jsx(dZ,{className:"h-4 w-4 mr-2"}),"Edit Persona"]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mt-10",children:[a.jsx("div",{className:"lg:col-span-1",children:a.jsx(ULe,{persona:t})}),a.jsx("div",{className:"lg:col-span-2",children:a.jsxs(dl,{defaultValue:"cooper-profile",children:[a.jsxs(Va,{className:"grid w-full grid-cols-3",children:[a.jsx(gn,{value:"cooper-profile",children:"Cooper Profile"}),a.jsx(gn,{value:"personality",children:"Personality"}),a.jsx(gn,{value:"scenarios",children:"Scenarios"})]}),a.jsx(vn,{value:"cooper-profile",className:"mt-6",children:a.jsx(HLe,{persona:t})}),a.jsx(vn,{value:"personality",className:"mt-6",children:a.jsx(zLe,{persona:t})}),a.jsx(vn,{value:"scenarios",className:"mt-6",children:a.jsx(GLe,{persona:t})})]})})]})]})})]}):a.jsx(VLe,{})}const QLe=Oe.object({username:Oe.string().min(3,"Username must be at least 3 characters"),password:Oe.string().min(4,"Password must be at least 4 characters")});function XLe(){var h;const t=ar(),e=Fi(),{login:n,loginWithMicrosoft:r,isAuthenticated:i,isMsalLoading:o}=Xs(),[s,c]=v.useState(!1),l=((h=e.state)==null?void 0:h.from)||"/";console.log("Login page - destination path:",l),v.useEffect(()=>{i&&(console.log("User already authenticated, redirecting from login page"),t("/",{replace:!0}))},[i,t]);const u=z0({resolver:G0(QLe),defaultValues:{username:"",password:""}});async function d(p){c(!0);try{await n(p.username,p.password)?(console.log("Login successful, received token, navigating to:",l),t(l,{replace:!0})):(console.error("Login succeeded but no token received"),c(!1))}catch(g){console.error("Login error in form handler:",g),c(!1)}}async function f(){try{await r(),console.log("Microsoft login successful, navigating to:",l),t(l,{replace:!0})}catch(p){console.error("Microsoft login error in form handler:",p)}}return a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gradient-to-br from-gray-100 to-gray-200 dark:from-gray-900 dark:to-gray-800 px-4",children:a.jsxs(gt,{className:"w-full max-w-md",children:[a.jsxs(ji,{className:"space-y-1",children:[a.jsx(Wi,{className:"text-2xl font-bold text-center",children:"Sign In"}),a.jsx(uN,{className:"text-center",children:"Enter your credentials to access your account"})]}),a.jsxs(Rt,{children:[a.jsx("div",{className:"mb-6",children:a.jsx(J,{type:"button",variant:"outline",className:"w-full bg-[#0078d4] hover:bg-[#106ebe] text-white border-[#0078d4] hover:border-[#106ebe]",onClick:f,disabled:s||o,children:o?a.jsxs(a.Fragment,{children:[a.jsx(Ds,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing in with Microsoft..."]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"mr-2 h-4 w-4",viewBox:"0 0 21 21",fill:"currentColor",children:[a.jsx("path",{d:"M10 0H0v10h10V0z"}),a.jsx("path",{d:"M21 0H11v10h10V0z"}),a.jsx("path",{d:"M10 11H0v10h10V11z"}),a.jsx("path",{d:"M21 11H11v10h10V11z"})]}),"Sign in with Microsoft"]})})}),a.jsxs("div",{className:"relative mb-6",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("div",{className:"w-full border-t border-gray-200"})}),a.jsx("div",{className:"relative flex justify-center text-sm",children:a.jsx("span",{className:"bg-white px-2 text-gray-500 dark:bg-gray-800 dark:text-gray-400",children:"Or continue with username"})})]}),a.jsx(K0,{...u,children:a.jsxs("form",{onSubmit:u.handleSubmit(d),className:"space-y-4",children:[a.jsx(vt,{control:u.control,name:"username",render:({field:p})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Username"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"Enter your username",...p,disabled:s,autoComplete:"username"})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:u.control,name:"password",render:({field:p})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Password"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"Enter your password",type:"password",...p,disabled:s,autoComplete:"current-password"})}),a.jsx(pt,{})]})}),a.jsx(J,{type:"submit",className:"w-full",disabled:s||o,children:s?"Signing in...":"Sign In"})]})})]}),a.jsxs(dN,{className:"flex flex-col space-y-2",children:[a.jsx("div",{className:"text-sm text-center text-gray-500 mb-2",children:"Default account: user / pass"}),!s&&!o&&a.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[a.jsx(J,{variant:"outline",onClick:()=>t("/",{replace:!0}),className:"mt-2",children:"Return to Home"}),a.jsx(J,{variant:"link",onClick:()=>{localStorage.setItem("offline_mode","true");const p={username:"guest",email:"guest@example.com",role:"user"};localStorage.setItem("auth_token","offline-mode-token"),localStorage.setItem("user",JSON.stringify(p)),qe.success("Offline mode activated",{description:"Using demo account with limited functionality"}),t("/",{replace:!0})},className:"text-sm text-gray-500",children:"Use offline mode"})]})]})]})})}function Ku({children:t}){const{isAuthenticated:e,isLoading:n}=Xs(),r=Fi();return console.log("ProtectedRoute check:",{isAuthenticated:e,isLoading:n,path:r.pathname}),n?a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary"})}):e?(console.log("User is authenticated, showing protected content"),a.jsx(a.Fragment,{children:t})):(console.log("Not authenticated, redirecting to login"),a.jsx(c5,{to:"/login",state:{from:r.pathname},replace:!0}))}const JLe=v.createContext({});let B$=!1;function ZLe({children:t}){const{token:e}=Xs(),n=()=>{const i=e||localStorage.getItem("auth_token");return console.log("šŸ”§ [GPT-5 Context] Getting token:",i?"Found":"Missing"),i||""};v.useEffect(()=>(B$||(console.log("šŸ”§ [GPT-5 Context] Initializing singleton socket"),DW(n),B$=!0),console.log("šŸ”§ [GPT-5 Context] Connecting socket"),$W(),()=>{}),[e]);const r={};return a.jsx(JLe.Provider,{value:r,children:t})}const UW=new YT(Yie);UW.initialize().catch(t=>{console.error("MSAL initialization error:",t)});function eFe({children:t}){return a.jsx(Wie,{instance:UW,children:t})}const tFe=new $X,nFe=()=>a.jsx(FX,{client:tFe,children:a.jsx(MJ,{basename:"/semblance",children:a.jsx(eFe,{children:a.jsx(Xie,{children:a.jsx(ZLe,{children:a.jsx(rde,{children:a.jsxs(pX,{children:[a.jsx(H9,{}),a.jsxs(EJ,{children:[a.jsx(Mo,{path:"/",element:a.jsx(Zie,{})}),a.jsx(Mo,{path:"/login",element:a.jsx(XLe,{})}),a.jsx(Mo,{path:"/synthetic-users",element:a.jsx(Ku,{children:a.jsx(nde,{})})}),a.jsx(Mo,{path:"/synthetic-users/:id",element:a.jsx(Ku,{children:a.jsx(F$,{})})}),a.jsx(Mo,{path:"/personas/:id",element:a.jsx(Ku,{children:a.jsx(F$,{})})}),a.jsx(Mo,{path:"/focus-groups",element:a.jsx(Ku,{children:a.jsx(lde,{})})}),a.jsx(Mo,{path:"/focus-groups/:id",element:a.jsx(Ku,{children:a.jsx(PLe,{})})}),a.jsx(Mo,{path:"/dashboard",element:a.jsx(Ku,{children:a.jsx(BLe,{})})}),a.jsx(Mo,{path:"/old-path",element:a.jsx(c5,{to:"/",replace:!0})}),a.jsx(Mo,{path:"*",element:a.jsx(eoe,{})})]})]})})})})})})});l4(document.getElementById("root")).render(a.jsx(nFe,{})); diff --git a/dist/index.html b/dist/index.html index 318a60db..b34dc4c1 100644 --- a/dist/index.html +++ b/dist/index.html @@ -7,8 +7,8 @@ - - + + diff --git a/src/components/AssetUploader.tsx b/src/components/AssetUploader.tsx index 2378d97e..1ad48918 100644 --- a/src/components/AssetUploader.tsx +++ b/src/components/AssetUploader.tsx @@ -1,19 +1,37 @@ - -import { useState } from 'react'; -import { Upload, UploadCloud, X, FileText, Image as ImageIcon, FileVideo } from 'lucide-react'; +import { useState, useEffect } from 'react'; +import { Upload, UploadCloud, X, FileText, Image as ImageIcon, FileVideo, Loader2, RefreshCw, Edit3, Check } from 'lucide-react'; import { toast } from 'sonner'; import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; +import { Input } from "@/components/ui/input"; +import { focusGroupsApi } from '@/lib/api'; -interface Asset { +// Backend asset interface (matches what we get from the API) +interface BackendAsset { + filename: string; + original_name: string; + mime_type: string; + size: number; + user_assigned_name?: string; + upload_date: string; +} + +// Local asset state for managing uploads +interface LocalAsset { id: string; file: File; previewUrl?: string; - type: string; + status: 'uploading' | 'uploaded' | 'failed' | 'retry'; + backendAsset?: BackendAsset; + error?: string; } interface AssetUploaderProps { - onAssetsChange?: (assets: Asset[]) => void; + onAssetsChange?: (assets: BackendAsset[]) => void; + onUploadComplete?: (assets: BackendAsset[]) => void; + onUploadError?: (error: unknown) => void; + focusGroupId?: string; + disabled?: boolean; maxAssets?: number; allowedTypes?: string[]; label?: string; @@ -22,144 +40,473 @@ interface AssetUploaderProps { export default function AssetUploader({ onAssetsChange, + onUploadComplete, + onUploadError, + focusGroupId, + disabled = false, maxAssets = 10, allowedTypes = ['image/*', 'application/pdf', 'video/*'], label = 'Upload Assets', description = 'Upload creative assets for testing' }: AssetUploaderProps) { - const [assets, setAssets] = useState([]); + const [localAssets, setLocalAssets] = useState([]); + const [backendAssets, setBackendAssets] = useState([]); + const [editingAsset, setEditingAsset] = useState(null); + const [editingName, setEditingName] = useState(''); - const handleFileUpload = (files: FileList | null) => { - if (!files || files.length === 0) return; + // Fetch existing backend assets when focusGroupId changes + useEffect(() => { + if (focusGroupId) { + fetchBackendAssets(); + } + }, [focusGroupId]); // fetchBackendAssets is stable and doesn't need to be in deps + + const fetchBackendAssets = async () => { + if (!focusGroupId) return; + + try { + const response = await focusGroupsApi.getAssets(focusGroupId); + const assets = response.data.assets || []; + setBackendAssets(assets); + + if (onAssetsChange) { + onAssetsChange(assets); + } + } catch (error) { + console.error("Error fetching backend assets:", error); + // Don't show error toast for initial fetch failures + } + }; + + const handleFileUpload = async (files: FileList | null) => { + if (!files || files.length === 0 || !focusGroupId) return; // Check if adding these files would exceed the limit - if (assets.length + files.length > maxAssets) { + const totalAssets = localAssets.length + backendAssets.length; + if (totalAssets + files.length > maxAssets) { toast.error(`You can only upload up to ${maxAssets} assets`); return; } - // Convert FileList to array and create asset objects - const newAssets: Asset[] = Array.from(files).map(file => { - // Generate a preview URL for images + // Create local asset objects for immediate UI feedback + const newLocalAssets: LocalAsset[] = Array.from(files).map(file => { const previewUrl = file.type.startsWith('image/') ? URL.createObjectURL(file) : undefined; return { - id: `asset-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, + id: `local-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, file, previewUrl, - type: file.type, + status: 'uploading' }; }); - const updatedAssets = [...assets, ...newAssets]; - setAssets(updatedAssets); + // Add to local state for immediate UI feedback + setLocalAssets(prev => [...prev, ...newLocalAssets]); - // Notify parent component about the change - if (onAssetsChange) { - onAssetsChange(updatedAssets); + // Upload each file to backend + for (const localAsset of newLocalAssets) { + try { + const formData = new FormData(); + formData.append('assets', localAsset.file); + + const uploadResponse = await focusGroupsApi.uploadAssets(focusGroupId, formData, false); + const uploadResult = uploadResponse.data; + + if (uploadResult.uploaded_assets > 0) { + // Update local asset status + setLocalAssets(prev => prev.map(asset => + asset.id === localAsset.id + ? { ...asset, status: 'uploaded' } + : asset + )); + + // Fetch updated backend assets + await fetchBackendAssets(); + + toast.success(`${localAsset.file.name} uploaded successfully`); + } else { + throw new Error('Upload failed'); + } + } catch (error: unknown) { + console.error(`Upload failed for ${localAsset.file.name}:`, error); + + // Update local asset status to failed + setLocalAssets(prev => prev.map(asset => + asset.id === localAsset.id + ? { + ...asset, + status: 'failed', + error: (error as { response?: { data?: { error?: string } } }).response?.data?.error || 'Upload failed' + } + : asset + )); + + if (onUploadError) { + onUploadError(error); + } + } } - toast.success(`${newAssets.length} asset(s) uploaded`, { - description: "Assets added to your project", - }); + // Trigger upload complete callback + if (onUploadComplete) { + // Wait a bit for fetchBackendAssets to complete + setTimeout(() => { + onUploadComplete(backendAssets); + }, 500); + } }; - const handleRemoveAsset = (assetId: string) => { - const assetToRemove = assets.find(asset => asset.id === assetId); + const handleRemoveAsset = async (filename: string) => { + if (!focusGroupId) return; + + try { + await focusGroupsApi.deleteAsset(focusGroupId, filename); + await fetchBackendAssets(); + toast.info('Asset removed'); + } catch (error) { + console.error("Error removing asset:", error); + toast.error("Failed to remove asset"); + } + }; + + const handleRemoveLocalAsset = (assetId: string) => { + const assetToRemove = localAssets.find(asset => asset.id === assetId); if (assetToRemove?.previewUrl) { URL.revokeObjectURL(assetToRemove.previewUrl); } - const updatedAssets = assets.filter(asset => asset.id !== assetId); - setAssets(updatedAssets); + setLocalAssets(prev => prev.filter(asset => asset.id !== assetId)); + }; + + const handleRetryUpload = async (localAsset: LocalAsset) => { + if (!focusGroupId) return; - // Notify parent component about the change - if (onAssetsChange) { - onAssetsChange(updatedAssets); + // Update status to uploading + setLocalAssets(prev => prev.map(asset => + asset.id === localAsset.id + ? { ...asset, status: 'uploading', error: undefined } + : asset + )); + + try { + const formData = new FormData(); + formData.append('assets', localAsset.file); + + const uploadResponse = await focusGroupsApi.uploadAssets(focusGroupId, formData, false); + const uploadResult = uploadResponse.data; + + if (uploadResult.uploaded_assets > 0) { + setLocalAssets(prev => prev.map(asset => + asset.id === localAsset.id + ? { ...asset, status: 'uploaded' } + : asset + )); + + await fetchBackendAssets(); + toast.success(`${localAsset.file.name} uploaded successfully`); + } else { + throw new Error('Upload failed'); + } + } catch (error: unknown) { + setLocalAssets(prev => prev.map(asset => + asset.id === localAsset.id + ? { + ...asset, + status: 'failed', + error: (error as { response?: { data?: { error?: string } } }).response?.data?.error || 'Upload failed' + } + : asset + )); + toast.error(`Failed to upload ${localAsset.file.name}`); + } + }; + + const startEditingAssetName = (asset: BackendAsset) => { + setEditingAsset(asset.filename); + setEditingName(asset.user_assigned_name || ''); + }; + + const saveAssetName = async (filename: string) => { + if (!focusGroupId || !editingName.trim()) { + cancelEditingAssetName(); + return; } - toast.info('Asset removed'); + try { + await focusGroupsApi.updateAssetName(focusGroupId, filename, editingName.trim()); + + // Update local state + setBackendAssets(prev => prev.map(asset => + asset.filename === filename + ? { ...asset, user_assigned_name: editingName.trim() } + : asset + )); + + if (onAssetsChange) { + onAssetsChange(backendAssets); + } + + setEditingAsset(null); + setEditingName(''); + toast.success("Asset name updated"); + } catch (error) { + console.error("Error updating asset name:", error); + toast.error("Failed to update asset name"); + } + }; + + const cancelEditingAssetName = () => { + setEditingAsset(null); + setEditingName(''); }; // Determine the icon to use based on file type - const getAssetIcon = (type: string) => { - if (type.startsWith('image/')) { - return ; - } else if (type.startsWith('video/')) { - return ; - } else if (type === 'application/pdf') { - return ; + const getAssetIcon = (mimeType: string) => { + if (mimeType.startsWith('image/')) { + return ; + } else if (mimeType.startsWith('video/')) { + return ; + } else if (mimeType === 'application/pdf') { + return ; } else { - return ; + return ; } }; + const getDisplayName = (asset: BackendAsset, index: number) => { + return asset.user_assigned_name || `Asset ${index + 1}`; + }; + + const totalAssets = localAssets.length + backendAssets.length; + const remainingSlots = maxAssets - totalAssets; + return (
{/* Upload area */} -
- -

{label}

-

{description}

- handleFileUpload(e.target.files)} - className="hidden" - id="asset-uploader-input" - /> - -

- {maxAssets - assets.length} of {maxAssets} uploads remaining -

+
+ {disabled ? ( + <> + +

Asset Upload Disabled

+

Complete focus group details above to enable asset uploads

+ + ) : ( + <> + +

{label}

+

{description}

+ handleFileUpload(e.target.files)} + className="hidden" + id="asset-uploader-input" + disabled={disabled} + /> + +

+ {remainingSlots} of {maxAssets} uploads remaining +

+ + )}
{/* Assets preview */} - {assets.length > 0 && ( + {(backendAssets.length > 0 || localAssets.length > 0) && ( -

Uploaded Assets ({assets.length})

-
- {assets.map((asset) => ( -
- +

+ Uploaded Assets ({backendAssets.length + localAssets.filter(a => a.status === 'uploaded').length}) +

+ +
+ {/* Backend assets (successfully uploaded) */} + {backendAssets.map((asset, index) => ( +
+ {/* Asset preview */} +
+ {asset.mime_type?.startsWith('image/') ? ( + {getDisplayName(asset, + ) : ( + getAssetIcon(asset.mime_type) + )} +
-
+ {/* Asset info and naming */} +
+ {editingAsset === asset.filename ? ( +
+ setEditingName(e.target.value)} + placeholder={`Asset ${index + 1}`} + className="flex-1" + autoFocus + onKeyDown={(e) => { + if (e.key === 'Enter') { + e.preventDefault(); // Prevent form submission + saveAssetName(asset.filename); + } else if (e.key === 'Escape') { + cancelEditingAssetName(); + } + }} + /> + + +
+ ) : ( +
+
+

+ {getDisplayName(asset, index)} +

+ +
+

+ Original: {asset.original_name} +

+
+ )} +
+ + {/* Actions and status */} +
+
+
Will appear as:
+
+ "{getDisplayName(asset, index)}" +
+
+ +
+
+ ))} + + {/* Local assets (uploading/failed) */} + {localAssets.map((asset) => ( +
+ {/* Asset preview */} +
{asset.previewUrl ? ( {asset.file.name} ) : ( - getAssetIcon(asset.type) + getAssetIcon(asset.file.type) )}
-

{asset.file.name}

-

- {(asset.file.size / 1024).toFixed(1)} KB -

+ + {/* Asset info */} +
+

{asset.file.name}

+

+ {(asset.file.size / 1024).toFixed(1)} KB +

+ {asset.error && ( +

{asset.error}

+ )} +
+ + {/* Status and actions */} +
+ {asset.status === 'uploading' && ( +
+ + Uploading... +
+ )} + {asset.status === 'failed' && ( +
+ +
+ )} + +
))}
+ + {/* Help text */} + {backendAssets.length > 0 && ( +
+

+ Asset Names: Click the edit icon to customize how assets will be referenced + in the discussion guide. Leave blank to use default numbering. +

+
+ )} )}
); -} +} \ No newline at end of file diff --git a/src/components/ChatMessage.tsx b/src/components/ChatMessage.tsx index 94721f26..027140e9 100644 --- a/src/components/ChatMessage.tsx +++ b/src/components/ChatMessage.tsx @@ -1,5 +1,5 @@ -import { useState } from 'react'; +import { useState, useEffect } from 'react'; import { MessageSquare, UserCircle, Bot, Star, User, Image as ImageIcon } from 'lucide-react'; import { cn } from '@/lib/utils'; import { Persona } from '@/types/persona'; @@ -8,15 +8,7 @@ import { Badge } from '@/components/ui/badge'; import { getPersonaAvatarSrc } from '@/utils/avatarUtils'; import { parseMentions, formatMentionsForDisplay } from '@/utils/mentionUtils'; import { focusGroupsApi } from '@/lib/api'; - -interface Message { - id: string; - senderId: string; // 'moderator' = AI Moderator, 'facilitator' = Human Facilitator, or participant ID - text: string; - timestamp: Date; - type: 'question' | 'response' | 'system' | 'highlight'; - highlighted?: boolean; -} +import { Message } from '@/components/focus-group-session/types'; interface ChatMessageProps { message: Message; @@ -36,31 +28,47 @@ const ChatMessage = ({ message, persona, toggleHighlight, participants = [], foc const parsedMentions = parseMentions(message.text, participants); const formattedText = formatMentionsForDisplay(message.text, parsedMentions.mentions); - // Extract creative asset filename from message text if this is a creative review - const extractAssetFilename = (text: string): string | null => { - // Look for patterns like "asset: filename.jpg" or similar - const patterns = [ - // Match quoted filenames (most specific pattern first) + // Check for visual asset using metadata (new system) or fallback to legacy parsing + const hasCreativeAsset = (isModerator || isFacilitator) && + (message.visualAsset || extractLegacyAssetFilename(message.text)) && + focusGroupId; + + // Get asset info from metadata or fallback to legacy extraction + const getAssetInfo = () => { + if (message.visualAsset) { + // New metadata-driven approach + return { + filename: message.visualAsset.filename, + displayReference: message.visualAsset.displayReference + }; + } else { + // Legacy fallback for existing messages + const legacyFilename = extractLegacyAssetFilename(message.text); + return legacyFilename ? { + filename: legacyFilename, + displayReference: legacyFilename + } : null; + } + }; + + const assetInfo = getAssetInfo(); + + // Legacy filename extraction for backward compatibility + function extractLegacyAssetFilename(text: string): string | null { + const filenamePatterns = [ /titled\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i, // "titled 'filename.jpg'" - /asset\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i, // "asset 'filename.jpg'" - /image\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i, // "image 'filename.jpg'" - /['"]([a-zA-Z0-9_\-]+\.(jpg|jpeg|png))['\"]/i, // Any quoted filename - // Match focus group asset pattern without quotes + /asset\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i, // "asset 'filename.jpg'" /(fg-[a-f0-9]+-[a-f0-9]{32}\.(jpg|jpeg|png))/i, // fg-{id}-{uuid}.{ext} ]; - for (const pattern of patterns) { + for (const pattern of filenamePatterns) { const match = text.match(pattern); if (match) { return match[1]; } } - return null; - }; - - const assetFilename = extractAssetFilename(message.text); - const hasCreativeAsset = (isModerator || isFacilitator) && assetFilename && focusGroupId; + } const handleToggleHighlight = () => { toggleHighlight(); @@ -120,27 +128,38 @@ const ChatMessage = ({ message, persona, toggleHighlight, participants = [], foc
-

{formattedText}

+

+ {!message.text || message.text.trim() === '' || message.text === '...' ? ( + + [No response content - AI generation may have failed] + + ) : ( + formattedText + )} +

- {/* Display creative asset if this is a moderator message with an asset */} - {hasCreativeAsset && ( + {/* Display creative asset if this is a moderator/facilitator message with an asset */} + {hasCreativeAsset && assetInfo && (
Creative Asset + {assetInfo.displayReference !== assetInfo.filename && ( + ({assetInfo.displayReference}) + )}
Creative asset for review { - console.error('Failed to load creative asset:', focusGroupsApi.getAssetUrl(focusGroupId!, assetFilename!)); + console.error('Failed to load creative asset:', focusGroupsApi.getAssetUrl(focusGroupId!, assetInfo.filename)); e.currentTarget.style.display = 'none'; // Show placeholder on error const placeholder = document.createElement('div'); placeholder.className = 'text-xs text-slate-500 italic p-2 border rounded bg-slate-100'; - placeholder.textContent = `Creative asset not found: ${assetFilename}`; + placeholder.textContent = `Creative asset not found: ${assetInfo.displayReference}`; e.currentTarget.parentNode?.appendChild(placeholder); }} /> diff --git a/src/components/FocusGroupModerator.tsx b/src/components/FocusGroupModerator.tsx index 5ce792f8..a39c1e90 100644 --- a/src/components/FocusGroupModerator.tsx +++ b/src/components/FocusGroupModerator.tsx @@ -23,12 +23,14 @@ import { Plus, Check, X, - Download + Download, + Info } from 'lucide-react'; import { toast } from 'sonner'; import { personasApi, focusGroupsApi, foldersApi } from '@/lib/api'; import GenerationProgressBar from '@/components/ui/GenerationProgressBar'; import DiscussionGuideViewer from './focus-group-session/DiscussionGuideViewer'; +import AssetUploader from '@/components/AssetUploader'; import { Button } from "@/components/ui/button"; import { @@ -111,7 +113,6 @@ const formSchema = z.object({ discussionTopics: z.string().min(10, { message: "Discussion topics are required.", }), - creativeAssets: z.instanceof(FileList).optional(), duration: z.string().min(1, { message: "Duration is required.", }), @@ -164,7 +165,8 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved, preSele return guide && typeof guide === 'object' && guide.title && guide.sections; }; const [selectedParticipants, setSelectedParticipants] = useState([]); - const [uploadedAssets, setUploadedAssets] = useState([]); + const [backendAssets, setBackendAssets] = useState([]); + const [isLoadingAssets, setIsLoadingAssets] = useState(false); const [personas, setPersonas] = useState([]); const [isLoadingPersonas, setIsLoadingPersonas] = useState(false); @@ -538,7 +540,7 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved, preSele participants_count: selectedParticipants.length, status: 'draft', date: new Date().toISOString(), - uploadedAssets: uploadedAssets.map(file => file.name) + uploadedAssets: backendAssets.map(a => a.filename || a.original_name || 'unknown') }; if (lastSavedData && JSON.stringify(currentData) === JSON.stringify(lastSavedData)) { @@ -602,13 +604,45 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved, preSele }, 2000); }; + // Function to fetch backend assets + const fetchBackendAssets = async (focusGroupId: string) => { + try { + setIsLoadingAssets(true); + const response = await focusGroupsApi.getAssets(focusGroupId); + setBackendAssets(response.data.assets || []); + } catch (error) { + console.error("Error fetching backend assets:", error); + toast.error("Failed to load asset information"); + } finally { + setIsLoadingAssets(false); + } + }; + + // Function to update asset name + const updateAssetName = async (focusGroupId: string, filename: string, newName: string) => { + try { + await focusGroupsApi.updateAssetName(focusGroupId, filename, newName); + + // Update local state + setBackendAssets(prev => prev.map(asset => + asset.filename === filename + ? { ...asset, user_assigned_name: newName } + : asset + )); + + toast.success("Asset name updated"); + } catch (error) { + console.error("Error updating asset name:", error); + toast.error("Failed to update asset name"); + } + }; + // Watch for form field changes to trigger auto-save const watchedFields = form.watch(); // Use refs to track previous values to prevent unnecessary saves const prevWatchedFieldsRef = useRef(''); const prevSelectedParticipantsRef = useRef(''); - const prevUploadedAssetsRef = useRef(''); // Effect to handle form field changes and trigger auto-save useEffect(() => { @@ -628,14 +662,7 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved, preSele } }, [selectedParticipants, activeTab]); - // Effect to handle uploaded assets changes - useEffect(() => { - const currentAssets = JSON.stringify(uploadedAssets.map(f => f.name)); - if (activeTab === 'setup' && currentAssets !== prevUploadedAssetsRef.current) { - prevUploadedAssetsRef.current = currentAssets; - triggerAutoSave(); - } - }, [uploadedAssets, activeTab]); + // Asset uploads are now handled immediately via AssetUploader component // Effect to clear timers when leaving setup tab or component unmounts useEffect(() => { @@ -674,6 +701,11 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved, preSele setDraftFocusGroupId(draftId); console.log("Setting draft ID from draftToEdit:", draftId); + // Load backend assets for this focus group + if (draftId) { + fetchBackendAssets(draftId); + } + // Load form data if available if (draftToEdit.name) { form.setValue('focusGroupName', draftToEdit.name); @@ -725,7 +757,7 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved, preSele participants_count: (draftToEdit.participants || []).length, status: 'draft', date: draftToEdit.date || new Date().toISOString(), - uploadedAssets: [] + uploadedAssets: backendAssets.map(a => a.filename || a.original_name || 'unknown') }; setLastSavedData(currentDraftData); console.log("Set lastSavedData to current draft:", currentDraftData); @@ -874,7 +906,7 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved, preSele async function onSubmit(values: z.infer) { try { - // First, save focus group to database to get an ID for asset uploads + // Use existing focus group ID or create new draft for discussion guide generation let focusGroupId = draftFocusGroupId; if (!focusGroupId) { @@ -896,56 +928,11 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved, preSele const savedDraft = await focusGroupsApi.create(draftData); focusGroupId = savedDraft.data.focus_group_id || savedDraft.data.id || savedDraft.data._id; setDraftFocusGroupId(focusGroupId); - console.log("Draft focus group created for asset upload:", savedDraft, "with ID:", focusGroupId); + console.log("Draft focus group created for discussion guide generation:", savedDraft, "with ID:", focusGroupId); } - // Handle creative assets upload if any - if (values.creativeAssets && values.creativeAssets.length > 0 && focusGroupId) { - try { - const formData = new FormData(); - Array.from(values.creativeAssets).forEach(file => { - formData.append('assets', file); - }); - - const uploadResponse = await focusGroupsApi.uploadAssets(focusGroupId, formData, true); - const uploadResult = uploadResponse.data; - console.log("Assets uploaded successfully:", uploadResult); - - toast.success(`${uploadResult.uploaded_assets} asset(s) uploaded successfully`, { - description: "Assets will be included in the discussion guide", - }); - - // Store uploaded asset info for display - const assets = Array.from(values.creativeAssets); - setUploadedAssets(assets); - - } catch (uploadError: any) { - console.error("Asset upload failed:", uploadError); - - // Handle specific error codes from backend - const errorData = uploadError.response?.data; - let errorTitle = "Asset upload failed"; - let errorDescription = "Some assets could not be uploaded"; - - if (errorData?.code === 'TEMP_DIR_ERROR') { - errorTitle = "Upload temporarily unavailable"; - errorDescription = "Server storage issue. Please try again in a moment."; - } else if (errorData?.code === 'UPLOAD_SYSTEM_FAILURE') { - errorTitle = "Upload system unavailable"; - errorDescription = "Critical server issue. Please contact support."; - } else if (errorData?.can_retry) { - errorTitle = "Upload failed - can retry"; - errorDescription = errorData?.details || "Please try uploading again."; - } - - toast.error(errorTitle, { - description: errorDescription, - }); - - // Continue with discussion guide generation even if upload fails - console.log("Continuing without assets due to upload failure"); - } - } + // Assets are now uploaded immediately via AssetUploader component + // No need to handle asset uploads here // Update focus group with current form values before generating guide // This ensures the backend uses the latest model selection @@ -1144,16 +1131,8 @@ true; }; - const handleAssetUpload = (files: FileList | null) => { - if (files && files.length > 0) { - const newAssets = Array.from(files); - setUploadedAssets(prev => [...prev, ...newAssets]); - - toast.success(`${newAssets.length} asset(s) uploaded`, { - description: "Assets will be included in the focus group", - }); - } - }; + // Asset upload is now handled by AssetUploader component + // This function is no longer needed // Function to save the focus group to the database const saveFocusGroup = async () => { @@ -1546,51 +1525,34 @@ Controls how much time GPT-5 spends thinking before responding
- ( - - Creative Assets (Optional) - -
- -

Upload creative assets for testing

-

Images, mockups, or product designs

- { - onChange(e.target.files); - }} - className="hidden" - id="assets-file-input" - /> - - {value && value.length > 0 && ( -

- {value.length} file(s) selected -

- )} -
-
- - Upload visuals that you want feedback on during the session - - -
- )} - /> + {/* Asset Uploader */} +
+ + { + setBackendAssets(assets); + // Trigger auto-save to update focus group metadata + }} + onUploadError={(error) => { + console.error('Asset upload error:', error); + // Error handling is already done in AssetUploader component + }} + onAssetsChange={(assets) => { + setBackendAssets(assets); + }} + maxAssets={10} + allowedTypes={['image/*', 'application/pdf', 'video/*']} + label="Upload Creative Assets" + description="Upload images, mockups, or product designs for testing" + /> +

+ Upload visuals that you want feedback on during the session +

+
@@ -1655,30 +1617,50 @@ Controls how much time GPT-5 spends thinking before responding - {uploadedAssets.length > 0 && ( + {backendAssets.length > 0 && ( -

Uploaded Creative Assets

+

Creative Assets

-
- {uploadedAssets.map((asset, index) => ( -
-
- {asset.type.startsWith('image/') ? ( - {`Asset - ) : ( - - )} -
-

{asset.name}

-
- ))} +
+

+ Assets that will be referenced in the discussion guide: +

+ +
+ {backendAssets.map((asset, index) => { + const displayName = asset.user_assigned_name || `Asset ${index + 1}`; + return ( +
+ {/* Asset preview */} +
+ {asset.mime_type?.startsWith('image/') ? ( + {displayName} + ) : ( + + )} +
+ + {/* Asset name */} +
+

"{displayName}"

+

Will appear in discussion guide

+
+
+ ); + })} +
+ +
+

+ Note: To rename assets, go back to the Setup tab and click the edit icon next to each asset. +

+
- )} diff --git a/src/components/focus-group-session/DiscussionGuideViewer.tsx b/src/components/focus-group-session/DiscussionGuideViewer.tsx index 7310033c..d4e07bae 100644 --- a/src/components/focus-group-session/DiscussionGuideViewer.tsx +++ b/src/components/focus-group-session/DiscussionGuideViewer.tsx @@ -85,7 +85,7 @@ interface DiscussionGuideViewerProps { discussionGuide: StructuredDiscussionGuide | string; moderatorStatus?: ModeratorStatus; onSectionSelect?: (sectionId: string, itemId?: string) => void; - onSetPosition?: (sectionId: string, itemId: string, content: string, sectionTitle: string, itemTitle?: string, itemType?: string) => void; + onSetPosition?: (sectionId: string, itemId: string, content: string, sectionTitle: string, itemTitle?: string, itemType?: string, metadata?: Record) => void; onSave?: (updatedGuide: StructuredDiscussionGuide) => Promise; showProgress?: boolean; collapsible?: boolean; @@ -548,14 +548,12 @@ const DiscussionGuideViewer: React.FC = React.memo(( const isCurrent = status === 'current'; const isCompleted = status === 'completed'; - // Extract image filename from content if it contains an image reference - const extractImageFilename = (content: string): string | null => { - // Look for patterns like 'fg-[id]-[hash].[ext]' in single or double quotes - const match = content.match(/['"`]([^'"`]*fg-[^'"`]*\.(jpe?g|png|gif|webp))['"`]/i); - return match ? match[1] : null; + // Get visual asset filename from metadata instead of extracting from content + const getVisualAssetFilename = (item: DiscussionGuideItem): string | null => { + return item.metadata?.visual_asset?.filename || null; }; - const imageFilename = extractImageFilename(item.content); + const imageFilename = getVisualAssetFilename(item); // Check if this is a default placeholder item const isPlaceholder = isDefaultPlaceholderContent(item.content, itemType); @@ -766,7 +764,7 @@ const DiscussionGuideViewer: React.FC = React.memo(( e.stopPropagation(); const section = structuredGuide!.sections[sectionIndex]; const itemTitle = itemType === 'activity' ? `Activity ${itemIndex + 1}` : `Question ${itemIndex + 1}`; - onSetPosition(section.id, item.id, item.content, section.title, itemTitle, itemType); + onSetPosition(section.id, item.id, item.content, section.title, itemTitle, itemType, item.metadata); }} className="h-6 px-2 ml-auto" > diff --git a/src/components/focus-group-session/DiscussionPanel.tsx b/src/components/focus-group-session/DiscussionPanel.tsx index 29eee4ca..aba0f4c4 100644 --- a/src/components/focus-group-session/DiscussionPanel.tsx +++ b/src/components/focus-group-session/DiscussionPanel.tsx @@ -9,20 +9,11 @@ import { parseMentions, type ParsedMentions } from '@/utils/mentionUtils'; import ChatMessage from '@/components/ChatMessage'; import ReasoningPanel from './ReasoningPanel'; import { Persona } from '@/types/persona'; -import { ModeEvent } from './types'; +import { ModeEvent, Message } from './types'; import { focusGroupsApi, focusGroupAiApi } from '@/lib/api'; import { toast } from 'sonner'; import ModeSwitchMarker from './ModeSwitchMarker'; -interface Message { - id: string; - senderId: string; // 'moderator' = AI Moderator, 'facilitator' = Human Facilitator, or participant ID - text: string; - timestamp: Date; - type: 'question' | 'response' | 'system' | 'highlight'; - highlighted?: boolean; -} - interface DiscussionPanelProps { messages: Message[]; modeEvents: ModeEvent[]; @@ -274,6 +265,7 @@ const DiscussionPanel = ({ let finalMessageText = userInput; let uploadedFilename: string | null = null; + let uploadedAssetMetadata: { filename: string; displayReference: string } | null = null; // Store current mentions for response generation const mentionsToProcess = currentMentions; @@ -311,8 +303,47 @@ const DiscussionPanel = ({ } if (uploadedFilename) { - // Format message text to include the asset reference for ChatMessage to detect - finalMessageText = `Please review this creative asset titled '${uploadedFilename}'. ${userInput}`; + // Get the latest asset count to generate display reference + try { + const assetsResponse = await focusGroupsApi.getAssets(focusGroupId); + const allAssets = assetsResponse?.data?.assets || []; + + // Find our newly uploaded asset + const uploadedAsset = allAssets.find(asset => asset.filename === uploadedFilename); + + // Generate display reference + let displayReference = 'the uploaded asset'; + if (uploadedAsset) { + if (uploadedAsset.user_assigned_name) { + displayReference = uploadedAsset.user_assigned_name; + } else { + // Count assets to generate "Asset N" reference + const assetIndex = allAssets.findIndex(asset => asset.filename === uploadedFilename); + displayReference = `Asset ${assetIndex + 1}`; + } + } + + // Store asset metadata for message + uploadedAssetMetadata = { + filename: uploadedFilename, + displayReference: displayReference + }; + + // Format message text to include the display reference instead of filename + finalMessageText = `Please review ${displayReference}. ${userInput}`; + + console.log('Using display reference in message:', displayReference); + + } catch (assetError) { + console.error('Error fetching asset metadata:', assetError); + // Fallback to generic reference + finalMessageText = `Please review the uploaded asset. ${userInput}`; + // Still store the basic metadata + uploadedAssetMetadata = { + filename: uploadedFilename, + displayReference: 'the uploaded asset' + }; + } toast.success('Creative asset uploaded successfully', { description: 'The image has been attached to your message.' @@ -332,31 +363,30 @@ const DiscussionPanel = ({ clearSelectedFile(); } - // Create user message with final text (including asset reference if uploaded) - const userMessage: Message = { - id: `msg-${Date.now()}`, - senderId: 'facilitator', - text: finalMessageText, - timestamp: new Date(), - type: 'question' - }; - - // Send message to API - const response = await focusGroupsApi.sendMessage(focusGroupId, { + // Send message to API first to get server timestamp + const messageData: any = { text: finalMessageText, type: 'question', senderId: 'facilitator' - }); + }; + + // Add visual asset information if file was uploaded + if (uploadedFilename) { + messageData.attached_assets = [uploadedFilename]; + messageData.activates_visual_context = true; + + // Add visual asset metadata for database storage + if (uploadedAssetMetadata) { + messageData.visualAsset = uploadedAssetMetadata; + } + } + + const response = await focusGroupsApi.sendMessage(focusGroupId, messageData); console.log('Message sent to API:', response); - - // Update message ID if available from API - if (response?.data?.message_id) { - userMessage.id = response.data.message_id; - } - - // Update UI with the new message - onNewMessage(userMessage); + + // Message will be handled by WebSocket system with correct server timestamp + // No need to manually create and add message here // Scroll to the latest message when the user sends something // regardless of auto-scroll setting @@ -370,12 +400,14 @@ const DiscussionPanel = ({ setTimeout(() => { generateMentionedResponses( mentionsToProcess.mentionedParticipantIds, - userMessage.text + finalMessageText ); }, 500); } else { - // No mentions to process - let useEffect clear loading state when message appears - // (Don't manually clear isTyping here since message might be delayed by polling) + // No mentions to process - clear typing indicator immediately since no AI responses are expected + setIsTyping(false); + setIsExpectingMessage(false); + loadingStartTimeRef.current = null; } } catch (error) { console.error('Error sending message:', error); @@ -612,6 +644,12 @@ const DiscussionPanel = ({ }; onNewMessage(completionMessage); + + // Clear typing state immediately since no AI response is expected + setIsTyping(false); + setIsExpectingMessage(false); + loadingStartTimeRef.current = null; + return; } @@ -650,6 +688,11 @@ const DiscussionPanel = ({ // Add the message to the UI onNewMessage(moderatorMessage); + // Clear typing state immediately in manual mode since no AI response is expected + setIsTyping(false); + setIsExpectingMessage(false); + loadingStartTimeRef.current = null; + // Scroll to see the new message setTimeout(() => { scrollToBottom(); @@ -909,7 +952,7 @@ const DiscussionPanel = ({ id: response.data.message_id || `msg-${Date.now()}-${participantId}`, senderId: participantId, text: response.data.response, - timestamp: new Date(), + timestamp: new Date(response.data.timestamp || response.data.created_at || new Date()), type: 'response' }; @@ -925,6 +968,11 @@ const DiscussionPanel = ({ } } + // Clear typing state immediately after all mentioned responses are processed + setIsTyping(false); + setIsExpectingMessage(false); + loadingStartTimeRef.current = null; + } catch (error) { console.error('Error generating mentioned responses:', error); toast.error('Failed to generate responses from mentioned participants'); @@ -933,7 +981,6 @@ const DiscussionPanel = ({ setIsExpectingMessage(false); loadingStartTimeRef.current = null; } - // Note: Don't clear loading in finally block - let message arrival handle it }; // Generate an AI response using intelligent participant selection @@ -1005,7 +1052,7 @@ const DiscussionPanel = ({ id: response.data.message_id, senderId: participantId, text: response.data.response, - timestamp: new Date(), + timestamp: new Date(response.data.timestamp || response.data.created_at || new Date()), type: 'response', highlighted: false }; @@ -1013,6 +1060,11 @@ const DiscussionPanel = ({ // Add the message to the UI onNewMessage(newMessage); + // Clear typing state immediately since the participant response is now available + setIsTyping(false); + setIsExpectingMessage(false); + loadingStartTimeRef.current = null; + // Scroll to see the AI response setTimeout(() => { scrollToBottom(); @@ -1028,6 +1080,12 @@ const DiscussionPanel = ({ toast.info("AI suggests moderator intervention", { description: `AI reasoning: ${decision.reasoning.substring(0, 100)}${decision.reasoning.length > 100 ? '...' : ''}` }); + + // Clear typing state since no participant response will be generated + setIsTyping(false); + setIsExpectingMessage(false); + loadingStartTimeRef.current = null; + return; // Don't generate participant response } @@ -1053,13 +1111,18 @@ const DiscussionPanel = ({ id: response.data.message_id, senderId: personaId, text: response.data.response, - timestamp: new Date(), + timestamp: new Date(response.data.timestamp || response.data.created_at || new Date()), type: 'response', highlighted: false }; onNewMessage(newMessage); + // Clear typing state immediately since the participant response is now available + setIsTyping(false); + setIsExpectingMessage(false); + loadingStartTimeRef.current = null; + setTimeout(() => { scrollToBottom(); }, 100); diff --git a/src/components/focus-group-session/types.ts b/src/components/focus-group-session/types.ts index ca5986c4..1ecd4e35 100644 --- a/src/components/focus-group-session/types.ts +++ b/src/components/focus-group-session/types.ts @@ -26,6 +26,10 @@ export interface Message { timestamp: Date; type: 'question' | 'response' | 'system' | 'highlight'; highlighted?: boolean; + visualAsset?: { + filename: string; + displayReference: string; + }; } export interface HighlightedTheme { diff --git a/src/components/persona/PersonaProfile.tsx b/src/components/persona/PersonaProfile.tsx index 1268b249..495a8611 100644 --- a/src/components/persona/PersonaProfile.tsx +++ b/src/components/persona/PersonaProfile.tsx @@ -11,9 +11,10 @@ import { BreadcrumbPage, BreadcrumbSeparator } from '@/components/ui/breadcrumb'; -import { ArrowLeft, Edit, Home, Users, User } from 'lucide-react'; +import { ArrowLeft, Edit, Home, Users, User, Download } from 'lucide-react'; import { useNavigation } from '@/contexts/NavigationContext'; -import { focusGroupsApi } from '@/lib/api'; +import { focusGroupsApi, personasApi } from '@/lib/api'; +import { toastService } from '@/lib/toast'; import { PersonaSidebar } from './PersonaSidebar'; import { PersonaCooperProfile } from './PersonaCooperProfile'; @@ -37,6 +38,7 @@ export default function PersonaProfile() { const { navigationState } = useNavigation(); const [focusGroupName, setFocusGroupName] = useState(''); + const [isExporting, setIsExporting] = useState(false); // Fetch focus group name if coming from focus group session useEffect(() => { @@ -58,6 +60,82 @@ export default function PersonaProfile() { // Determine if we should show breadcrumbs const showBreadcrumbs = navigationState.previousRoute?.startsWith('/focus-groups/') && navigationState.focusGroupId; + // Handle persona profile export + const handleExportProfile = async () => { + if (!currentPersona) return; + + setIsExporting(true); + + try { + toastService.info("Generating persona profile...", { + description: "Using GPT-4.1 to create a beautifully formatted markdown profile" + }); + + // Use the persona's MongoDB _id or fallback to id + const personaId = currentPersona._id || currentPersona.id; + + console.log(`šŸ”½ Frontend: Exporting profile for persona ${currentPersona.name} (ID: ${personaId})`); + + // Call the export API with GPT-4.1 + const response = await personasApi.exportProfile(personaId, { + llm_model: 'gpt-4.1', + temperature: 0.3 + }); + + const { markdown_content, persona_name, model_used, warning } = response.data; + + if (markdown_content) { + // Generate filename with current date + const currentDate = new Date().toISOString().split('T')[0]; // YYYY-MM-DD format + const safePersonaName = persona_name.replace(/[^a-zA-Z0-9\-\s]/g, '').replace(/\s+/g, '-').toLowerCase(); + const filename = `${safePersonaName}-profile-${currentDate}.md`; + + // Create and download the file + const element = document.createElement('a'); + const file = new Blob([markdown_content], { type: 'text/markdown' }); + element.href = URL.createObjectURL(file); + element.download = filename; + document.body.appendChild(element); + element.click(); + document.body.removeChild(element); + + // Show success toast + if (warning) { + toastService.success("Profile downloaded with fallback formatting", { + description: `${persona_name} profile saved as ${filename}` + }); + } else { + const modelDisplay = model_used === 'gpt-4.1' ? 'GPT-4.1' : model_used; + toastService.success("Profile downloaded successfully", { + description: `${persona_name} profile processed with ${modelDisplay} and saved as ${filename}` + }); + } + } else { + throw new Error("No markdown content received"); + } + + } catch (error) { + console.error("Error exporting persona profile:", error); + + // Show detailed error message + if (error.response) { + toastService.error("Failed to export profile", { + description: error.response.data?.error || "Server error occurred" + }); + } else if (error.request) { + toastService.error("Network error", { + description: "Unable to connect to the server" + }); + } else { + toastService.error("Export failed", { + description: error.message || "An unexpected error occurred" + }); + } + } finally { + setIsExporting(false); + } + }; + if (isLoading) { return ; } @@ -121,10 +199,21 @@ export default function PersonaProfile() {

Persona Profile

- +
+ + +
diff --git a/src/lib/api.ts b/src/lib/api.ts index f679d629..f12c2c0c 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -154,7 +154,13 @@ export const personasApi = { }, createBatch: (personasData: any[]) => - api.post('/personas/batch', personasData) + api.post('/personas/batch', personasData), + + // Export individual persona profile as markdown + exportProfile: (id: string, options?: { llm_model?: string; temperature?: number }) => + api.post(`/personas/${id}/export-profile`, options || {}, { + timeout: 300000 // 5 minutes for profile export + }) }; // AI Persona Generation endpoints @@ -479,6 +485,11 @@ export const focusGroupsApi = { getAssetUrl: (focusGroupId: string, filename: string) => `${API_BASE_URL}/focus-groups/${focusGroupId}/assets/${filename}`, + updateAssetName: (focusGroupId: string, filename: string, userAssignedName: string) => + api.patch(`/focus-groups/${focusGroupId}/assets/${filename}`, { + user_assigned_name: userAssignedName + }), + deleteAsset: (focusGroupId: string, filename: string) => api.delete(`/focus-groups/${focusGroupId}/assets/${filename}`) }; diff --git a/src/pages/FocusGroupSession.tsx b/src/pages/FocusGroupSession.tsx index 6c4d2369..98736f7e 100644 --- a/src/pages/FocusGroupSession.tsx +++ b/src/pages/FocusGroupSession.tsx @@ -99,6 +99,7 @@ const FocusGroupSession = () => { sectionTitle?: string; itemTitle?: string; itemType?: string; + metadata?: Record; isLoading?: boolean; }>({ isOpen: false }); @@ -535,7 +536,7 @@ const FocusGroupSession = () => { try { const response = await focusGroupsApi.getMessages(id); - + console.log('šŸ” [FetchMessages] Raw API response:', response?.data); // Handle both old (array) and new (object with messages/mode_events) response formats let messagesData: any[] = []; @@ -564,9 +565,19 @@ const FocusGroupSession = () => { text: msg.text, timestamp: new Date(msg.timestamp || msg.created_at || new Date()), type: msg.type || 'response', - highlighted: msg.highlighted || false + highlighted: msg.highlighted || false, + visualAsset: msg.visualAsset // Include visual asset metadata for image display })); + console.log('šŸ” [FetchMessages] Formatted messages with visual assets:', + formattedMessages.filter(m => m.visualAsset).map(m => ({ + id: m.id, + senderId: m.senderId, + hasVisualAsset: !!m.visualAsset, + visualAsset: m.visualAsset + })) + ); + // Convert dates and format mode events const formattedModeEvents = modeEventsData.map((event: any) => ({ id: event._id || event.id || `event-${Date.now()}`, @@ -1187,7 +1198,17 @@ const FocusGroupSession = () => { // Handler for adding new messages to the conversation const handleNewMessage = (message: Message) => { - setMessages(prevMessages => [...prevMessages, message]); + setMessages(prevMessages => { + // Check for duplicates + const exists = prevMessages.find(m => m.id === message.id); + if (exists) { + console.log('šŸ”§ [handleNewMessage] Message already exists, skipping:', message.id); + return prevMessages; + } + + console.log('šŸ”§ [handleNewMessage] Adding new message:', message.id); + return [...prevMessages, message]; + }); }; const toggleHighlight = async (messageId: string) => { @@ -1556,7 +1577,7 @@ const FocusGroupSession = () => { }, []); // Handler for setting moderator position - const handleSetPosition = useCallback((sectionId: string, itemId: string, content: string, sectionTitle: string, itemTitle?: string, itemType?: string) => { + const handleSetPosition = useCallback((sectionId: string, itemId: string, content: string, sectionTitle: string, itemTitle?: string, itemType?: string, metadata?: Record) => { setSetPositionDialog({ isOpen: true, sectionId, @@ -1564,7 +1585,8 @@ const FocusGroupSession = () => { content, sectionTitle, itemTitle, - itemType + itemType, + metadata }); }, []); @@ -2111,13 +2133,15 @@ const FocusGroupSession = () => { let activatesVisualContext = false; let enhancedMessageText = setPositionDialog.content; // Start with original text - // Extract asset filename from content - this works for any item type - const assetFilename = setPositionDialog.content ? extractAssetFilename(setPositionDialog.content) : null; - const hasImageAttached = !!assetFilename; + // Check for visual asset in metadata instead of parsing content + const visualAsset = setPositionDialog.metadata?.visual_asset; + const hasImageAttached = !!visualAsset?.filename; + const assetFilename = visualAsset?.filename; console.log('šŸ” MANUAL POSITION DEBUG:', { itemType: setPositionDialog.itemType, hasImageAttached, + visualAsset, assetFilename, content: setPositionDialog.content, sectionTitle: setPositionDialog.sectionTitle, @@ -2126,9 +2150,11 @@ const FocusGroupSession = () => { }); if (hasImageAttached && setPositionDialog.content && assetFilename) { - console.log('šŸ” ASSET EXTRACTION DEBUG:', { + console.log('šŸ” VISUAL ASSET DEBUG:', { originalContent: setPositionDialog.content, - extractedFilename: assetFilename, + visualAsset, + displayReference: visualAsset?.display_reference, + filename: assetFilename, contentLength: setPositionDialog.content.length }); @@ -2141,22 +2167,14 @@ const FocusGroupSession = () => { try { console.log('šŸŽØ MANUAL MODE: Requesting AI description for', assetFilename); - // First test the routing with a simple endpoint - try { - console.log('šŸ” TESTING: Calling test endpoint first...'); - const testResponse = await api.post(`/focus-groups/${id}/test-endpoint`, { test: 'data' }); - console.log('āœ… TEST: Test endpoint response:', testResponse.data); - } catch (testError) { - console.error('āŒ TEST: Test endpoint failed:', testError); - } - const descriptionResponse = await focusGroupsApi.describeAsset(id, assetFilename); if (descriptionResponse.data.description) { - // Enhance the question text with the AI description + // Enhance the question text with the AI description using display reference + const displayRef = visualAsset?.display_reference || 'the asset'; enhancedMessageText = setPositionDialog.content.replace( - `'${assetFilename}'`, - `'${assetFilename}' - ${descriptionResponse.data.description}` + displayRef, + `${displayRef} - ${descriptionResponse.data.description}` ); console.log('āœ… MANUAL MODE: Enhanced question with AI description'); @@ -2194,7 +2212,11 @@ const FocusGroupSession = () => { senderId: 'moderator', text: enhancedMessageText, // Use enhanced text timestamp: new Date(), - type: 'question' + type: 'question', + visualAsset: hasImageAttached && visualAsset ? { + filename: assetFilename, + displayReference: visualAsset.display_reference + } : undefined }; // Send to API first with visual asset information @@ -2210,7 +2232,11 @@ const FocusGroupSession = () => { text: enhancedMessageText, // Use enhanced text in API call too type: 'question', attached_assets: attachedAssets, - activates_visual_context: activatesVisualContext + activates_visual_context: activatesVisualContext, + visualAsset: hasImageAttached && visualAsset ? { + filename: assetFilename, + displayReference: visualAsset.display_reference + } : undefined }); if (msgResponse?.data?.message_id) { diff --git a/src/services/websocketService.ts b/src/services/websocketService.ts index 68a50feb..e2b4cc0a 100644 --- a/src/services/websocketService.ts +++ b/src/services/websocketService.ts @@ -15,6 +15,10 @@ export interface WebSocketEvents { highlighted: boolean; attached_assets?: string[]; activates_visual_context?: boolean; + visualAsset?: { + filename: string; + displayReference: string; + }; }; }; @@ -90,7 +94,8 @@ export function convertWebSocketMessage(wsMessage: WebSocketEvents['message_upda type: wsMessage.type, highlighted: wsMessage.highlighted, attached_assets: wsMessage.attached_assets || [], - activates_visual_context: wsMessage.activates_visual_context || false + activates_visual_context: wsMessage.activates_visual_context || false, + visualAsset: wsMessage.visualAsset }; console.log('šŸ” [GPT-5 CONVERTER] Output converted:', JSON.stringify(converted, null, 2)); diff --git a/src/utils/mentionUtils.tsx b/src/utils/mentionUtils.tsx index 46af3f80..3960a689 100644 --- a/src/utils/mentionUtils.tsx +++ b/src/utils/mentionUtils.tsx @@ -21,8 +21,8 @@ export function parseMentions(text: string, participants: Persona[]): ParsedMent const mentions: MentionData[] = []; const mentionedParticipantIds: string[] = []; - // Regular expression to match @mentions - const mentionRegex = /@(\w+(?:\s+\w+)*)/g; + // Regular expression to match @mentions - stop at conjunctions or non-word boundaries + const mentionRegex = /@(\w+(?:\s+\w+)*?)(?=\s+and\s|\s+or\s|\s*[^\w\s]|\s*$)/g; let match; while ((match = mentionRegex.exec(text)) !== null) {